diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc index 917e63c0..ae922d89 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc @@ -97,6 +97,8 @@ tuple[bool,loc] getTPLWriteLoc(str qualifiedModuleName, PathConfig pcfg){ return ; } +datetime startOfEpoch = $2000-01-01T00:00:00.000+00:00$; + datetime getLastModified(str qualifiedModuleName, map[str, datetime] moduleLastModified, PathConfig pcfg){ qualifiedModuleName = unescape(qualifiedModuleName); try { @@ -110,7 +112,7 @@ datetime getLastModified(str qualifiedModuleName, map[str, datetime] moduleLastM //println("getLastModified via lastModified: "); return res; } catch value _: { - return $2000-01-01T00:00:00.000+00:00$; + return startOfEpoch; } } } diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDataDeclaration.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDataDeclaration.rsc index 5c82bde1..d31716a8 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDataDeclaration.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDataDeclaration.rsc @@ -89,7 +89,7 @@ void collect(current:(Variant) ` ( <{TypeArg ","}* arguments> "); + dt.md5 = md5Hash(" "); c.define(fieldName, fieldId(), ta.name, dt); } } @@ -107,13 +107,16 @@ void collect(current:(Variant) ` ( <{TypeArg ","}* arguments> : "); c.defineInScope(adtParentScope, prettyPrintName(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*/]; formalTypes = [f is named ? s.getType(f)[alabel=prettyPrintName(f.name)] : s.getType(f) | f <- formals]; return acons(adtType, formalTypes, kwFormalTypes)[alabel=asUnqualifiedName(prettyPrintName(name))]; - })[md5 = md5Hash("(")]); + })[md5 = md5Hash(md5Contrib)]); variantCounter += 1; c.fact(current, name); beginUseTypeParameters(c, closed=false); diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDeclaration.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDeclaration.rsc index bfa88834..a9ccf294 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDeclaration.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectDeclaration.rsc @@ -39,6 +39,8 @@ void collect(Module current: (Module) `
`, Collector c dataCounter = 0; variantCounter = 0; + nalternatives = 0; + syndefCounter = 0; mloc = getLoc(current); mname = prettyPrintName(header.name); @@ -265,7 +267,6 @@ void collect(current: (FunctionDeclaration) ``, Collec if("default" in modifiers){ ft.isDefault = true; - md5Contrib = "default" + md5Contrib; } if("test" in modifiers){ @@ -322,7 +323,7 @@ void collect(current: (FunctionDeclaration) ``, Collec c.report(error(decl.signature, "Missing return statement")); } if(!alwaysSucceeds){ - md5Contrib += ""; + md5Contrib += "{}"; } } @@ -339,7 +340,7 @@ void collect(current: (FunctionDeclaration) ``, Collec if(decl is conditional){ conditions = [cond | cond <- decl.conditions]; - md5Contrib += ""; + md5Contrib += " when "; storeAllowUseBeforeDef(decl, decl.expression, c); c.require("when conditions", decl.conditions, conditions, void (Solver s){ @@ -359,7 +360,7 @@ void collect(current: (FunctionDeclaration) ``, Collec endUseBoundedTypeParameters(c); surroundingFuns = c.getStack(currentFunction); - + dt.md5 = md5Hash(size(surroundingFuns) == 1 ? md5Contrib : ""); c.defineInScope(parentScope, prettyPrintName(fname), functionId(), current, dt); @@ -372,7 +373,10 @@ void collect(current: (FunctionBody) `{ }`, Collector c) } str md5Contrib4signature(Signature signature){ - return ""; + fs = " <}>"; + res = " ( )"; + //println(" =\> "); + return res; } tuple[set[str], rel[str,Type]] collectSignature(Signature signature, Collector c){ diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectSyntaxDeclaration.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectSyntaxDeclaration.rsc index e255d20a..db569ffb 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectSyntaxDeclaration.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectSyntaxDeclaration.rsc @@ -34,8 +34,8 @@ void collect (current: (SyntaxDefinition) ` syntax = < declareSyntax(current, contextFreeSyntax(), nonterminalId(), c); } -int nalternatives = 0; -int syndefCounter = 0; +public int nalternatives = 0; +public int syndefCounter = 0; void declareSyntax(SyntaxDefinition current, SyntaxRole syntaxRole, IdRole idRole, Collector c, Vis vis=publicVis()){ //println("declareSyntax: "); diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc index 73ca1fb9..be30bf02 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc @@ -133,7 +133,8 @@ ModuleStatus getImportAndExtendGraph(str qualifiedModuleName, ModuleStatus ms){ } catch value _:{ allImportsAndExtendsValid = true; println("--- reusing tmodel of (source not accessible)"); - throw rascalSourceMissing("Source of is not accessible"); + isCompatible(tm, domain(localImportsAndExtends), ms); + //throw rascalSourceMissing("Source of is not accessible"); } } if(allImportsAndExtendsValid){ @@ -185,6 +186,29 @@ ModuleStatus getInlineImportAndExtendGraph(Tree pt, PathConfig pcfg){ return complete(ms); } +str getModuleFromLogical(loc l){ + i = findFirst(l.path[1..], "/"); + return i >= 0 ? l.path[1..i+1] : l.path[1..]; +} + +bool isCompatible(TModel lib, set[str] otherImportsAndExtends, ModuleStatus ms){ + provides = { | l <- domain(lib.logical2physical), m := getModuleFromLogical(l) }; + println(" provides:"); iprintln(provides); + requires = {}; + for(m <- otherImportsAndExtends){ + = getTModelForModule(m, ms); + if(found){ + println(":"); iprintln(domain(tm.logical2physical)); + requires += { | l <- domain(tm.logical2physical), m := getModuleFromLogical(l) }; + } + } + println("requires:"); iprintln(requires); + + println("unstatisfied: "); + + return true; +} + rel[str, PathRole, str] getModulePathsAsStr(Module m){ moduleName = unescape(""); return { ")> | imod <- m.header.imports, imod has \module}; @@ -389,14 +413,17 @@ ModuleStatus doSaveModule(set[str] component, map[str,set[str]] m_imports, map[s ms.status[qualifiedModuleName] += tpl_saved(); try { writeBinaryValueFile(tplLoc, m1); - //if(compilerConfig.logWrittenFiles) println("Written: "); + if(compilerConfig.logWrittenFiles) println("Written: "); save_time = (cpuTime() - start_save)/1000000; - println("Saved TPL .. in ms"); + if(compilerConfig.verbose) { + save_time = (cpuTime() - start_save)/1000000; + println("Saved TPL .. in ms"); + } } catch value e: { throw "Cannot write TPL file , reason: "; } ms = addTModel(qualifiedModuleName, m1, ms); - //println("doSaveModule"); iprintln(m1); + //println("doSaveModule"); iprintln(domain(m1.logical2physical)); } catch value e: { ms.messages[qualifiedModuleName] ? [] += tm.messages + [error("Could not save .tpl file for ``, reason: ", |unknown:///|(0,0,<0,0>,<0,0>))];