-
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: unique names withing declarations (#575)
Closes partially #543 ### Summary of Changes Ensure that names are unique within declarations. I'll port the checks for uniqueness on the file level in a future PR. --------- Co-authored-by: megalinter-bot <[email protected]>
1 parent
4ba7873
commit 47ce782
Showing
19 changed files
with
670 additions
and
54 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,6 @@ | ||
import { SdsImport } from '../generated/ast.js'; | ||
|
||
export const isWildcardImport = function (node: SdsImport): boolean { | ||
const importedNamespace = node.importedNamespace ?? ''; | ||
return importedNamespace.endsWith('*'); | ||
}; |
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,96 @@ | ||
import { | ||
isSdsAssignment, | ||
isSdsBlockLambdaResult, | ||
isSdsDeclaration, | ||
isSdsPlaceholder, | ||
SdsAnnotatedObject, | ||
SdsAnnotationCall, | ||
SdsAssignee, | ||
SdsAssignment, | ||
SdsBlock, | ||
SdsBlockLambda, | ||
SdsBlockLambdaResult, | ||
SdsClass, | ||
SdsClassMember, | ||
SdsEnum, | ||
SdsEnumVariant, | ||
SdsLiteral, | ||
SdsLiteralType, | ||
SdsParameter, | ||
SdsParameterList, | ||
SdsPlaceholder, | ||
SdsResult, | ||
SdsResultList, | ||
SdsStatement, | ||
SdsTypeArgument, | ||
SdsTypeArgumentList, | ||
SdsTypeParameter, | ||
SdsTypeParameterList, | ||
} from '../generated/ast.js'; | ||
import { stream } from 'langium'; | ||
|
||
export const annotationCallsOrEmpty = function (node: SdsAnnotatedObject | undefined): SdsAnnotationCall[] { | ||
if (!node) { | ||
/* c8 ignore next 2 */ | ||
return []; | ||
} | ||
|
||
if (isSdsDeclaration(node)) { | ||
return node?.annotationCallList?.annotationCalls ?? node?.annotationCalls ?? []; | ||
} else { | ||
/* c8 ignore next 2 */ | ||
return node?.annotationCalls ?? []; | ||
} | ||
}; | ||
|
||
export const assigneesOrEmpty = function (node: SdsAssignment | undefined): SdsAssignee[] { | ||
return node?.assigneeList?.assignees ?? []; | ||
}; | ||
|
||
export const blockLambdaResultsOrEmpty = function (node: SdsBlockLambda | undefined): SdsBlockLambdaResult[] { | ||
return stream(statementsOrEmpty(node?.body)) | ||
.filter(isSdsAssignment) | ||
.flatMap(assigneesOrEmpty) | ||
.filter(isSdsBlockLambdaResult) | ||
.toArray(); | ||
}; | ||
|
||
export const literalsOrEmpty = function (node: SdsLiteralType | undefined): SdsLiteral[] { | ||
return node?.literalList?.literals ?? []; | ||
}; | ||
|
||
export const classMembersOrEmpty = function (node: SdsClass | undefined): SdsClassMember[] { | ||
return node?.body?.members ?? []; | ||
}; | ||
|
||
export const parametersOrEmpty = function (node: SdsParameterList | undefined): SdsParameter[] { | ||
return node?.parameters ?? []; | ||
}; | ||
|
||
export const placeholdersOrEmpty = function (node: SdsBlock | undefined): SdsPlaceholder[] { | ||
return stream(statementsOrEmpty(node)) | ||
.filter(isSdsAssignment) | ||
.flatMap(assigneesOrEmpty) | ||
.filter(isSdsPlaceholder) | ||
.toArray(); | ||
}; | ||
|
||
export const resultsOrEmpty = function (node: SdsResultList | undefined): SdsResult[] { | ||
return node?.results ?? []; | ||
}; | ||
|
||
export const statementsOrEmpty = function (node: SdsBlock | undefined): SdsStatement[] { | ||
return node?.statements ?? []; | ||
}; | ||
|
||
export const typeArgumentsOrEmpty = function (node: SdsTypeArgumentList | undefined): SdsTypeArgument[] { | ||
return node?.typeArguments ?? []; | ||
}; | ||
|
||
export const typeParametersOrEmpty = function (node: SdsTypeParameterList | undefined): SdsTypeParameter[] { | ||
return node?.typeParameters ?? []; | ||
}; | ||
|
||
export const variantsOrEmpty = function (node: SdsEnum | undefined): SdsEnumVariant[] { | ||
return node?.body?.variants ?? []; | ||
}; |
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 was deleted.
Oops, something went wrong.
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
10 changes: 10 additions & 0 deletions
10
tests/resources/validation/names/duplicates/in annotation/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,10 @@ | ||
package tests.validation.names.duplicates.inAnnotation | ||
|
||
annotation A( | ||
// $TEST$ no error r"A parameter with name '\w*' exists already\." | ||
»duplicateParameter«: Int, | ||
// $TEST$ error "A parameter with name 'duplicateParameter' exists already." | ||
»duplicateParameter«: Int, | ||
// $TEST$ no error r"A parameter with name '\w*' exists already\." | ||
»uniqueParameter«: Int | ||
) |
52 changes: 52 additions & 0 deletions
52
tests/resources/validation/names/duplicates/in block lambda/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.names.duplicates.inBlockLambda | ||
|
||
pipeline p { | ||
( | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»duplicateParameter«, | ||
// $TEST$ error "A parameter or placeholder with name 'duplicateParameter' exists already." | ||
»duplicateParameter«, | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»uniqueParameter«, | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»parameterAndPlaceholder«, | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»parameterAndResult« | ||
) { | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ error "A parameter or placeholder with name 'duplicatePlaceholder' exists already." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »uniquePlaceholder« = 1; | ||
// $TEST$ error "A parameter or placeholder with name 'parameterAndPlaceholder' exists already." | ||
val »parameterAndPlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »placeholderAndResult« = 1; | ||
|
||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
yield »duplicateResult« = 0; | ||
// $TEST$ error "A result with name 'duplicateResult' exists already." | ||
yield »duplicateResult« = 0; | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
yield »uniqueResult« = 0; | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
yield »parameterAndResult« = 0; | ||
//$TEST$ no error r"A result with name '\w*' exists already\." | ||
yield »placeholderAndResult« = 0; | ||
//$TEST$ no error r"A result with name '\w*' exists already\." | ||
yield »resultAndPlaceholder« = 0; | ||
|
||
// $TEST$ no error "A parameter or placeholder with name '\w*' exists already\." | ||
val »resultAndPlaceholder« = 1; | ||
|
||
() { | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »parameterAndPlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »placeholderAndResult« = 1; | ||
}; | ||
}; | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/resources/validation/names/duplicates/in callable type/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.validation.names.duplicates.inCallableType | ||
|
||
segment s( | ||
f: ( | ||
// $TEST$ no error r"A parameter with name '\w*' exists already\." | ||
»duplicateParameter«: Int, | ||
// $TEST$ error "A parameter with name 'duplicateParameter' exists already." | ||
»duplicateParameter«: Int, | ||
// $TEST$ no error r"A parameter with name '\w*' exists already\." | ||
»uniqueParameter«: Int, | ||
// $TEST$ no error r"A parameter with name '\w*' exists already\." | ||
»parameterAndResult«: Int | ||
) -> ( | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»duplicateResult«: Int, | ||
// $TEST$ error "A result with name 'duplicateResult' exists already." | ||
»duplicateResult«: Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»uniqueResult«: Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»parameterAndResult«: Int | ||
) | ||
) {} |
126 changes: 126 additions & 0 deletions
126
tests/resources/validation/names/duplicates/in class/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,126 @@ | ||
package tests.validation.names.duplicates.inClass | ||
|
||
class MyClass1< | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»DuplicateTypeParameter«, | ||
// $TEST$ error "A type parameter or parameter with name 'DuplicateTypeParameter' exists already." | ||
»DuplicateTypeParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»UniqueTypeParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndMember«, | ||
>( | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»duplicateParameter«: Int, | ||
// $TEST$ error "A type parameter or parameter with name 'duplicateParameter' exists already." | ||
»duplicateParameter«: Int, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»uniqueParameter«: Int, | ||
// $TEST$ error "A type parameter or parameter with name 'TypeParameterAndParameter' exists already." | ||
»TypeParameterAndParameter«: Int, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»parameterAndMember«: Int, | ||
) { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
attr »duplicateAttribute«: Int | ||
// $TEST$ error "A member with name 'duplicateAttribute' exists already." | ||
attr »duplicateAttribute«: Int | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
attr »uniqueAttribute«: Int | ||
|
||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
class »DuplicateClass« | ||
// $TEST$ error "A member with name 'DuplicateClass' exists already." | ||
class »DuplicateClass« | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
class »UniqueClass« | ||
|
||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
enum »DuplicateEnum« | ||
// $TEST$ error "A member with name 'DuplicateEnum' exists already." | ||
enum »DuplicateEnum« | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
enum »UniqueEnum« | ||
|
||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
fun »duplicateFun«() | ||
// $TEST$ error "A member with name 'duplicateFun' exists already." | ||
fun »duplicateFun«() | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
fun »uniqueFun«() | ||
|
||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
attr »duplicateMember«: Int | ||
// $TEST$ error "A member with name 'duplicateMember' exists already." | ||
class »duplicateMember« | ||
// $TEST$ error "A member with name 'duplicateMember' exists already." | ||
enum »duplicateMember« | ||
// $TEST$ error "A member with name 'duplicateMember' exists already." | ||
fun »duplicateMember«() | ||
} | ||
|
||
class MyClass2< | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndMember«, | ||
> { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
attr »TypeParameterAndMember«: Int | ||
} | ||
|
||
class MyClass3< | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndMember«, | ||
> { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
class »TypeParameterAndMember« | ||
} | ||
|
||
class MyClass4< | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndMember«, | ||
> { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
enum »TypeParameterAndMember« | ||
} | ||
|
||
class MyClass5< | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndMember«, | ||
> { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
fun »TypeParameterAndMember«() | ||
} | ||
|
||
class MyClass6( | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»parameterAndMember«: Int, | ||
) { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
attr »parameterAndMember«: Int | ||
} | ||
|
||
class MyClass7( | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»parameterAndMember«: Int, | ||
) { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
class »parameterAndMember« | ||
} | ||
|
||
class MyClass8( | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»parameterAndMember«: Int, | ||
) { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
enum »parameterAndMember« | ||
} | ||
|
||
class MyClass9( | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»parameterAndMember«: Int, | ||
) { | ||
// $TEST$ no error r"A member with name '\w*' exists already\." | ||
fun »parameterAndMember«() | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/resources/validation/names/duplicates/in enum variant/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.validation.names.duplicates.inEnumVariant | ||
|
||
enum MyEnum { | ||
MyEnumVariant< | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»DuplicateTypeParameter«, | ||
// $TEST$ error "A type parameter or parameter with name 'DuplicateTypeParameter' exists already." | ||
»DuplicateTypeParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»UniqueTypeParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndParameter«, | ||
>( | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»duplicateParameter«: Int, | ||
// $TEST$ error "A type parameter or parameter with name 'duplicateParameter' exists already." | ||
»duplicateParameter«: Int, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»uniqueParameter«: Int, | ||
// $TEST$ error "A type parameter or parameter with name 'TypeParameterAndParameter' exists already." | ||
»TypeParameterAndParameter«: Int, | ||
) | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/resources/validation/names/duplicates/in enum/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,10 @@ | ||
package tests.validation.names.duplicates.inEnum | ||
|
||
enum MyEnum { | ||
// $TEST$ no error r"A variant with name '\w*' exists already\." | ||
»MyVariant1« | ||
// $TEST$ error "A variant with name 'MyVariant1' exists already." | ||
»MyVariant1« | ||
// $TEST$ no error r"A variant with name '\w*' exists already\." | ||
»MyVariant2« | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/resources/validation/names/duplicates/in expression lambda/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,12 @@ | ||
package tests.validation.names.duplicates.inExpressionLambda | ||
|
||
pipeline p { | ||
( | ||
// $TEST$ no error r"A parameter with name '\w*' exists already\." | ||
»duplicateParameter«, | ||
// $TEST$ error "A parameter with name 'duplicateParameter' exists already." | ||
»duplicateParameter«, | ||
// $TEST$ no error r"A parameter with name '\w*' exists already\." | ||
»uniqueParameter«, | ||
) -> 1; | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/resources/validation/names/duplicates/in function/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,36 @@ | ||
package tests.validation.names.duplicates.inFunction | ||
|
||
fun myFunction< | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»DuplicateTypeParameter«, | ||
// $TEST$ error "A type parameter or parameter with name 'DuplicateTypeParameter' exists already." | ||
»DuplicateTypeParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»UniqueTypeParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndParameter«, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»TypeParameterAndResult«, | ||
>( | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»duplicateParameter«: Int, | ||
// $TEST$ error "A type parameter or parameter with name 'duplicateParameter' exists already." | ||
»duplicateParameter«: Int, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»uniqueParameter«: Int, | ||
// $TEST$ error "A type parameter or parameter with name 'TypeParameterAndParameter' exists already." | ||
»TypeParameterAndParameter«: Int, | ||
// $TEST$ no error r"A type parameter or parameter with name '\w*' exists already\." | ||
»parameterAndResult«: Int, | ||
) -> ( | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»duplicateResult« : Int, | ||
// $TEST$ error "A result with name 'duplicateResult' exists already." | ||
»duplicateResult« : Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»uniqueResult« : Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»parameterAndResult« : Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»TypeParameterAndResult« : Int, | ||
) |
10 changes: 10 additions & 0 deletions
10
tests/resources/validation/names/duplicates/in pipeline/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,10 @@ | ||
package tests.validation.names.duplicates.inPipeline | ||
|
||
pipeline p { | ||
// $TEST$ no error r"A placeholder with name '\w*' exists already\." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ error "A placeholder with name 'duplicatePlaceholder' exists already." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ no error r"A placeholder with name '\w*' exists already\." | ||
val »uniquePlaceholder« = 1; | ||
} |
45 changes: 45 additions & 0 deletions
45
tests/resources/validation/names/duplicates/in segment/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.validation.names.duplicates.inSegment | ||
|
||
segment mySegment( | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»duplicateParameter«: Int, | ||
// $TEST$ error "A parameter or placeholder with name 'duplicateParameter' exists already." | ||
»duplicateParameter«: Int, | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»uniqueParameter«: Int, | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»parameterAndPlaceholder«: Int, | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
»parameterAndResult«: Int, | ||
) -> ( | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»duplicateResult« : Int, | ||
// $TEST$ error "A result with name 'duplicateResult' exists already." | ||
»duplicateResult« : Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»uniqueResult« : Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»parameterAndResult« : Int, | ||
// $TEST$ no error r"A result with name '\w*' exists already\." | ||
»placeholderAndResult« : Int, | ||
) { | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ error "A parameter or placeholder with name 'duplicatePlaceholder' exists already." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »uniquePlaceholder« = 1; | ||
// $TEST$ error "A parameter or placeholder with name 'parameterAndPlaceholder' exists already." | ||
val »parameterAndPlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »placeholderAndResult« = 1; | ||
|
||
() { | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »duplicatePlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »parameterAndPlaceholder« = 1; | ||
// $TEST$ no error r"A parameter or placeholder with name '\w*' exists already\." | ||
val »placeholderAndResult« = 1; | ||
}; | ||
} |