diff --git a/pom.xml b/pom.xml index 25c90250385..b35fd4bcb96 100644 --- a/pom.xml +++ b/pom.xml @@ -457,7 +457,7 @@ org.rascalmpl typepal - 0.15.2-RC16 + 0.15.2-RC19 compile diff --git a/src/org/rascalmpl/compiler/BreakingChanges.rsc b/src/org/rascalmpl/compiler/BreakingChanges.rsc index a682eb1c119..d1051e7f3d2 100644 --- a/src/org/rascalmpl/compiler/BreakingChanges.rsc +++ b/src/org/rascalmpl/compiler/BreakingChanges.rsc @@ -10,7 +10,7 @@ import util::FileSystem; import lang::rascalcore::check::RascalConfig; import analysis::typepal::TModel; -map[loc,loc] breaking(TModel old, TModel new){ +map[loc,loc] breakingTModel(TModel old, TModel new){ missing = domain(old.logical2physical) - domain(new.logical2physical); return domainR(old.logical2physical, missing); } @@ -53,7 +53,7 @@ void breaking(loc old, loc new, set[str] details = {}){ tmOld = readBinaryValueFile(#TModel, old + oldPath); if(exists(new + oldPath)){ tmNew = readBinaryValueFile(#TModel, new + oldPath); - b = breaking(tmOld, tmNew); + b = breakingTModel(tmOld, tmNew); if(!isEmpty(b)){ nchanges += size(b); println("- changes"); diff --git a/src/org/rascalmpl/compiler/CheckTestSources.rsc b/src/org/rascalmpl/compiler/CheckTestSources.rsc index ce4519d8cb4..611482ce0b6 100644 --- a/src/org/rascalmpl/compiler/CheckTestSources.rsc +++ b/src/org/rascalmpl/compiler/CheckTestSources.rsc @@ -44,7 +44,7 @@ void main() = checkTestSources([]); // otherwise only standard library and test files (~200 files) void main(list[str] cmdLineArgs) = checkTestSources(cmdLineArgs); -loc REPO = |file:///Users/paulklint/git/|; +loc GIT_REPO = |file:///Users/paulklint/git/|; list[str] getRascalModules(loc rootFolder, PathConfig pcfg) = [ getModuleName(file, pcfg) @@ -63,20 +63,20 @@ void checkTestSources(list[str] cmdLineArgs) { list[str] modulesToCheck = []; pcfg = getAllSrcREPOPathConfig(keep=true); if("all" in cmdLineArgs){ - modulesToCheck = getRascalModules(REPO + "rascal/src/org/rascalmpl/library", pcfg); + modulesToCheck = getRascalModules(GIT_REPO + "rascal/src/org/rascalmpl/library", pcfg); } else { testFolders = [ //|std:///lang/rascal/tests|, - //REPO + "/rascal-core/lang/rascalcore/check::tests", - REPO + "/typepal/src/" + //GIT_REPO + "/rascal-core/lang/rascalcore/check::tests", + GIT_REPO + "/typepal/src/" ]; modulesToCheck = [ *getRascalModules(testFolder, pcfg) | testFolder <- testFolders ]; } - ignored = ["lang::rascal::tests::concrete::Patterns3" // takes too long + ignoredFiles = ["lang::rascal::tests::concrete::Patterns3" // takes too long ]; - modulesToCheck -= ignored; + modulesToCheck -= ignoredFiles; list[str] exceptions = []; int n = size(modulesToCheck); @@ -91,7 +91,7 @@ void checkTestSources(list[str] cmdLineArgs) { } println("Checked test modules"); println(" failed to check: "); - if(!isEmpty(ignored)) { println("Ignored: "); } + if(!isEmpty(ignoredFiles)) { println("Ignored: "); } secs = total/1000000000; println("Time: seconds"); } diff --git a/src/org/rascalmpl/compiler/CompileTestSources.rsc b/src/org/rascalmpl/compiler/CompileTestSources.rsc index 7d4e6250325..446f0812fe5 100644 --- a/src/org/rascalmpl/compiler/CompileTestSources.rsc +++ b/src/org/rascalmpl/compiler/CompileTestSources.rsc @@ -41,11 +41,11 @@ import util::FileSystem; import util::Benchmark; import lang::rascalcore::compile::util::Names; -loc REPO = |file:///Users/paulklint/git/|; +loc GIT_REPO = |file:///Users/paulklint/git/|; -PathConfig manualTestConfig= pathConfig(bin= REPO + "generated-sources/target/classes", - generatedSources = REPO + "generated-sources/target/generated-sources", - generatedResources = REPO + "generated-sources/target/classes" //|project://rascal-core/target/generated-test-resources| +PathConfig manualTestConfig= pathConfig(bin= GIT_REPO + "generated-sources/target/classes", + generatedSources = GIT_REPO + "generated-sources/target/generated-sources", + generatedResources = GIT_REPO + "generated-sources/target/classes" //|project://rascal-core/target/generated-test-resources| ); void main() = compileTestSources(manualTestConfig); @@ -150,9 +150,9 @@ void compileTestSources(PathConfig pcfg) { | loc file <- find(testFolder, "rsc") // all Rascal source files ]; - ignored = ["lang::rascal::tests::concrete::Patterns3" // takes too long + ignoredFiles = ["lang::rascal::tests::concrete::Patterns3" // takes too long ]; - testModules -= ignored; + testModules -= ignoredFiles; println("Compiling test modules:"); println(testModules); @@ -169,7 +169,7 @@ void compileTestSources(PathConfig pcfg) { } println("Compiled test modules"); println(" failed to compile: "); - if(!isEmpty(ignored)) { println("Ignored: "); } + if(!isEmpty(ignoredFiles)) { println("Ignored: "); } secs = total/1000000000; println("Time: seconds"); } diff --git a/src/org/rascalmpl/compiler/GenerateTestSources.rsc b/src/org/rascalmpl/compiler/GenerateTestSources.rsc index 7a3ad80f054..6faed1c2ec7 100644 --- a/src/org/rascalmpl/compiler/GenerateTestSources.rsc +++ b/src/org/rascalmpl/compiler/GenerateTestSources.rsc @@ -45,7 +45,7 @@ void main(list[str] cmdLineArgs) = generateTestSources(cmdLineArgs); void main() = main([]); -loc REPO = |file:///Users/paulklint/git/|; +loc GIT_REPO = |file:///Users/paulklint/git/|; list[str] getRascalModules(loc rootFolder, PathConfig pcfg) = [ getModuleName(file, pcfg) //replaceAll(file[extension=""].path[1..], "/", "::") @@ -66,12 +66,12 @@ void generateTestSources(list[str] cmdLineArgs) { list[str] modulesToCompile = []; if("all" in cmdLineArgs){ - modulesToCompile = getRascalModules(REPO + "rascal/src/org/rascalmpl/library", pcfg); + modulesToCompile = getRascalModules(GIT_REPO + "rascal/src/org/rascalmpl/library", pcfg); } else { - testFolders = [ REPO + "rascal/src/org/rascalmpl/library/lang/rascal/tests" - , REPO + "rascal/src/org/rascalmpl/library/lang/rascal/grammar/tests" - , REPO + "rascal/src/org/rascalmpl/library/lang/rascalcore/agrammar/tests" - // , REPO + "rascal/src/org/rascalmpl/compiler/lang/rascalcore/check/tests" + testFolders = [ GIT_REPO + "rascal/src/org/rascalmpl/library/lang/rascal/tests" + , GIT_REPO + "rascal/src/org/rascalmpl/library/lang/rascal/grammar/tests" + , GIT_REPO + "rascal/src/org/rascalmpl/library/lang/rascalcore/agrammar/tests" + // , GIT_REPO + "rascal/src/org/rascalmpl/compiler/lang/rascalcore/check/tests" ]; modulesToCompile = [ *getRascalModules(testFolder, pcfg) @@ -79,12 +79,12 @@ void generateTestSources(list[str] cmdLineArgs) { ]; } - ignored = ["lang::rascal::tests::concrete::Patterns3", + ignoredFiles = ["lang::rascal::tests::concrete::Patterns3", "lang::rascal::syntax::tests::ExpressionGrammars", "lang::sdf2::util::SDF2Grammar", "lang::sdf2::util::Importer" ]; - modulesToCompile -= ignored; + modulesToCompile -= ignoredFiles; list[str] exceptions = []; int n = size(modulesToCompile); @@ -98,7 +98,7 @@ void generateTestSources(list[str] cmdLineArgs) { } println("Compiled modules"); println(" failed to compile:"); iprintln(exceptions); - if(!isEmpty(ignored)) { println("Ignored: "); } + if(!isEmpty(ignoredFiles)) { println("Ignored: "); } secs = isEmpty(durations) ? 0 : sum(range(durations))/1000000000; println("Time: minutes"); //iprintln(sort({ | m <- durations}, bool (<_,int i>, <_, int j>) { return i < j; })); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Characters.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Characters.rsc index 8e260a699cc..54698609b3d 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Characters.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Characters.rsc @@ -38,7 +38,6 @@ extend lang::rascalcore::check::ATypeBase; import String; import List; -//data AType; data ACharRange = \empty-range(); ACharRange \new-range(int from, int to) = from <= to ? arange(from, to) : \empty-range(); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/BasicRascalConfig.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/BasicRascalConfig.rsc index 420762d43a1..fbc76975909 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/BasicRascalConfig.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/BasicRascalConfig.rsc @@ -148,9 +148,6 @@ data DefInfo(map[str,str] tags = ()); // Function modifiers data DefInfo(list[str] modifiers = []); -// Function md5Hash of source -data DefInfo(str md5 = ""); - // Common Keyword fields for ADTs data DefInfo(list[KeywordFormal] commonKeywordFields = []); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc index f4dc90debba..8b42be85c74 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc @@ -462,7 +462,7 @@ tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleSt start_check = cpuTime(); resetClosureCounter(); - c = newCollector(modelName, namedTrees, compilerConfig); + c = newCollector(modelName, namedTrees, compilerConfig, timestamp = getLastModified(modelName, ms.moduleLastModified, pcfg)); c.push(key_pathconfig, pcfg); rascalPreCollectInitialization(namedTrees, c); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CheckerCommon.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CheckerCommon.rsc index 14dea332912..9dbcc6836b5 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CheckerCommon.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CheckerCommon.rsc @@ -431,24 +431,26 @@ ModuleStatus updatePaths(loc oldModuleLoc, loc newModuleLoc, ModuleStatus ms){ } ModuleStatus consolidatePaths(ModuleStatus ms){ - set[loc] locs = {lc| /loc lc := ms.paths}; - map[loc,loc] lprops = (); - rel[loc,PathRole,loc] paths = ms.paths; - for(loc l <- locs){ - if(l.top in lprops && loc r := lprops[l.top] && r != l){ - if(l.length? && !r.length?){ - paths = visit(paths) { case r: { insert l; }}; - } else if(!l.length? && r.length?){ - paths = visit(paths) { case l: { insert r; }}; - } else { - mname = getRascalModuleName(l, ms.pathConfig); - causes = [info("Module location for : ", x) | x <- [l, r]]; - ms.messages[mname] ? {} += { error("Conflicting module locations found for ", l, causes=causes) }; - } - } - lprops[l.top] = l; - } - ms.paths = paths; + // set[loc] locs = {lc| /loc lc := ms.paths}; + // map[loc,loc] lprops = (); + // rel[loc,PathRole,loc] paths = ms.paths; + // for(loc l <- locs){ + // if(l.top in lprops && loc r := lprops[l.top] && r != l){ + // if(l.length? && !r.length?){ + // paths = visit(paths) { case r: { insert l; }}; + // } else if(!l.length? && r.length?){ + // paths = visit(paths) { case l: { insert r; }}; + // } else { + // paths = visit(paths) { case l: { insert l.top; }}; + // // mname = getRascalModuleName(l, ms.pathConfig); + // // causes = [info("Module location for : ", x) | x <- [l, r]]; + // // ms.messages[mname] ? {} += { error("Conflicting module locations found for ", l, causes=causes) }; + // } + // } + // lprops[l.top] = l; + // } + // ms.paths = paths; + //ms.paths = visit(ms.paths) { case loc l => l.top }; // strPaths = getStrPaths(ms.paths, ms.pathConfig); // if(strPaths != ms.strPaths){ diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc index 10fb51abe9d..ea81a49777c 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectDeclaration.rsc @@ -42,6 +42,7 @@ import lang::rascalcore::agrammar::definition::Attributes; import lang::rascalcore::check::SyntaxGetters; import lang::rascalcore::check::ATypeBase; // seemingly redundant +extend lang::rascalcore::check::BasicRascalConfig; import IO; import List; diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectSyntaxDeclaration.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectSyntaxDeclaration.rsc index 6a474472b4e..83b66455721 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectSyntaxDeclaration.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/CollectSyntaxDeclaration.rsc @@ -40,6 +40,7 @@ import util::Maybe; import lang::rascalcore::agrammar::definition::Symbols; import lang::rascalcore::agrammar::definition::Attributes; import lang::rascalcore::check::ATypeBase; // seemingly redundant +extend lang::rascalcore::check::BasicRascalConfig; // ---- syntax definition ----------------------------------------------------- diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc index 8031643e163..6e170fc0e0d 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc @@ -31,8 +31,6 @@ module lang::rascalcore::check::RascalConfig High level configuration of the Rascal checker. */ -//import lang::rascalcore::check::CheckerCommon; - import lang::rascalcore::check::ADTandGrammar; import lang::rascalcore::compile::muRascal::AST; @@ -505,7 +503,7 @@ void reportConstructorOverload(Expression current, overloadedAType(rel[loc def, ovl1 = coverloads[0]; adtNames = { adtName | <- overloads, acons(ret:aadt(adtName, list[AType] _, _), list[AType] fields, list[Keyword] kwFields) := tp }; qualifyHint = size(adtNames) > 1 ? " you may use as qualifier" : ""; - argHint = "make argument type(s) more precise"; + argHint = "make argument type(s) more precise"; msg = error("Constructor `` is overloaded, maybe", current@\loc); s.addMessages([msg]); @@ -529,19 +527,19 @@ void rascalPostSolver(map[str,Tree] namedTrees, Solver s){ // bool isLogicalLoc(loc l) // = startsWith(l.scheme, "rascal+"); -loc rascalCreateLogicalLoc(Define def, str _modelName, PathConfig pcfg){ +tuple[bool, loc] rascalCreateLogicalLoc(Define def, str _modelName, PathConfig pcfg){ if(def.idRole in keepInTModelRoles){ - if(isLogicalLoc(def.defined)) return def.defined; + if(isLogicalLoc(def.defined)) return ; moduleName = getRascalModuleName(def.defined, pcfg); moduleNameSlashed = replaceAll(moduleName, "::", "/"); suffix = def.defInfo.md5? ? "$" : ""; if(def.idRole == moduleId()){ - return |<"rascal+">:///|; + return ">:///|>; } else { - return |<"rascal+">:////|; + return ">:////|>; } } - return def.defined; + return ; } @memo{expireAfter(minutes=5),maximumSize(1000)} diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/TestConfigs.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/TestConfigs.rsc index 90508259e10..42bd5e4a631 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/TestConfigs.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/TestConfigs.rsc @@ -50,6 +50,7 @@ public loc RASCAL = |mvn://org.rascalmpl--rascal--0.41.0-RC15/|; public loc TYPEPAL = |mvn://org.rascalmpl--typepal--0.14.8/|; public loc OUTDATED_TYPEPAL = |mvn://org.rascalmpl--typepal--0.14.1/|; +public loc RASCAL_RC67 = |mvn://org.rascalmpl--rascal--0.41.0-RC67/|; public loc DRAMBIGUITY = |mvn://org.rascalmpl--drambiguity--0.1.2/|; public loc FLYBYTES = |mvn://org.rascalmpl--flybytes--0.1.5/|; @@ -57,6 +58,7 @@ public loc SALIX_CORE = |mvn://org.rascalmpl--salix-core--0.2.7/|; public loc SALIX_CONTRIB = |mvn://org.rascalmpl--salix-contrib--0.2.7/|; public loc RASCAL_LSP = |mvn://org.rascalmpl--rascal-lsp--2.21.2/|; public loc PHP_ANALYSIS = |mvn://org.rascalmpl--php-analysis--0.2.5-SNAPSHOT/|; +public loc JAVA_AIR = |mvn://org.rascalmpl--java-air--1.0.0-RC2/|; public loc REPO = |file:///Users/paulklint/git/|; public loc COMPILED_RASCAL @@ -269,7 +271,7 @@ public RascalCompilerConfig getFlyBytesCompilerConfig(bool keep=true){ // ---- salix ----------------------------------------------------------------- public PathConfig getSalixPathConfig(bool keep = false) { - return makePathConfig([ REPO + "salix-core/src/main/rascal", REPO + "salix-contrib/src/main/rascal" ], + return makePathConfig([ REPO + "salix-core/src/", REPO + "salix-contrib/src/main/rascal" ], [ RASCAL ], keep=keep); } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/AssignmentTCTests.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/AssignmentTCTests.rsc index b29f4c2dd02..f4a2683c747 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/AssignmentTCTests.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/AssignmentTCTests.rsc @@ -318,7 +318,6 @@ test bool AssignIntModuleVarOk() { "); } -// @ignore{Test needs typepal version > 0.15.1} test bool AssignAndIncrementIntModuleVarOk() { clearMemory(); writeModule("module A public int X = 1;"); @@ -349,7 +348,28 @@ test bool AssignAndIncrementListIntModuleVarOk() { "); } -//@ignore{Test needs typepal version > 0.15.1} +test bool doubleDeclarationOfPrivateModuleVarOk(){ + clearMemory(); + writeModule("module A int X = 1;"); + return checkModuleOK(" + module B + import A; + int X = 2; + int main() = X; + "); +} + +test bool doubleDeclarationOfPublicModuleVarNotOk(){ + clearMemory(); + writeModule("module A public int X = 1;"); + return unexpectedDeclarationInModule(" + module B + import A; + public int X = 2; + int main() = X; + "); +} + test bool InferredVarAndModuleVarOk(){ clearMemory(); return checkModuleOK(" @@ -362,7 +382,6 @@ test bool InferredVarAndModuleVarOk(){ "); } -// @ignore{Test needs typepal version > 0.15.1} test bool InferredVarAndImportedModuleVarOk(){ clearMemory(); writeModule("module A public int X = 1;"); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/BinaryDependencyTests.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/BinaryDependencyTests.rsc index 31511550942..dc3126f40a4 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/BinaryDependencyTests.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/BinaryDependencyTests.rsc @@ -403,6 +403,27 @@ test bool incompatibleVersionsOfBinaryLibrary(){ // Recompile Check and discover the error return checkExpectErrors("Check", ["Review of dependencies, reconfiguration or recompilation needed: binary module `TP` depends (indirectly) on incompatible module(s)"], core.pcfg, remove = [rascal, typepal, core]); } +@ignore{Unclear whether it should fail or succeed} +test bool mixedRascalVersions() { + // This test project has a dependency on: + // * Rascal 0.41.0-RC67 + // * java-air 1.0.0-RC2, which was built using Rascal 0.41.0-RC35 + // The test module imports: + // * a standard library module from 0.41.0-RC67 + // * a library module of which the packaged tpl was built using 0.41.0-RC35 + clearMemory(); + project_name = "test-project"; + test_project = + createProject( + project_name, + ("Test": "import IO; + 'import lang::java::m3::Core;"), + createPathConfig(project_name) + [libs=[RASCAL_RC67, JAVA_AIR]] + [srcs=[src(project_name)]] + ); + return checkExpectNoErrors("Test", test_project.pcfg, remove = [test_project]); +} // ---- Binary compatibility of two TModels ----------------------------------- diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc index 5f4c03fdb88..6dc2017f1c4 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc @@ -193,17 +193,17 @@ bool validateUseDefs(str moduleName, map[str, tuple[int, set[int]]] usedefs, Mod println("names:"); iprintln(names); = getTModelForModule(moduleName, ms); foundUseDefs = tm.useDef; - println("foundUseDefs:"); - for( <- foundUseDefs){ - println(": ==\> "); - } + // println("foundUseDefs:"); + // for( <- foundUseDefs){ + // println(": ==\> "); + // } for(str v <- usedefs){ = usedefs[v]; list[loc] occ = []; if(names[v]?) occ = names[v]; else throw " not found in tree"; if(!occ[def]?) throw "Missing define for "; for(int u <- uses){ - println("u = "); + //println("u = "); if(!occ[u]?){ throw "Missing use for "; } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/download-test-jars.sh b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/download-test-jars.sh index 5627b4b0c26..2e11565378e 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/download-test-jars.sh +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/tests/download-test-jars.sh @@ -8,10 +8,12 @@ function download() { # these should be synced with `TestConfigs.rsc` download "org.rascalmpl" "rascal" "0.41.0-RC15" +download "org.rascalmpl" "rascal" "0.41.0-RC67" download "org.rascalmpl" "typepal" "0.14.8" download "org.rascalmpl" "typepal" "0.14.1" download "org.rascalmpl" "drambiguity" "0.1.2" download "org.rascalmpl" "flybytes" "0.1.5" download "org.rascalmpl" "salix-core" "0.2.7" download "org.rascalmpl" "salix-contrib" "0.2.7" -download "org.rascalmpl" "rascal-lsp" "2.21.2" \ No newline at end of file +download "org.rascalmpl" "rascal-lsp" "2.21.2" +download "org.rascalmpl" "java-air" "1.0.0-RC2" \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Compile.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Compile.rsc index 1f6bdf7b069..08f65b02e26 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Compile.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Compile.rsc @@ -192,14 +192,14 @@ void main( warnUnusedPatternFormals = warnUnusedPatternFormals, infoModuleChecked = infoModuleChecked ); - + list[Message] messages = []; if (\modules == []) { // the `compile` function throws EmptyList() on an empty list of modules - messages = info("No modules to compile."); + messages = [ info("No modules to compile.", pcfg.srcs[0]) ]; } else { messages = compile(\modules, rascalConfig); } - return mainMessageHandler(messages, srcs=pcfg.srcs, errorsAsWarnings=errorsAsWarnings, warningsAsErrors=warningsAsErrors); + return mainMessageHandler(messages, projectRoot=pcfg.projectRoot, errorsAsWarnings=errorsAsWarnings, warningsAsErrors=warningsAsErrors); } \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Bottom.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Bottom.rsc deleted file mode 100644 index 8e0928fa876..00000000000 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Bottom.rsc +++ /dev/null @@ -1,4 +0,0 @@ -module lang::rascalcore::compile::Examples::Bottom - -data Exp; -data Bool = \true() | \false(); \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/F.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/F.rsc deleted file mode 100644 index aa7630cef7f..00000000000 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/F.rsc +++ /dev/null @@ -1,6 +0,0 @@ -module lang::rascalcore::compile::Examples::F - - -extend lang::rascalcore::compile::Examples::E; - -void main() { throw TypePalUsage("abc"); } \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/IncompatibleModules.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/IncompatibleModules.rsc index 5a960e815b1..17ca8075460 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/IncompatibleModules.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/IncompatibleModules.rsc @@ -7,9 +7,8 @@ import String; import util::Reflective; import lang::rascalcore::check::Checker; -loc REPO = |file:///Users/paulklint/git/rascal/|; // Rascal 0.41.0-RC42 -public loc projectDir = REPO; +public loc projectDir = |file:///Users/paulklint/git/rascal/|; // Typepal 0.15.1, met Rascal dependency aangepast naar 0.41.0-RC42 public loc typepalLib = |mvn://org.rascalmpl--typepal--0.15.1-SNAPSHOT/|; diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Left.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Left.rsc deleted file mode 100644 index 6e0d75a1184..00000000000 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Left.rsc +++ /dev/null @@ -1,4 +0,0 @@ -module lang::rascalcore::compile::Examples::Left - -extend lang::rascalcore::compile::Examples::Bottom; -data Exp = or(Exp lhs, Exp rhs)| maybe() | \true() | \false(); \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Right.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Right.rsc deleted file mode 100644 index 063ee1a02c7..00000000000 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Right.rsc +++ /dev/null @@ -1,4 +0,0 @@ -module lang::rascalcore::compile::Examples::Right -extend lang::rascalcore::compile::Examples::Bottom; -data Exp = and(Bool lhs, Bool rhs); -data Exp2 = or(Exp lhs, Exp rhs); \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Top.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Top.rsc deleted file mode 100644 index 8905f9f468d..00000000000 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Top.rsc +++ /dev/null @@ -1,9 +0,0 @@ -module lang::rascalcore::compile::Examples::Top -import lang::rascalcore::compile::Examples::Left; -import lang::rascalcore::compile::Examples::Right; - -Exp main(){ - x = or(maybe(), maybe()); - y = x.lhs; // ok: lhs is overloaded - return y; -} \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Tst1.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Tst1.rsc index 56afb0a5f16..f08c849f70d 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Tst1.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/Tst1.rsc @@ -25,10 +25,99 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } module lang::rascalcore::compile::Examples::Tst1 +import lang::rascalcore::check::Checker; +import util::FileSystem; +import util::PathConfig; import IO; -data PathRole = extendPath(); +import Message; +import util::Reflective; -void main() { - x = <|file:///Users/paulklint/git/rascal/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/B.rsc|(0,1837,<1,0>,<50,7>),extendPath(),|file:///Users/paulklint/git/rascal/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/B.rsc|(0,1837,<1,0>,<50,7>)>; - iprintln({x, x}); - } \ No newline at end of file +private void runChecker(PathConfig pcfg, bool (loc m) validModule) { + result = check([m | src <- pcfg.srcs, m <- find(src, "rsc"), validModule(m)], rascalCompilerConfig(pcfg)[verbose=true][logWrittenFiles=true]); + for (/e:error(_,_) := result) { + println(e); + } +} + +private void runChecker(PathConfig pcfg, list[str] modules) { + result = check([getRascalModuleLocation(m, pcfg) | m <- modules], rascalCompilerConfig(pcfg)[verbose=true][logWrittenFiles=true]); + for (/e:error(_,_) := result) { + println(e); + } +} + +private void runChecker(PathConfig pcfg, list[loc] modules) { + result = check(modules, rascalCompilerConfig(pcfg)[verbose=true][logWrittenFiles=true]); + for (/e:error(_,_) := result) { + println(e); + } +} + +void main(loc repoRoot = |file:///Users/paulklint/git/|, loc tplRoot = |file:///Users/paulklint/rascal-tpls|) { + rascalPcfg = pathConfig(srcs=[repoRoot + "rascal/src/org/rascalmpl/library"], bin=tplRoot + "rascal"); + salixCorePcfg = pathConfig(srcs=[repoRoot + "salix-core/src/main/rascal"], bin=tplRoot + "salix-core", libs=[rascalPcfg.bin]); + salixContribPcfg = pathConfig(srcs=[repoRoot + "salix-contrib/src/main/rascal"], bin=tplRoot + "salix-core", libs=[rascalPcfg.bin, salixCorePcfg.bin]); + + remove(tplRoot); + println("**** Checking rascal"); + getModuleLocation("List", rascalPcfg); + runChecker(rascalPcfg, + ["List", "String", "ParseTree", "lang::json::IO", "vis::Text", "vis::Charts", "util::Webserver", "util::UUID"] + // bool (loc m) { + // return /lang.rascal/ !:= m.path && /experiments/ !:= m.path && /lang.rascal.*tests/ !:= m.path; + // } + ); + + + println("**** Checking salix-core"); + //runChecker(salixCorePcfg, [ "salix::App" ]); + runChecker(salixCorePcfg, + [ + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/Node.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/shop/Shop.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/SVG.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/Diff.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/util/Debug.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/Files.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/HTML.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/todomvc/TodoMVC.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/alien/Prototype.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/Random.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/Index.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/All.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/util/WithPopups.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/Core.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/Clock.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/App.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/Bug.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/util/Highlight.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/Counter.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/util/LCS.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/Loop.rsc|, + |file:///Users/paulklint/git/salix-core/src/main/rascal/salix/demo/basic/Celsius.rsc| + ]); + + //runChecker(salixCorePcfg, bool(loc m) { return true; }); + + println("**** Checking salix-contrib"); + runChecker(salixContribPcfg, [ + |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/mermaid/Mermaid.rsc|, + |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/mermaid/Demo.rsc|, + |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/jsplumb/Demo.rsc|, + |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/mermaid/FlowChart.rsc|, + |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/util/Mode.rsc| + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/Main.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/ace/Editor.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/cytoscape/Demo.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/canvas/Demo.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/canvas/Heart.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/ace/Demo.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/canvas/Canvas.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/charts/Charts.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/jsplumb/JSPlumb.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/cytoscape/Cytoscape.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/charts/Demo.rsc|, + // |file:///Users/paulklint/git/salix-contrib/src/main/rascal/salix/mermaid/ClassDiagram.rsc| +]); + //runChecker(salixContribPcfg, bool(loc m) { return true; }); +} \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalConstantCall.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalConstantCall.rsc index 4b4ffcbc061..6bd9e00658b 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalConstantCall.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalConstantCall.rsc @@ -100,7 +100,7 @@ private MuExp tcc("regular", [muCon(Symbol def)]) = muCon(ParseTree::regular(def private MuExp tcc("priority", [muCon(Symbol def), muCon(list[Production] choices)]) = muCon(ParseTree::priority(def, choices)); private MuExp tcc("associativity", [muCon(Symbol def), muCon(ParseTree::Associativity \assoc), muCon(set[Production] alternatives)]) = muCon(ParseTree::associativity(def, \assoc, alternatives)); private MuExp tcc("reference", [muCon(Symbol def), muCon(str cons)]) = muCon(ParseTree::reference(def, cons)); -private MuExp tcc("choice", [muCon(Symbol def), muCon(set[Production] alternatives)]) = muCon(Type::\choice(def, alternatives)); +private MuExp tcc("choice", [muCon(Symbol def), muCon(set[Production] alternatives)]) = muCon(Production::\choice(def, alternatives)); // Attr @@ -141,7 +141,6 @@ private MuExp tcc("lrel", [muCon(list[Symbol] symbols)]) = muCon(\lrel(symbols)) private MuExp tcc("tuple", [muCon(list[Symbol] symbols)]) = muCon(\tuple(symbols)); private MuExp tcc("list", [muCon(Symbol symbol)]) = muCon(\list(symbol)); private MuExp tcc("map", [muCon(Symbol from), muCon(Symbol to)]) = muCon(\map(from, to)); -private MuExp tcc("bag", [muCon(Symbol symbol)]) = muCon(\bag(symbol)); private MuExp tcc("adt", [muCon(str name), muCon(list[Symbol] parameters)]) = muCon(\adt(name, parameters)); private MuExp tcc("cons", [muCon(Symbol adt), muCon(str name), muCon(list[Symbol] parameters)]) = muCon(cons(adt, name, parameters)); private MuExp tcc("alias", [muCon(str name), muCon(list[Symbol] parameters), muCon(Symbol aliased)]) = muCon(\alias(name, parameters, aliased)); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc index 962ad8c0c30..4f4bc607c36 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalExpression.rsc @@ -573,7 +573,7 @@ private MuExp translateConcreteExpressionSeparatedList(Symbol eltType, list[Symb code = [muConInit(writer, muPrim("open_list_writer", avalue(), [], [], src))]; if (isListVar(eltType, single)) { - varExp = muTreeGetArgs(translateConcreteExpression(single)); + MuExp varExp = muTreeGetArgs(translateConcreteExpression(single)); code += [muPrim("splice_list", avoid(), [avalue(), treeType], [writer, varExp], src)]; } else { @@ -595,7 +595,7 @@ private MuExp translateConcreteExpressionSeparatedList(Symbol eltType, list[Symb // first we compile all element except the final separators and the final element: while ([Tree first, *Tree sepTrees, Tree second, *Tree more] := elems && size(sepTypes) == size(sepTrees)) { - varExp = translateConcreteExpression(first); + MuExp varExp = translateConcreteExpression(first); // first we splice or add the first element: if (isListVar(eltType, first)) { @@ -1432,11 +1432,15 @@ MuExp translate ((Expression) ` has `) { } // Determine set of constructors with the desired field - constructors = getConstructorsMap()[tp] ? {}; - consesWithField = {c | c:acons(AType _adt, list[AType] fields, list[Keyword] kwFields) <- constructors, - (!isEmpty(fields) && any(f <- fields, f.alabel == uname)) || - (!isEmpty(kwFields) && any(kwf <- kwFields, kwf.fieldType.alabel == uname)) - }; + map[AType, set[AType]] constructors = (); + if(getConstructorsMap()[tp] ?){ + constructors = getConstructorsMap()[tp]; + } + set[AType] consesWithField = + {c | c:acons(AType _adt, list[AType] fields, list[Keyword] kwFields) <- constructors, + (!isEmpty(fields) && any(f <- fields, f.alabel == uname)) || + (!isEmpty(kwFields) && any(kwf <- kwFields, kwf.fieldType.alabel == uname)) + }; //if(isEmpty(consesWithField)){ // return muCon(false); // It is statically known that there is no constructor with desired field //} diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc index a823daa79b0..605f617b6c5 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalModule.rsc @@ -70,7 +70,7 @@ tuple[TModel, MuModule] r2mu(lang::rascal::\syntax::Rascal::Module M, TModel tmo module_scope = M@\loc; setModuleScope(module_scope); //setModuleScope(convert2fuid(module_scope)); - module_name = ""; + str module_name = ""; setModuleName(module_name); mtags = translateTags(M.header.tags); setModuleTags(mtags); @@ -139,7 +139,9 @@ tuple[TModel, MuModule] r2mu(lang::rascal::\syntax::Rascal::Module M, TModel tmo // return visit(tmodel) { case loc l => relocLoc(l, reloc, srcs) }; //} -void translateModule((Module) `
`) { +void translateModule(Module m) { + header = m.header; + body = m.body; for(imp <- header.imports) importModule(imp); for( tl <- body.toplevels) translateToplevel(tl); } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc index 01dc7988eb5..17c1ff0ab5a 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/RascalPattern.rsc @@ -342,7 +342,7 @@ MuExp translateRegExpLiteral(re: (RegExpLiteral) `///`){ str fuid = topFunctionScope(); - fragmentCode = []; + list[MuExp] fragmentCode = []; vars = []; map[str,int] varnames = (); str fragment = ""; @@ -409,7 +409,7 @@ tuple[MuExp exp, list[MuExp] vars] processRegExpLiteral(e: (RegExpLiteral) `/; } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/TypeUtils.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/TypeUtils.rsc index 5b965af1950..6360678eff9 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/TypeUtils.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/Rascal2muRascal/TypeUtils.rsc @@ -214,10 +214,13 @@ bool isUse(UID u){ } private AType getDefType(UID d){ - if(defType(arg) := definitions[d].defInfo){ - if(AType atype := arg) return atype; - if(Tree tree := arg) return getDefType(getLoc(tree)); - if(loc l := arg) return facts[l]; + di = definitions[d].defInfo; + if(defType(AType atype) := di){ + return atype; + } else if(defType(Tree tree) := di){ + return getDefType(getLoc(tree)); + } else if(defType(loc l) := di){ + return facts[l]; } throw "getDefType: "; } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal/AST.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal/AST.rsc index 2a90888f2fd..abccc16388f 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal/AST.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal/AST.rsc @@ -410,10 +410,10 @@ str getUniqueFunctionName(MuFunction fun){ //return "_"; } -private set[str] varExp = {"muModuleVar", "muVar", "muTmpIValue", "muTmpNative"}; +private set[str] muExpVars = {"muModuleVar", "muVar", "muTmpIValue", "muTmpNative"}; bool isVarOrTmp(MuExp exp) - = getName(exp) in varExp; + = getName(exp) in muExpVars; // Produces NativeBool diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/CodeGen.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/CodeGen.rsc index 8439f523d55..198cdd10662 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/CodeGen.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/CodeGen.rsc @@ -91,7 +91,7 @@ tuple[JCode, JCode, JCode, list[value]] muRascal2Java(MuModule m, ModuleStatus m loc2muFunction = (f.src : f | f <- m.functions); // Iteratively propagate external dependencies of functions - functions = m.functions; + list[MuFunction] functions = m.functions; solve(functions){ functions = [ addTransitiveRefs(f) | f <- functions ]; } @@ -107,7 +107,7 @@ tuple[JCode, JCode, JCode, list[value]] muRascal2Java(MuModule m, ModuleStatus m jg = makeJGenie(m, tmodels, moduleLocs, muFunctions); resolvers = generateResolvers(moduleName, loc2muFunction, imports, extends, tmodels, moduleLocs, pcfg, jg); - facts = tm.facts; + map[loc,AType] facts = tm.facts; cons_in_module = { def.defInfo.atype | Define def <-range(tm.definitions), def.idRole == constructorId(), isContainedIn(def.scope, module_scope) } + { t | loc k <- facts, /AType t:acons(AType adt, list[AType] fields, list[Keyword] kwFields) := facts[k], !isEmpty(adt.parameters), any(p <- adt.parameters, !isTypeParameter(p)) diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/JGenie.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/JGenie.rsc index 84c3c961ae9..176f3e3d7c3 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/JGenie.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/JGenie.rsc @@ -91,6 +91,7 @@ JGenie makeJGenie(MuModule m, map[str,loc] allModuleLocs = moduleLocs; map[loc,str] allLocs2Module = invertUnique(moduleLocs); + allLocs2Module += (l.top : allLocs2Module[l] | l <- domain(allLocs2Module) ); MuModule currentModule = m; str moduleName = m.name; map[AType, map[str,AType]] commonKeywordFieldsNameAndType = m.commonKeywordFields; @@ -359,7 +360,7 @@ JGenie makeJGenie(MuModule m, } bool _isDefinedInCurrentFunction(MuExp var){ - definitions = currentTModel.definitions; + map[loc, Define] definitions = currentTModel.definitions; for(d <- definitions, def := definitions[d], var.name == def.id, isContainedIn(def.scope, function.src), def.idRole in variableRoles){ return true; } @@ -368,20 +369,20 @@ JGenie makeJGenie(MuModule m, list[Keyword] _collectKwpFormals(MuFunction fun){ if(isSyntheticFunctionName(fun.name)) return []; // closures, function compositions ... - scopes = currentTModel.scopes; + Scopes my_scopes = currentTModel.scopes; kwFormals = fun.ftype.kwFormals; - outer = scopes[fun.src]; + outer = my_scopes[fun.src]; while (muFunctionsByLoc[outer]?){ fun1 = muFunctionsByLoc[outer]; kwFormals += fun1.ftype.kwFormals; - outer = scopes[fun1.src]; + outer = my_scopes[fun1.src]; } return kwFormals; } lrel[str name, AType atype, MuExp defaultExp] _collectKwpDefaults(MuFunction fun){ if(isSyntheticFunctionName(fun.name)) return []; // closures, function compositions ... - scopes = currentTModel.scopes; + Scopes scopes = currentTModel.scopes; defaults = fun.kwpDefaults; funKwps = fun.kwpDefaults<0>; outer = scopes[fun.src]; @@ -395,7 +396,7 @@ JGenie makeJGenie(MuModule m, list[str] _collectRedeclaredKwps(MuFunction fun){ if(isSyntheticFunctionName(fun.name)) return []; // closures, function compositions ... - scopes = currentTModel.scopes; + Scopes scopes = currentTModel.scopes; funKwps = fun.kwpDefaults<0>; redeclared = []; outer = scopes[fun.src]; @@ -410,7 +411,7 @@ JGenie makeJGenie(MuModule m, list[str] _collectDeclaredKwps(MuFunction fun){ if(isSyntheticFunctionName(fun.name)) return []; // closures, function compositions ... - scopes = currentTModel.scopes; + Scopes scopes = currentTModel.scopes; funKwps = fun.kwpDefaults<0>; declared = funKwps; outer = scopes[fun.src]; diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/Resolvers.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/Resolvers.rsc index 9cfda02bd34..92f79a49601 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/Resolvers.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/compile/muRascal2Java/Resolvers.rsc @@ -151,8 +151,8 @@ public set[set[Define]] mygroup(set[Define] input, bool (Define a, Define b) sim str generateResolvers(str moduleName, map[loc, MuFunction] loc2muFunction, set[str] imports, set[str] extends, map[str,TModel] tmodels, map[str,loc] module2loc, PathConfig pcfg, JGenie jg){ module_scope = module2loc[moduleName]; - loc2module = invertUnique(module2loc); - module_scopes = domain(loc2module); + map[loc,str] loc2module = invertUnique(module2loc); + set[loc] module_scopes = domain(loc2module); extend_scopes = { module2loc[ext] | ext <- extends, ext in module2loc}; import_scopes = { module2loc[imp] | imp <- imports, imp in module2loc }; @@ -220,7 +220,7 @@ tuple[bool,loc] findImplementingModule(set[Define] fun_defs, set[loc] import_sco str generateResolver(str moduleName, str functionName, set[Define] fun_defs, map[loc, MuFunction] loc2muFunction, loc module_scope, set[loc] import_scopes, set[loc] extend_scopes, Paths paths, TModel tm, map[loc, str] loc2module, PathConfig pcfg, JGenie jg){ //println("generate resolver for , "); - module_scopes = domain(loc2module); + set[loc] module_scopes = domain(loc2module); set[Define] local_fun_defs = {def | def <- fun_defs, /**/isContainedIn(def.defined, module_scope)/*, "test" notin loc2muFunction[def.defined].modifiers*/ }; @@ -376,7 +376,7 @@ str generateResolver(str moduleName, str functionName, set[Define] fun_defs, map map[int, lrel[str,str]] overload_table = (); lrel[str,str] defaults_and_constructors = []; - physical2logical = invertUnique(tm.logical2physical); + map[loc,loc] physical2logical = invertUnique(tm.logical2physical); // Handle a function or constructor defintion