-
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.
test: annotation calls and named types referencing declarations in ot…
…her files (#587) Closes partially #540 ### Summary of Changes Add tests to ensure that annotation calls and named types can reference declarations in other files. No changes to the implementation of the scope provider were needed. --------- Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
- Loading branch information
1 parent
6b30de5
commit 928b520
Showing
51 changed files
with
489 additions
and
20 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
17 changes: 17 additions & 0 deletions
17
...sources/scoping/annotation calls/across files/main no imports or own declarations.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,17 @@ | ||
package tests.scoping.annotationCalls.acrossFiles | ||
|
||
// $TEST$ references same_MyAnnotation | ||
@»MyAnnotation« | ||
|
||
// $TEST$ references same_AnnotationInSamePackage | ||
@»AnnotationInSamePackage« | ||
|
||
// $TEST$ references safeds_AnnotationInSafeDsPackage | ||
@»AnnotationInSafeDsPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationInAnotherPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationWithoutPackage« | ||
pipeline myPipeline {} |
23 changes: 23 additions & 0 deletions
23
...rces/scoping/annotation calls/across files/main with imports and own declarations.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.annotationCalls.acrossFiles | ||
|
||
import safeds.scoping.annotationCalls.acrossFiles.MyAnnotation as MyOwnAnnotation | ||
import tests.scoping.annotationCalls.acrossFiles.other.AnnotationInAnotherPackage | ||
|
||
// $TEST$ target own_MyOwnAnnotation | ||
annotation »MyOwnAnnotation« | ||
|
||
// $TEST$ references own_MyOwnAnnotation | ||
@»MyOwnAnnotation« | ||
|
||
// $TEST$ references same_AnnotationInSamePackage | ||
@»AnnotationInSamePackage« | ||
|
||
// $TEST$ references safeds_AnnotationInSafeDsPackage | ||
@»AnnotationInSafeDsPackage« | ||
|
||
// $TEST$ references other_AnnotationInAnotherPackage | ||
@»AnnotationInAnotherPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationWithoutPackage« | ||
pipeline myPipeline {} |
10 changes: 10 additions & 0 deletions
10
...ces/scoping/annotation calls/across files/main with multiple imports of same name.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,10 @@ | ||
package tests.scoping.annotationCalls.acrossFiles | ||
|
||
import safeds.scoping.annotationCalls.acrossFiles.MyAnnotation | ||
import tests.scoping.annotationCalls.acrossFiles.other.MyAnnotation | ||
import tests.scoping.annotationCalls.acrossFiles.MyAnnotation | ||
|
||
pipeline myPipeline { | ||
// $TEST$ references safeds_MyAnnotation | ||
»MyAnnotation«; | ||
} |
31 changes: 31 additions & 0 deletions
31
...urces/scoping/annotation calls/across files/main with qualified import with alias.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,31 @@ | ||
package tests.scoping.annotationCalls.acrossFiles | ||
|
||
import tests.scoping.annotationCalls.acrossFiles.MyAnnotation as MyAnnotationInSamePackage | ||
import safeds.scoping.annotationCalls.acrossFiles.MyAnnotation as MyAnnotationInSafeDsPackage | ||
import tests.scoping.annotationCalls.acrossFiles.other.MyAnnotation as MyAnnotationInAnotherPackage | ||
|
||
// $TEST$ references same_MyAnnotation | ||
@»MyAnnotation« | ||
|
||
|
||
// $TEST$ references same_AnnotationInSamePackage | ||
@»AnnotationInSamePackage« | ||
|
||
// $TEST$ references safeds_AnnotationInSafeDsPackage | ||
@»AnnotationInSafeDsPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationInAnotherPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationWithoutPackage« | ||
|
||
// $TEST$ references same_MyAnnotation | ||
@»MyAnnotationInSamePackage« | ||
|
||
// $TEST$ references safeds_MyAnnotation | ||
@»MyAnnotationInSafeDsPackage« | ||
|
||
// $TEST$ references other_MyAnnotation | ||
@»MyAnnotationInAnotherPackage« | ||
pipeline myPipeline {} |
21 changes: 21 additions & 0 deletions
21
tests/resources/scoping/annotation calls/across files/main with qualified import.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,21 @@ | ||
package tests.scoping.annotationCalls.acrossFiles | ||
|
||
import safeds.scoping.annotationCalls.acrossFiles.MyAnnotation | ||
import tests.scoping.annotationCalls.acrossFiles.other.AnnotationInAnotherPackage | ||
import AnnotationWithoutPackage | ||
|
||
// $TEST$ references safeds_MyAnnotation | ||
@»MyAnnotation« | ||
|
||
// $TEST$ references same_AnnotationInSamePackage | ||
@»AnnotationInSamePackage« | ||
|
||
// $TEST$ references safeds_AnnotationInSafeDsPackage | ||
@»AnnotationInSafeDsPackage« | ||
|
||
// $TEST$ references other_AnnotationInAnotherPackage | ||
@»AnnotationInAnotherPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationWithoutPackage« | ||
pipeline myPipeline {} |
19 changes: 19 additions & 0 deletions
19
tests/resources/scoping/annotation calls/across files/main with wildcard import.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,19 @@ | ||
package tests.scoping.annotationCalls.acrossFiles | ||
|
||
import safeds.scoping.annotationCalls.acrossFiles.* | ||
|
||
// $TEST$ references safeds_MyAnnotation | ||
@»MyAnnotation« | ||
|
||
// $TEST$ references same_AnnotationInSamePackage | ||
@»AnnotationInSamePackage« | ||
|
||
// $TEST$ references safeds_AnnotationInSafeDsPackage | ||
@»AnnotationInSafeDsPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationInAnotherPackage« | ||
|
||
// $TEST$ unresolved | ||
@»AnnotationWithoutPackage« | ||
pipeline myPipeline {} |
7 changes: 7 additions & 0 deletions
7
tests/resources/scoping/annotation calls/across files/resource other package.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,7 @@ | ||
package tests.scoping.annotationCalls.acrossFiles.other | ||
|
||
// $TEST$ target other_MyAnnotation | ||
annotation »MyAnnotation« | ||
|
||
// $TEST$ target other_AnnotationInAnotherPackage | ||
annotation »AnnotationInAnotherPackage« |
7 changes: 7 additions & 0 deletions
7
tests/resources/scoping/annotation calls/across files/resource safeds package.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,7 @@ | ||
package safeds.scoping.annotationCalls.acrossFiles | ||
|
||
// $TEST$ target safeds_MyAnnotation | ||
annotation »MyAnnotation« | ||
|
||
// $TEST$ target safeds_AnnotationInSafeDsPackage | ||
annotation »AnnotationInSafeDsPackage« |
7 changes: 7 additions & 0 deletions
7
tests/resources/scoping/annotation calls/across files/resource same package.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,7 @@ | ||
package tests.scoping.annotationCalls.acrossFiles | ||
|
||
// $TEST$ target same_MyAnnotation | ||
annotation »MyAnnotation« | ||
|
||
// $TEST$ target same_AnnotationInSamePackage | ||
annotation »AnnotationInSamePackage« |
5 changes: 5 additions & 0 deletions
5
tests/resources/scoping/annotation calls/across files/resource without package.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,5 @@ | ||
// $TEST$ target without_MyAnnotation | ||
annotation »MyAnnotation« | ||
|
||
// $TEST$ target without_AnnotationWithoutPackage | ||
annotation »AnnotationWithoutPackage« |
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
18 changes: 18 additions & 0 deletions
18
...ng/named types/across files/to global classes/main no imports or own declarations.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,18 @@ | ||
package tests.scoping.namedTypes.acrossFiles.toGlobalClasses | ||
|
||
segment mySegment( | ||
// $TEST$ references same_MyClass | ||
p1: »MyClass«, | ||
|
||
// $TEST$ references same_ClassInSamePackage | ||
p2: »ClassInSamePackage«, | ||
|
||
// $TEST$ references safeds_ClassInSafeDsPackage | ||
p3: »ClassInSafeDsPackage«, | ||
|
||
// $TEST$ unresolved | ||
p4: »ClassInAnotherPackage«, | ||
|
||
// $TEST$ unresolved | ||
p5: »ClassWithoutPackage«, | ||
) {} |
24 changes: 24 additions & 0 deletions
24
...named types/across files/to global classes/main with imports and own declarations.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,24 @@ | ||
package tests.scoping.namedTypes.acrossFiles.toGlobalClasses | ||
|
||
import safeds.scoping.namedTypes.acrossFiles.toGlobalClasses.MyClass as MyOwnClass | ||
import tests.scoping.namedTypes.acrossFiles.toGlobalClasses.other.ClassInAnotherPackage | ||
|
||
// $TEST$ target own_MyOwnClass | ||
class »MyOwnClass« | ||
|
||
segment mySegment( | ||
// $TEST$ references own_MyOwnClass | ||
p1: »MyOwnClass«, | ||
|
||
// $TEST$ references same_ClassInSamePackage | ||
p2: »ClassInSamePackage«, | ||
|
||
// $TEST$ references safeds_ClassInSafeDsPackage | ||
p3: »ClassInSafeDsPackage«, | ||
|
||
// $TEST$ references other_ClassInAnotherPackage | ||
p4: »ClassInAnotherPackage«, | ||
|
||
// $TEST$ unresolved | ||
p5: »ClassWithoutPackage«, | ||
) {} |
10 changes: 10 additions & 0 deletions
10
...amed types/across files/to global classes/main with multiple imports of same name.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,10 @@ | ||
package tests.scoping.namedTypes.acrossFiles.toGlobalClasses | ||
|
||
import safeds.scoping.namedTypes.acrossFiles.toGlobalClasses.MyClass | ||
import tests.scoping.namedTypes.acrossFiles.toGlobalClasses.other.MyClass | ||
import tests.scoping.namedTypes.acrossFiles.toGlobalClasses.MyClass | ||
|
||
segment mySegment( | ||
// $TEST$ references safeds_MyClass | ||
p: »MyClass«, | ||
) {} |
32 changes: 32 additions & 0 deletions
32
.../named types/across files/to global classes/main with qualified import with alias.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,32 @@ | ||
package tests.scoping.namedTypes.acrossFiles.toGlobalClasses | ||
|
||
import tests.scoping.namedTypes.acrossFiles.toGlobalClasses.MyClass as MyClassInSamePackage | ||
import safeds.scoping.namedTypes.acrossFiles.toGlobalClasses.MyClass as MyClassInSafeDsPackage | ||
import tests.scoping.namedTypes.acrossFiles.toGlobalClasses.other.MyClass as MyClassInAnotherPackage | ||
|
||
segment mySegment( | ||
// $TEST$ references same_MyClass | ||
p1: »MyClass«, | ||
|
||
|
||
// $TEST$ references same_ClassInSamePackage | ||
p2: »ClassInSamePackage«, | ||
|
||
// $TEST$ references safeds_ClassInSafeDsPackage | ||
p3: »ClassInSafeDsPackage«, | ||
|
||
// $TEST$ unresolved | ||
p4: »ClassInAnotherPackage«, | ||
|
||
// $TEST$ unresolved | ||
p5: »ClassWithoutPackage«, | ||
|
||
// $TEST$ references same_MyClass | ||
p6: »MyClassInSamePackage«, | ||
|
||
// $TEST$ references safeds_MyClass | ||
p7: »MyClassInSafeDsPackage«, | ||
|
||
// $TEST$ references other_MyClass | ||
p8: »MyClassInAnotherPackage«, | ||
) {} |
Oops, something went wrong.