File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
common/src/main/kotlin/component
src/test/kotlin/com/compiler/server Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class KotlinEnvironment(
42
42
" -opt-in=kotlin.contracts.ExperimentalContracts" ,
43
43
" -opt-in=kotlin.experimental.ExperimentalTypeInference" ,
44
44
" -Xcontext-receivers" ,
45
+ " -XXLanguage:+ExplicitBackingFields"
45
46
)
46
47
}
47
48
Original file line number Diff line number Diff line change @@ -94,4 +94,28 @@ class KotlinFeatureSince170 : BaseExecutorTest() {
94
94
contains = " second quarter"
95
95
)
96
96
}
97
+
98
+ @Test
99
+ fun `Experimental support for explicit backing fields` () {
100
+ run (
101
+ code = """
102
+ fun main() {
103
+ class Test {
104
+ val names: List<String>
105
+ field: MutableList<String> = mutableListOf<String>()
106
+
107
+ fun doThing() {
108
+ names.add("Hello!")
109
+ }
110
+ }
111
+
112
+ val test = Test()
113
+ test.doThing()
114
+
115
+ println(test.names)
116
+ }
117
+ """ .trimIndent(),
118
+ contains = " [Hello!]"
119
+ )
120
+ }
97
121
}
You can’t perform that action at this time.
0 commit comments