-
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 placeholder is alias for parameter or placeholder (#628)
Closes #564 Closes partially #543 ### Summary of Changes To provide a cleaner graphical view, this PR makes it an error if a placeholder just acts as an alias for another placeholder or a parameter. --------- Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
- Loading branch information
1 parent
18641de
commit b99ab25
Showing
6 changed files
with
140 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
52 changes: 52 additions & 0 deletions
52
tests/resources/validation/other/declarations/placeholders/alias/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,52 @@ | ||
package tests.validation.other.placeholder.alias | ||
|
||
annotation MyAnnotation | ||
|
||
class MyClass { | ||
static attr myAttribute: Int | ||
|
||
static fun myMethod() | ||
} | ||
|
||
enum MyEnum { | ||
MyEnumVariant | ||
} | ||
|
||
fun myFunction() | ||
|
||
pipeline myPipeline {} | ||
|
||
schema MySchema {} | ||
|
||
segment mySegment1() {} | ||
|
||
segment mySegment2(myParameter: Int) { | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »myPlaceholder« = 1; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »a« = MyAnnotation; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »b« = MyClass.myAttribute; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »c« = MyClass; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »d« = MyEnum; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »e« = MyEnum.MyEnumVariant; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »f« = myFunction; | ||
// $TEST$ error "Aliases are not allowed to provide a cleaner graphical view." | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »g1«, val »g2« = myParameter; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »h« = myPipeline; | ||
// $TEST$ error "Aliases are not allowed to provide a cleaner graphical view." | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »i1«, val »i2« = myPlaceholder; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »j« = MySchema; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »k« = mySegment1; | ||
// $TEST$ no error "Aliases are not allowed to provide a cleaner graphical view." | ||
val »l« = unresolved; | ||
} |