-
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 own members (#611)
Closes partially #540 ### Summary of Changes Implement scoping for own instance members, namely to * instance attributes of classes, * instance methods of classes, * parameters of enum variants.
- Loading branch information
1 parent
2a3ef33
commit 43b276f
Showing
20 changed files
with
275 additions
and
74 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
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
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
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
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
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
45 changes: 45 additions & 0 deletions
45
tests/resources/scoping/member accesses/to parameter of enum variants/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,45 @@ | ||
package tests.scoping.memberAccesses.toParametersOfEnumVariants | ||
|
||
enum MyEnum { | ||
MyEnumVariant( | ||
// $TEST$ target param | ||
»param«: Int, | ||
|
||
// $TEST$ target redeclared | ||
»redeclared«: Int, | ||
redeclared: Int, | ||
) | ||
|
||
MyOtherEnumVariant | ||
} | ||
|
||
enum MyOtherEnum { | ||
MyEnumVariant | ||
} | ||
|
||
pipeline myPipeline { | ||
// $TEST$ references param | ||
MyEnum.MyEnumVariant().»param«; | ||
|
||
// $TEST$ references redeclared | ||
MyEnum.MyEnumVariant().»redeclared«; | ||
|
||
|
||
// $TEST$ unresolved | ||
MyOtherEnum.MyEnumVariant.»param«; | ||
|
||
// $TEST$ unresolved | ||
MyEnum.MyOtherEnumVariant().»param«; | ||
|
||
// $TEST$ unresolved | ||
MyOtherEnum.MyEnumVariant().»param«; | ||
|
||
// $TEST$ unresolved | ||
MyEnum.MyEnumVariant().»unresolved«; | ||
|
||
// $TEST$ unresolved | ||
MyEnum.unresolved().»param«; | ||
|
||
// $TEST$ unresolved | ||
unresolved.MyEnumVariant().»param«; | ||
} |
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
23 changes: 23 additions & 0 deletions
23
...urces/scoping/member accesses/to results/of callable types (matching member)/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,23 @@ | ||
package tests.scoping.memberAccesses.toResults.ofCallableTypes.matchingMember | ||
|
||
class MyClass() { | ||
// $TEST$ target MyClass_result | ||
attr »result«: Int | ||
} | ||
|
||
enum MyEnum { | ||
// $TEST$ target MyEnum_result | ||
MyEnumVariant(»result«: Int) | ||
} | ||
|
||
segment mySegment( | ||
f1: () -> result: MyClass, | ||
f2: () -> result: MyEnum.MyEnumVariant, | ||
) { | ||
|
||
// $TEST$ references MyClass_result | ||
f1().»result«; | ||
|
||
// $TEST$ references MyEnum_result | ||
f2().»result«; | ||
} |
22 changes: 22 additions & 0 deletions
22
.../resources/scoping/member accesses/to results/of functions (matching member)/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,22 @@ | ||
package tests.scoping.memberAccesses.toResults.ofFunctions.matchingMember | ||
|
||
class MyClass() { | ||
// $TEST$ target MyClass_result | ||
attr »result«: Int | ||
} | ||
|
||
enum MyEnum { | ||
// $TEST$ target MyEnum_result | ||
MyEnumVariant(»result«: Int) | ||
} | ||
|
||
fun f1() -> result: MyClass | ||
fun f2() -> result: MyEnum.MyEnumVariant | ||
|
||
pipeline myPipeline { | ||
// $TEST$ references MyClass_result | ||
f1().»result«; | ||
|
||
// $TEST$ references MyEnum_result | ||
f2().»result«; | ||
} |
22 changes: 22 additions & 0 deletions
22
...s/resources/scoping/member accesses/to results/of segments (matching member)/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,22 @@ | ||
package tests.scoping.memberAccesses.toResults.ofSegments.matchingMember | ||
|
||
class MyClass() { | ||
// $TEST$ target MyClass_result | ||
attr »result«: Int | ||
} | ||
|
||
enum MyEnum { | ||
// $TEST$ target MyEnum_result | ||
MyEnumVariant(»result«: Int) | ||
} | ||
|
||
segment s1() -> result: MyClass {} | ||
segment s2() -> result: MyEnum.MyEnumVariant {} | ||
|
||
pipeline myPipeline { | ||
// $TEST$ references MyClass_result | ||
s1().»result«; | ||
|
||
// $TEST$ references MyEnum_result | ||
s2().»result«; | ||
} |
Oops, something went wrong.