-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new compiler issue as ignored test
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...rary/lang/rascal/tests/basic/CompilerIssues/VariableBoundInConditionalInComprehension.rsc
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 @@ | ||
module lang::rascal::tests::basic::CompilerIssues::VariableBoundInConditionalInComprehension | ||
|
||
data AType = avalue() | aparameter(str pname, AType bound); | ||
|
||
// The original code from CollectDeclaration: | ||
// The issue is that "typeVarBounds[tvname2]" is moved before the comprehension (because the variable "tvname2" has to be declared) | ||
// and then gives IndexOutOfBounds error | ||
|
||
map[str, AType] propagateParams(map[str,AType] typeVarBounds){ | ||
return (tvname : (aparameter(tvname2, _) := typeVarBounds[tvname]) ? typeVarBounds[tvname2] : typeVarBounds[tvname] | tvname <- typeVarBounds);} | ||
|
||
// The following equivalent code is compiled correcly: | ||
//map[str, AType] propagateParams(map[str,AType] typeVarBounds){ | ||
// AType find(str tvname) = (aparameter(tvname2, _) := typeVarBounds[tvname]) ? typeVarBounds[tvname2] : typeVarBounds[tvname] ; | ||
// return (tvname : find(tvname) | tvname <- typeVarBounds); | ||
//} | ||
|
||
@ignoreCompiler{Compiled code crahes with IndexOutOfBounds} | ||
test bool variableBoundInConditionalInComprehension() = propagateParams(("T":avalue())) == ("T" : avalue()); |