Skip to content

Commit

Permalink
Tests for outer and inner function that use the same parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Aug 5, 2024
1 parent f5b3c60 commit cd3b1f3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/org/rascalmpl/library/lang/rascal/tests/basic/Functions.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,43 @@ test bool useExtraFormalInListPattern1() = useExtraFormalInListPattern(f([42]))
int _f(int n) = n;
test bool functionNameStartsWithUnderscore() = _f(13) == 13;
test bool innerAndOuterFunctionUseSameParameterName1(){
int outer(int t) {
int inner(t:3) = t;
default int inner(int t) = 10*t;
return inner(t);
}
return outer(3) == 3 && outer(5) == 50;
}
test bool innerAndOuterFunctionUseSameParameterName2(){
int outer(int t) {
int inner(int t:3) = t;
default int inner(int t) = 10*t;
return inner(t);
}
return outer(3) == 3 && outer(5) == 50;
}
test bool innerAndOuterFunctionUseSameParameterName3(){
int outer(str t) {
int inner(t:3) = t;
default int inner(int t) = 10*t;
return inner(3);
}
return outer("a") == 30;
}
test bool innerAndOuterFunctionUseSameParameterName4(){
int outer(str t) {
int inner(int t:3) = t;
default int inner(int t) = 10*t;
return inner(3);
}
return outer("a") == 3;
}

0 comments on commit cd3b1f3

Please sign in to comment.