-
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.
fix: prevent references to following parameters from default values (#…
…707) Closes partially #540 ### Summary of Changes References to parameters that are defined later in the parameter list are no longer resolved from default values. Example: ```txt fun f(p: Int = q, q: Int = p) ``` The reference to `q` does not get resolved anymore. The reference to `p` is still possible.
- Loading branch information
1 parent
4518aee
commit 182d64b
Showing
2 changed files
with
110 additions
and
2 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
84 changes: 84 additions & 0 deletions
84
...coping/references/in same file/to parameters/from default value of parameter/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,84 @@ | ||
package tests.scoping.references.inSameFile.toParameters.fromDefaultValueOfParameter | ||
|
||
annotation MyAnnotation( | ||
// $TEST$ target annotation_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references annotation_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) | ||
|
||
class MyClass( | ||
// $TEST$ target class_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references class_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) | ||
|
||
enum MyEnum { | ||
MyEnumVariant( | ||
// $TEST$ target enum_variant_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references enum_variant_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) | ||
} | ||
|
||
fun myFunction( | ||
// $TEST$ target function_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references function_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) | ||
|
||
segment mySegment1( | ||
// $TEST$ target segment_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references segment_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) {} | ||
|
||
segment mySegment2( | ||
p: ( | ||
// $TEST$ target callable_type_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references callable_type_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) -> () | ||
) { | ||
( | ||
// $TEST$ target block_lambda_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references block_lambda_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) {}; | ||
( | ||
// $TEST$ target block_function_param | ||
// $TEST$ unresolved | ||
»p«: String = »q«, | ||
// $TEST$ references block_function_param | ||
q: String = »p«, | ||
// $TEST$ unresolved | ||
r: String = »r«, | ||
) -> 1; | ||
} |