Skip to content

Commit

Permalink
Added type to declaration = minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Mar 17, 2024
1 parent f222a29 commit 8099186
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
eclipse.preferences.version=1
encoding//src/org/rascalmpl/core/library=UTF-8
encoding//target/generated-test-resources=UTF-8
encoding//target/generated-test-sources=UTF-8
encoding/<project>=UTF-8
encoding/src=UTF-8
encoding/test=UTF-8
1 change: 0 additions & 1 deletion src/org/rascalmpl/core/library/CompileTestSources.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import IO;
import String;
import Set;
import List;
import Map;
import util::Reflective;
import lang::rascalcore::compile::Compile;
import util::FileSystem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
module lang::rascalcore::compile::Examples::Tst5


&T <: num makeSmallerThan(&T <: num n) {
&T <: num res;
if (int i := n) {
res = i;
return res;
value main(){
if (int j := 1 || int j := 2) {
return j;
}
return n;
return -1;
}


//&T avoidEmpty(list[&T] l) { return 1; }
//&T avoidEmpty(list[&T] _) { throw "this should happen"; }
//
//test bool voidReturnIsNotAllowed() {
// try {
// avoidEmpty([]);
// return false;
// } catch "this should happen":
// return true;
//}

//data Wrapper[&SAME] = something(&SAME wrapped);
//
//@synopsis{it matters for testing that '&SAME' is the same name as in the definition of Wrapper}
//&XXXSAME getIt(Wrapper[&XXXSAME] x) = x.wrapped;
//
//value main() { //test bool hygienicGenericADT() {
// // in the same context, we bind the same type parameter in
// // different ways to see if nothing is leaking.
// int i = something(1).wrapped;
// int j = getIt(something(2));
// int k = getIt(something(3));
// str x = something("x").wrapped;
// str y = getIt(something("y"));
//
// return i == 1 && j == 2 && k == 3
// && x == "x" && y == "y";
//}

//import List;
//
//value main(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ tuple[MuExp exp, list[MuExp] vars] processRegExpLiteral(e: (RegExpLiteral) `/<Re
if(size(fragment) > 0){
fragmentCode += muCon(fragment);
}
if(all(frag <- fragmentCode, muCon(_) := frag)){
if(all(MuExp frag <- fragmentCode, muCon(_) := frag)){
buildRegExp = muCon(intercalate("", [s | muCon(str s) <- fragmentCode]));
return <buildRegExp, vars>;
} else {
Expand Down

0 comments on commit 8099186

Please sign in to comment.