-
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 member accesses if receiver has type parameter type (…
…#889) ### Summary of Changes The scope provider can now handle member accesses where the receiver has type parameter type. This type is replaced by its upper bound, before name resolution continues as before.
- Loading branch information
1 parent
83378a3
commit 1277bd1
Showing
2 changed files
with
32 additions
and
1 deletion.
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
29 changes: 29 additions & 0 deletions
29
...ages/safe-ds-lang/tests/resources/scoping/member accesses/on type parameters/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,29 @@ | ||
package tests.scoping.memberAccesses.onTypeParameters | ||
|
||
class C { | ||
// $TEST$ target attribute | ||
attr »a«: Int | ||
} | ||
|
||
class MyClass<Unbounded, UpperBound>( | ||
unbounded: Unbounded, | ||
upperBound: UpperBound, | ||
|
||
// $TEST$ unresolved | ||
p1: Any = unbounded.»a«, | ||
// $TEST$ references attribute | ||
p2: Any = upperBound.»a«, | ||
) where { | ||
UpperBound sub C | ||
} { | ||
attr unbounded: Unbounded | ||
attr upperBound: UpperBound | ||
} | ||
|
||
segment mySegment(instance: MyClass<C, C>) { | ||
// $TEST$ references attribute | ||
instance.unbounded.»a«; | ||
|
||
// $TEST$ references attribute | ||
instance.upperBound.»a«; | ||
} |