@@ -19,6 +19,24 @@ class DefinitionTest {
19
19
.definition(m5 to m6, List (m1 to m2))
20
20
}
21
21
22
+ @ Test def caseClassDefinition0 : Unit = {
23
+ withSources(
24
+ code """ case class ${m1}Foo ${m2}(x: String) {
25
+ def ${m3}this ${m4}(x: Int) = ${m5}this ${m6}(x.toString)
26
+ } """ ,
27
+ code """ class Bar {
28
+ val foo: ${m7}Foo ${m8} = ${m9}Foo ${m10}("hello")
29
+ val bar: ${m11}Foo ${m12} = new ${m13}Foo ${m14}(2)
30
+ } """
31
+ ) .definition(m1 to m2, List (m1 to m2))
32
+ .definition(m3 to m4, List (m3 to m4))
33
+ .definition(m5 to m6, List (m1 to m2))
34
+ .definition(m7 to m8, List (m1 to m2))
35
+ .definition(m9 to m10, List (m1 to m2))
36
+ .definition(m11 to m12, List (m1 to m2))
37
+ .definition(m13 to m14, List (m3 to m4))
38
+ }
39
+
22
40
@ Test def valDefinition0 : Unit = {
23
41
withSources(
24
42
code " class Foo { val ${m1}x $m2 = 0; ${m3}x $m4 } " ,
@@ -134,6 +152,18 @@ class DefinitionTest {
134
152
.definition(m11 to m12, List (m1 to m2))
135
153
}
136
154
155
+ @ Test def goToParamApply : Unit = {
156
+ withSources(
157
+ code """ case class Foo( ${m1}x ${m2}: Int, ${m3}y ${m4}: String) """ ,
158
+ code """ object Bar {
159
+ Foo( ${m5}x ${m6} = 1, ${m7}y ${m8} = "hello")
160
+ } """
161
+ ) .definition(m1 to m2, List (m1 to m2))
162
+ .definition(m3 to m4, List (m3 to m4))
163
+ .definition(m5 to m6, List (m1 to m2))
164
+ .definition(m7 to m8, List (m3 to m4))
165
+ }
166
+
137
167
@ Test def goToParamCopyMethod : Unit = {
138
168
139
169
withSources(
@@ -148,4 +178,15 @@ class DefinitionTest {
148
178
.definition(m9 to m10, List (m3 to m4))
149
179
}
150
180
181
+ @ Test def constructorDefinition : Unit = {
182
+ withSources(
183
+ code " class ${m1}A ${m2}(x: Boolean) { def ${m3}this ${m4}(x: Int) = ${m5}this ${m6}(x > 0) } " ,
184
+ code " object B { val a0 = new ${m7}A ${m8}(true); val a1 = new ${m9}A ${m10}(0) } "
185
+ ) .definition(m1 to m2, List (m1 to m2))
186
+ .definition(m3 to m4, List (m3 to m4))
187
+ .definition(m5 to m6, List (m1 to m2))
188
+ .definition(m7 to m8, List (m1 to m2))
189
+ .definition(m9 to m10, List (m3 to m4))
190
+ }
191
+
151
192
}
0 commit comments