-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: scoping for references to containing declarations (#708)
Closes #540 ### Summary of Changes Implement the same scoping rules for references to containing declarations as for named types.
- Loading branch information
1 parent
182d64b
commit 3762c36
Showing
2 changed files
with
140 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
...g/tests/resources/scoping/references/in same file/to containing declarations/main.sdstest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package tests.scoping.references.inSameFile.toContainingDeclarations | ||
|
||
@Repeatable | ||
annotation MyAnnotation(p: Any?) | ||
|
||
// $TEST$ target outerClass | ||
class »MyClass«( | ||
@MyAnnotation( | ||
// $TEST$ references outerClass | ||
p = »MyClass«() | ||
) | ||
// $TEST$ references outerClass | ||
p: Any? = »MyClass«() | ||
) { | ||
|
||
@MyAnnotation( | ||
// $TEST$ references outerClass | ||
p = »MyClass«() | ||
) | ||
@MyAnnotation( | ||
// $TEST$ unresolved | ||
p = »MyEnum« | ||
) | ||
fun f( | ||
@MyAnnotation( | ||
// $TEST$ references outerClass | ||
p = »MyClass«() | ||
) | ||
// $TEST$ references outerClass | ||
p1: Any? = »MyClass«(), | ||
|
||
@MyAnnotation( | ||
// $TEST$ unresolved | ||
p = »MyEnum« | ||
) | ||
// $TEST$ unresolved | ||
p2: Any? = »MyEnum« | ||
) | ||
|
||
@MyAnnotation( | ||
// $TEST$ references outerClass | ||
p = »MyClass«() | ||
) | ||
@MyAnnotation( | ||
// $TEST$ unresolved | ||
p = »MyEnum« | ||
) | ||
// $TEST$ target enum | ||
enum »MyEnum« { | ||
// $TEST$ target variant | ||
»MyEnumVariant«( | ||
@MyAnnotation( | ||
// $TEST$ references outerClass | ||
p = »MyClass«() | ||
) | ||
// $TEST$ references outerClass | ||
p1: Any? = »MyClass«(), | ||
|
||
@MyAnnotation( | ||
// $TEST$ references enum | ||
p = »MyEnum« | ||
) | ||
// $TEST$ references enum | ||
p2: Any? = »MyEnum«, | ||
|
||
@MyAnnotation( | ||
// $TEST$ references variant | ||
p = »MyEnumVariant« | ||
) | ||
// $TEST$ references variant | ||
p3: Any? = »MyEnumVariant«, | ||
) | ||
} | ||
|
||
@MyAnnotation( | ||
// $TEST$ references outerClass | ||
p = »MyClass«() | ||
) | ||
@MyAnnotation( | ||
// $TEST$ unresolved | ||
p = »MyEnum« | ||
) | ||
// $TEST$ target innerClass | ||
class »MyClass«( | ||
@MyAnnotation( | ||
// $TEST$ references innerClass | ||
p = »MyClass«() | ||
) | ||
// $TEST$ references innerClass | ||
p1: Any? = »MyClass«(), | ||
|
||
@MyAnnotation( | ||
// $TEST$ unresolved | ||
p = »MyEnum« | ||
) | ||
// $TEST$ unresolved | ||
p2: Any? = »MyEnum« | ||
) { | ||
fun f( | ||
@MyAnnotation( | ||
// $TEST$ references innerClass | ||
p = »MyClass«() | ||
) | ||
// $TEST$ references innerClass | ||
p1: Any? = »MyClass«(), | ||
|
||
@MyAnnotation( | ||
// $TEST$ unresolved | ||
p = »MyEnum« | ||
) | ||
// $TEST$ unresolved | ||
p2: Any? = »MyEnum« | ||
) | ||
} | ||
} |