Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit eb25cc4

Browse files
committed
In case of circular imports, the reuse of TModels was incorect.
Fixes Issue #2148
1 parent 9c89949 commit eb25cc4

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,26 @@ ModuleStatus rascalTModelForLocs(
222222
}
223223

224224
compatible_with_all_imports = true;
225-
for(m <- component){
226-
m_compatible = false;
227-
<found, tm, ms> = getTModelForModule(m, ms);
228-
if(found && !tplOutdated(m, pcfg)){
229-
imports_extends_m = imports_and_extends[m];
225+
any_tpl_outdated = any(m <- component, tplOutdated(m, pcfg));
226+
if(any_tpl_outdated){
227+
for(m <- component){
228+
ms.status[m] -= {tpl_uptodate(), checked()};
229+
ms.status[m] += {rsc_changed()};
230+
}
231+
} else {
232+
for(m <- component){
233+
m_compatible = false;
234+
<found, tm, ms> = getTModelForModule(m, ms);
235+
if(found && !tplOutdated(m, pcfg)){
236+
imports_extends_m = imports_and_extends[m];
230237

231-
<m_compatible, ms> = importsAndExtendsAreBinaryCompatible(tm, imports_extends_m, ms);
232-
if(m_compatible){
233-
ms.status[m] += {tpl_uptodate(), checked(), bom_update_needed()};
238+
<m_compatible, ms> = importsAndExtendsAreBinaryCompatible(tm, imports_extends_m, ms);
239+
if(m_compatible){
240+
ms.status[m] += {tpl_uptodate(), checked(), bom_update_needed()};
241+
}
234242
}
243+
compatible_with_all_imports = compatible_with_all_imports && m_compatible;
235244
}
236-
compatible_with_all_imports = compatible_with_all_imports && m_compatible;
237245
}
238246

239247
any_rsc_changed = any(m <- component, rsc_changed() in ms.status[m]);

src/org/rascalmpl/core/library/lang/rascalcore/check/TestConfigs.rsc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,22 @@ public RascalCompilerConfig getAllSrcCompilerConfig(bool compiler=true){
114114
return rascalCompilerConfig(getAllSrcPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
115115
}
116116

117+
// ----
118+
public PathConfig getAllSrcREPOPathConfig(bool compiler = true) {
119+
return makePathConfig(COMPILED_RASCAL,
120+
[ REPO + "rascal/src/org/rascalmpl/library",
121+
REPO + "rascal/test/org/rascalmpl/benchmark/",
122+
REPO + "rascal-core/src/org/rascalmpl/core/library",
123+
REPO + "typepal/src"
124+
],
125+
[ ],
126+
compiler=compiler);
127+
}
128+
129+
public RascalCompilerConfig getAllSrcREPOCompilerConfig(bool compiler=true){
130+
return rascalCompilerConfig(getAllSrcREPOPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
131+
}
132+
// ----
117133
public PathConfig getAllSrcWritablePathConfig(bool compiler = true) {
118134
TMP_RASCAL = |tmp:///rascal/|;
119135
TMP_RASCAL_CORE = |tmp:///rascal-core/|;
@@ -190,11 +206,11 @@ public RascalCompilerConfig getRascalCoreCompilerConfig(bool compiler=true){
190206
* has the standard library and typepal on the library path, in case you accidentally want to test a module in rascal-core which depends on typepal.
191207
* Included projects: rascal-tutor, flybytes, rascal-lsp
192208
}
193-
public PathConfig getRascalCorePathConfigDev() {
209+
public PathConfig getRascalCorePathConfigDev(bool compiler = false) {
194210
return makePathConfig(RASCAL_CORE, [ RASCAL_CORE ], [ RASCAL, TYPEPAL ], compiler=compiler);
195211
}
196212

197-
public RascalCompilerConfig getRascalCoreCompilerConfigDev(){
213+
public RascalCompilerConfig getRascalCoreCompilerConfigDev(bool compiler=true){
198214
return rascalCompilerConfig(getRascalCorePathConfigDev())[verbose = true][logWrittenFiles=true];
199215
}
200216

@@ -236,7 +252,7 @@ public RascalCompilerConfig getSalixCompilerConfig(bool compiler = true){
236252

237253
// ---- drambiguity -----------------------------------------------------------
238254

239-
public PathConfig getDrAmbiguityPathConfig() {
255+
public PathConfig getDrAmbiguityPathConfig(bool compiler = false) {
240256
return makePathConfig(DRAMBIGUITY,
241257
[ DRAMBIGUITY, SALIX_CORE + "src/main/rascal" ],
242258
[ RASCAL ],

0 commit comments

Comments
 (0)