-
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: error if simple names of builtin declarations collide (#678)
Closes #672 ### Summary of Changes <!-- Please provide a summary of changes in this pull request, ensuring all changes are explained. -->
- Loading branch information
1 parent
e846b59
commit 275ad5e
Showing
12 changed files
with
150 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const BUILTINS_ROOT_PACKAGE = 'safeds'; |
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
27 changes: 18 additions & 9 deletions
27
tests/resources/validation/names/duplicates/across files/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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
package tests.validation.names.acrossFiles.other | ||
|
||
annotation UniqueAnnotation | ||
class UniqueClass | ||
enum UniqueEnum | ||
fun uniqueFunction() | ||
pipeline uniquePipeline {} | ||
schema UniqueSchema {} | ||
segment uniquePublicSegment() {} | ||
internal segment uniqueInternalSegment() {} | ||
private segment uniquePrivateSegment() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
annotation »UniqueAnnotation« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
class »UniqueClass« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
enum »UniqueEnum« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
fun »uniqueFunction«() | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
pipeline »uniquePipeline« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
schema »UniqueSchema« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
segment »uniquePublicSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
internal segment »uniqueInternalSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
private segment »uniquePrivateSegment«() {} |
27 changes: 27 additions & 0 deletions
27
tests/resources/validation/names/duplicates/across files/safeds 1.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,27 @@ | ||
package safeds.lang | ||
|
||
/* | ||
* Declarations that only occur a second time in builtin files should be excluded, so we don't get errors while editing them. | ||
*/ | ||
|
||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
class »Any« | ||
|
||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateAnnotation'." | ||
annotation »DuplicateAnnotation« | ||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateClass'." | ||
class »DuplicateClass« | ||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateEnum'." | ||
enum »DuplicateEnum« | ||
// $TEST$ error "Multiple builtin declarations have the name 'duplicateFunction'." | ||
fun »duplicateFunction«() | ||
// $TEST$ no error r"Multiple builtin declarations have the name '\w*'\." | ||
pipeline »duplicatePipeline« {} | ||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateSchema'." | ||
schema »DuplicateSchema« {} | ||
// $TEST$ error "Multiple builtin declarations have the name 'duplicatePublicSegment'." | ||
segment »duplicatePublicSegment«() {} | ||
// $TEST$ error "Multiple builtin declarations have the name 'duplicateInternalSegment'." | ||
internal segment »duplicateInternalSegment«() {} | ||
// $TEST$ no error r"Multiple builtin declarations have the name '\w*'\." | ||
private segment »duplicatePrivateSegment«() {} |
20 changes: 20 additions & 0 deletions
20
tests/resources/validation/names/duplicates/across files/safeds 2.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,20 @@ | ||
package safeds.lang.other | ||
|
||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateAnnotation'." | ||
annotation »DuplicateAnnotation« | ||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateClass'." | ||
class »DuplicateClass« | ||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateEnum'." | ||
enum »DuplicateEnum« | ||
// $TEST$ error "Multiple builtin declarations have the name 'duplicateFunction'." | ||
fun »duplicateFunction«() | ||
// $TEST$ no error r"Multiple builtin declarations have the name '\w*'\." | ||
pipeline »duplicatePipeline« {} | ||
// $TEST$ error "Multiple builtin declarations have the name 'DuplicateSchema'." | ||
schema »DuplicateSchema« {} | ||
// $TEST$ error "Multiple builtin declarations have the name 'duplicatePublicSegment'." | ||
segment »duplicatePublicSegment«() {} | ||
// $TEST$ error "Multiple builtin declarations have the name 'duplicateInternalSegment'." | ||
internal segment »duplicateInternalSegment«() {} | ||
// $TEST$ no error r"Multiple builtin declarations have the name '\w*'\." | ||
private segment »duplicatePrivateSegment«() {} |
8 changes: 0 additions & 8 deletions
8
tests/resources/validation/names/duplicates/across files/safeds.sdstest
This file was deleted.
Oops, something went wrong.
27 changes: 18 additions & 9 deletions
27
tests/resources/validation/names/duplicates/across files/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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
package tests.validation.names.acrossFiles | ||
|
||
annotation DuplicateAnnotation | ||
class DuplicateClass | ||
enum DuplicateEnum | ||
fun duplicateFunction() | ||
pipeline duplicatePipeline {} | ||
schema DuplicateSchema {} | ||
segment duplicatePublicSegment() {} | ||
internal segment duplicateInternalSegment() {} | ||
private segment duplicatePrivateSegment() {} | ||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateAnnotation'." | ||
annotation »DuplicateAnnotation« | ||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateClass'." | ||
class »DuplicateClass« | ||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateEnum'." | ||
enum »DuplicateEnum« | ||
// $TEST$ error "Multiple declarations in this package have the name 'duplicateFunction'." | ||
fun »duplicateFunction«() | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
pipeline »duplicatePipeline« {} | ||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateSchema'." | ||
schema »DuplicateSchema« {} | ||
// $TEST$ error "Multiple declarations in this package have the name 'duplicatePublicSegment'." | ||
segment »duplicatePublicSegment«() {} | ||
// $TEST$ error "Multiple declarations in this package have the name 'duplicateInternalSegment'." | ||
internal segment »duplicateInternalSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
private segment »duplicatePrivateSegment«() {} |