Properly generate inner classes when compiling source for inline

KT-19175: Compiler generates different bytecode when classes are compiled separately or together

 #KT-19175 Fixed
This commit is contained in:
Mikhael Bogdanov
2017-07-26 13:32:46 +02:00
parent 7da6ff78c1
commit ff676c050f
24 changed files with 312 additions and 32 deletions
@@ -0,0 +1,10 @@
abstract class Introspector<M : Model>(protected val model: Model) {
protected abstract inner class Retriever(protected val transaction: Any) {
protected var model: Model = this@Introspector.model
}
protected abstract inner class SchemaRetriever(transaction: Any): Retriever(transaction) {
protected inline fun inSchema(crossinline modifier: (Any) -> Unit) =
model.modify { schema -> modifier.invoke(schema) }
}
}
@@ -0,0 +1,12 @@
class IntrospectorImpl(model: ModuleImpl) : Introspector<ModuleImpl>(model) {
private inner class SchemaRetriever(transaction: Any) : Introspector<ModuleImpl>.SchemaRetriever(transaction) {
internal fun retrieve() {
inSchema { schema -> println(schema) }
}
}
}
class ModuleImpl : Model {
override fun modify(modifier: ModelModifier) {}
}
@@ -0,0 +1,4 @@
public interface Model {
void modify(ModelModifier modifier);
}
@@ -0,0 +1,3 @@
public interface ModelModifier {
void perform(Object element);
}
@@ -0,0 +1,7 @@
================ Step #1 =================
Compiling files:
src/IntrospectorImpl.kt
End of files
Exit code: OK
------------------------------------------