diff --git a/pom.xml b/pom.xml
index c2a18d2d80e..67b3b9e89ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -458,7 +458,7 @@
org.rascalmpl
typepal
- 0.17.0-BOOT2
+ 0.17.0-RC3
compile
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Symbols.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Symbols.rsc
index a07a75ae2e3..ebd0d32a38c 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Symbols.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Symbols.rsc
@@ -133,6 +133,16 @@ public AType defsym2AType(Sym sym, SyntaxRole sr) {
}
}
+public Tree defsym2IdTree(Sym sym) = top-down-break visit (sym) {
+ case lang::rascal::\syntax::Rascal::nonterminal(Nonterminal n): return n;
+ case \parametrized(Nonterminal n, _): return n;
+ case \start(Nonterminal n): return n;
+ default: {
+ iprintln(sym);
+ throw "defsym2IdTree, missed a case ";
+ }
+};
+
public list[AType] args2ATypes(Sym* args) {
return [sym2AType(s) | Sym s <- args];
}
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDataDeclaration.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDataDeclaration.rsc
index b33a79cd91c..2f0dcd52f02 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDataDeclaration.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDataDeclaration.rsc
@@ -72,7 +72,7 @@ void dataDeclaration(Tags tags, Declaration current, list[Variant] variants, Col
dt.md5 = normalizedMD5Hash(adtName, dataCounter);
dataCounter += 1;
if(!isEmpty(commonKeywordParameterList)) dt.commonKeywordFields = commonKeywordParameterList;
- c.define("", dataId(), current, dt);
+ c.define(userType.name, dataId(), current, dt);
adtParentScope = c.getScope();
c.enterScope(current);
@@ -142,7 +142,7 @@ void collect(current:(Variant) ` ( <{TypeArg ","}* arguments> ", fieldId(), ta.name, dt);
+ c.define(ta.name, fieldId(), ta.name, dt);
}
}
@@ -153,13 +153,13 @@ void collect(current:(Variant) ` ( <{TypeArg ","}* arguments> ", keywordFieldId(), kwf.name, dt);
+ c.define(kwf.name, keywordFieldId(), kwf.name, dt);
}
scope = c.getScope();
c.enterScope(current);
args = " " : ""> <}>";
- c.defineInScope(adtParentScope, "", constructorId(), name, defType(adt + formals + kwFormals + commonKwFormals,
+ c.defineInScope(adtParentScope, name, constructorId(), name, defType(adt + formals + kwFormals + commonKwFormals,
AType(Solver s){
adtType = s.getType(adt);
kwFormalTypes = [kwField(s.getType(kwf.\type)[alabel=prettyPrintName(kwf.name)], prettyPrintName(kwf.name), currentModuleName, kwf.expression) | kwf <- kwFormals /*+ commonKwFormals*/];
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc
index 9b13ab37dd2..1d689c4441c 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc
@@ -92,7 +92,7 @@ void collect(Module current, Collector c){
if(deprecated){
c.report(warning(header.name, "Deprecated module %v%v", mname, isEmpty(deprecationMessage) ? "" : ": "));
}
- c.define("", moduleId(), current, defType(tmod));
+ c.define(header.name, moduleId(), current, defType(tmod));
c.push(key_current_module, mname);
c.enterScope(current);
@@ -192,7 +192,7 @@ void collect(current: (Declaration) ` ", moduleVariableId(), var.name, dt);
+ c.defineInScope(scope, var.name, moduleVariableId(), var.name, dt);
if(var is initialized){
initial = var.initial;
@@ -238,7 +238,7 @@ void collect(current: (Declaration) ` anno ", annoId(), current, dt);
+ c.define(name, annoId(), current, dt);
collect(tags, annoType, onType, c);
}
@@ -253,7 +253,7 @@ void collect(current: (KeywordFormal) ` = ", keywordFormalId(), current, dt);
+ c.define(name, keywordFormalId(), current, dt);
c.calculate("keyword formal", current, [kwType, expression],
AType(Solver s){
expType = s.getType(expression);
@@ -432,7 +432,7 @@ void collect(current: (FunctionDeclaration) ``, Collec
endUseBoundedTypeParameters(c);
dt.md5 = normalizedMD5Hash(md5Contrib);
- c.defineInScope(parentScope, "", functionId(), current, dt);
+ c.defineInScope(parentScope, fname, functionId(), current, dt);
c.leaveScope(decl);
c.pop(currentFunction);
if(isEmpty(fstk)){
@@ -617,7 +617,7 @@ private tuple[set[str], rel[str,Type]] computeBoundsAndDefineTypeParams(Signatur
c.fact(tp, tp.name);
} else {
seenInParams += tpname;
- c.define("", typeVarId(), tp.name,
+ c.define(tp.name, typeVarId(), tp.name,
defType(toList(typeParamBounds[tpname]), makeBoundDef(tp, typeParamBounds, closed=false)));
c.fact(tp, tp.name);
}
@@ -761,7 +761,7 @@ void collect (current: (Declaration) ` alias
// c.report(warning(name, "Alias names starting with `_` are deprecated; only allowed to suppress warning on unused variables"));
// }
- c.define("", aliasId(), current, defType([base], AType(Solver s) { return s.getType(base); })[md5 = normalizedMD5Hash(md5Contrib4Tags(tags), visibility, name, base)]);
+ c.define(name, aliasId(), current, defType([base], AType(Solver s) { return s.getType(base); })[md5 = normalizedMD5Hash(md5Contrib4Tags(tags), visibility, name, base)]);
c.enterScope(current);
collect(tags, base, c);
c.leaveScope(current);
@@ -785,7 +785,7 @@ void collect (current: (Declaration) ` alias
append tp.typeVar;
}
- c.define("", aliasId(), name, defType(typeParams + base, AType(Solver s){
+ c.define(name, aliasId(), name, defType(typeParams + base, AType(Solver s){
bindings = ();
params = for(int i <- index(typeParams)){
ptype = s.getType(typeParams[i]);
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectLiteral.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectLiteral.rsc
index 04f608d10e8..b42c81d1d7e 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectLiteral.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectLiteral.rsc
@@ -98,7 +98,7 @@ void collect(current: (ConcreteHole) `\< \>`, Collector
c.useLub(name, {formalOrPatternFormal(c)});
} else {
c.push(patternNames, uname);
- c.define("", formalOrPatternFormal(c), name, defLub([symbol], AType(Solver s) { return s.getType(symbol); }));
+ c.define(name, formalOrPatternFormal(c), name, defLub([symbol], AType(Solver s) { return s.getType(symbol); }));
}
}
}
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectOperators.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectOperators.rsc
index 7c00a508086..6501a9ef264 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectOperators.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectOperators.rsc
@@ -620,7 +620,7 @@ void collect(current: (Expression) ` \<- `,
} else
throw TypeUnavailable();
- c.define("", formalOrPatternFormal(c), name, defType(patType));
+ c.define(name, formalOrPatternFormal(c), name, defType(patType));
c.fact(pat, patType);
c.fact(current, abool());
return;
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectPattern.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectPattern.rsc
index c1073361e74..bdec5b2125c 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectPattern.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectPattern.rsc
@@ -50,7 +50,7 @@ void collect(RegExp regExp, Collector c){
if( (RegExp)`\<\>` := regExp){
c.use(name, variableRoles);
} else if ((RegExp)`\<:\>` := regExp){
- c.define("", formalOrPatternFormal(c), name, defType(astr()));
+ c.define(name, formalOrPatternFormal(c), name, defType(astr()));
collect(name, regexps, c);
}
c.fact(regExp, astr());
@@ -109,7 +109,7 @@ void collect(current: (Pattern) ` `, Collector c){
}
}
}
- c.define("", formalOrPatternFormal(c), name, defType(tp));
+ c.define(name, formalOrPatternFormal(c), name, defType(tp));
} else {
c.fact(name, tp);
//c.calculate("variable ", name, [tp], AType(Solver s) { return s.getType(tp); });
@@ -129,7 +129,7 @@ void collectAsVarArg(current: (Pattern) ` `, Collector c){
});
} else {
c.push(patternNames, );
- c.define("", formalOrPatternFormal(c), name, defType([tp], AType(Solver s){
+ c.define(name, formalOrPatternFormal(c), name, defType([tp], AType(Solver s){
res = alist(s.getType(tp))[alabel=uname];
return res;
}));
@@ -158,7 +158,7 @@ void collect(current: (Pattern) ``, Collector c){
if(!isEmpty(qualifier)) c.report(error(name, "Qualifier not allowed"));
if(isTopLevelParameter(c)){
c.fact(current, avalue(alabel=unescape(prettyPrintBaseName(name))));
- c.define("", formalId(), name, defLub([], AType(Solver _) { return avalue(alabel=unescape(prettyPrintBaseName(name))); }));
+ c.define(name.names[-1], formalId(), name, defLub([], AType(Solver _) { return avalue(alabel=unescape(prettyPrintBaseName(name))); }));
} else {
if(c.isAlreadyDefined(base, name)){
c.use(name, {variableId(), moduleVariableId(), formalId(), nestedFormalId(), patternVariableId(), constructorId()});
@@ -166,7 +166,7 @@ void collect(current: (Pattern) ``, Collector c){
} else {
tau = c.newTypeVar(name);
c.fact(name, tau); //<====
- c.define("", formalOrPatternFormal(c), name, defLub([], AType(Solver s) {
+ c.define(name.names[-1], formalOrPatternFormal(c), name, defLub([], AType(Solver s) {
return s.getType(tau)[alabel=unescape(prettyPrintBaseName(name))];
}));
}
@@ -223,7 +223,7 @@ void collectSplicePattern(Pattern current, Pattern argument, Collector c){
}
}
- c.define("", formalOrPatternFormal(c), argName, defType([tp],
+ c.define(argName, formalOrPatternFormal(c), argName, defType([tp],
AType(Solver s){ return inSet ? aset(s.getType(tp)) : alist(s.getType(tp)); }));
} else {
c.calculate("typed anonymous variable in splice pattern", argName, [tp],
@@ -246,7 +246,7 @@ void collectSplicePattern(Pattern current, Pattern argument, Collector c){
if(isTopLevelParameter(c)){
c.fact(current, avalue());
if(!isEmpty(qualifier)) c.report(error(argName, "Qualifier not allowed"));
- c.define("", formalId(), argName, defLub([], AType(Solver _) { return avalue(); }));
+ c.define(argName.names[-1], formalId(), argName, defLub([], AType(Solver _) { return avalue(); }));
} else {
if(c.isAlreadyDefined("", argName)) {
c.use(argName, {variableId(), moduleVariableId(), formalId(), nestedFormalId(), patternVariableId()});
@@ -255,7 +255,7 @@ void collectSplicePattern(Pattern current, Pattern argument, Collector c){
tau = c.newTypeVar(current); // <== argName;
c.fact(current, tau); // <===
if(!isEmpty(qualifier)) c.report(error(argName, "Qualifier not allowed"));
- c.define("", formalOrPatternFormal(c), argName,
+ c.define(argName.names[-1], formalOrPatternFormal(c), argName,
defLub([], AType(Solver s) {
return inSet ? makeSetType(s.getType(tau)) : makeListType(s.getType(tau));}));
}
@@ -320,7 +320,7 @@ void collect(current: (Pattern) ` : `, Collector c){
} else {
c.push(patternNames, );
scope = c.getScope();
- c.define("", formalOrPatternFormal(c), name,
+ c.define(name, formalOrPatternFormal(c), name,
defLub([pattern], AType(Solver s) {
try{
return s.getType(pattern);
@@ -349,7 +349,7 @@ void collect(current: (Pattern) ` : `, Col
}
}
}
- c.define("", formalOrPatternFormal(c), name, defType([tp], AType(Solver s){ return s.getType(tp); }));
+ c.define(name, formalOrPatternFormal(c), name, defType([tp], AType(Solver s){ return s.getType(tp); }));
}
}
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectStatement.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectStatement.rsc
index 400912276ac..94daa312cbb 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectStatement.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectStatement.rsc
@@ -87,7 +87,7 @@ void collect(current: (Statement) `