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

Commit fad3f35

Browse files
committed
Getting fixes for errors correct
1 parent 89b6e0c commit fad3f35

File tree

4 files changed

+59
-27
lines changed

4 files changed

+59
-27
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
<dependency>
244244
<groupId>org.rascalmpl</groupId>
245245
<artifactId>rascal</artifactId>
246-
<version>0.40.17</version>
246+
<version>0.40.18-SNAPSHOT</version>
247247
</dependency>
248248
</dependencies>
249249
</project>

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

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -463,30 +463,42 @@ loc rascalCreateLogicalLoc(Define def, str _modelName, PathConfig pcfg){
463463
return def.defined;
464464
}
465465
466+
@memo
467+
rel[str shortName, str longName] getModuleNames(PathConfig pcfg){
468+
longNames = {};
469+
for(srcdir <- pcfg.srcs){
470+
for(loc mloc <- find(srcdir, "rsc")){
471+
try {
472+
longName = getModuleName(mloc, pcfg);
473+
longNames += <asBaseModuleName(longName), longName>;
474+
} catch _: ;
475+
}
476+
}
477+
for(libdir <- pcfg.libs){
478+
for(loc mloc <- find(libdir, "tpl")){
479+
try {
480+
longName = getModuleName(mloc, pcfg);
481+
longNames += <asBaseModuleName(longName), longName>;
482+
} catch _: ;
483+
}
484+
}
485+
return longNames;
486+
}
487+
466488
list[str] rascalSimilarNames(Use u, TModel tm){
467489
w = getOrgId(u);
468490
nw = size(w);
469491
idRoles = u.idRoles;
470492
pcfg = tm.config.typepalPathConfig;
471-
vocabulary = {};
472-
longNames = {};
473493
if(moduleId() in idRoles){
474-
for(srcdir <- pcfg.srcs){
475-
for(loc mloc <- find(srcdir, "rsc")){
476-
try {
477-
longName = getModuleName(mloc, pcfg);
478-
shortName = asBaseModuleName(longName);
479-
vocabulary += shortName;
480-
longNames += <shortName, longName>;
481-
} catch _: ;
482-
}
483-
}
494+
longNames = getModuleNames(pcfg);
495+
similar = similarWords(w, domain(longNames), tm.config.cutoffForNameSimilarity)[0..10];
496+
return sort({*longNames[s] | s <- similar }, bool (str a, str b) { return size(a) < size(b); });
484497
} else {
485498
vocabulary = { d.orgId | d <- tm.defines, d.idRole in idRoles, isContainedIn(u.occ, d.scope) };
499+
similar = similarWords(w, vocabulary, tm.config.cutoffForNameSimilarity)[0..10];
500+
return sort(similar, bool (str a, str b) { return a < b; });
486501
}
487-
//println("similarNames: <u>, <idRoles>, <vocabulary>");
488-
similar = similarWords(w, vocabulary, tm.config.cutoffForNameSimilarity)[0..10];
489-
return [ *sort(longNames[s], bool (str a, str b) { return size(a) < size(b); }) | s <- similar ];
490502
}
491503
492504
RascalCompilerConfig rascalCompilerConfig(PathConfig pcfg,

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,26 @@ public RascalCompilerConfig getPHPCompilerConfig(PathConfig pcfg){
284284
public RascalCompilerConfig getPHPCompilerConfig(){
285285
return rascalCompilerConfig(getPHPPathConfig());
286286
}
287+
288+
// ---- VSCode-----------------------------------------------------------------
289+
290+
public PathConfig getVSCodePathConfig() {
291+
return
292+
pathConfig(
293+
ignores=[],
294+
javaCompilerPath=[],
295+
bin=|target://rascal-core|,
296+
classloaders=[],
297+
libs=[
298+
|lib://rascal|,
299+
|target://typepal| ],
300+
srcs=[|file:///Users/paulklint/git/rascal-core/src/org/rascalmpl/core/library|]);
301+
}
302+
303+
public RascalCompilerConfig getVSCodeCompilerConfig(PathConfig pcfg){
304+
return rascalCompilerConfig(pcfg)[verbose = true][logWrittenFiles=true];
305+
}
306+
307+
public RascalCompilerConfig getVSCodeCompilerConfig(){
308+
return rascalCompilerConfig(getVSCodePathConfig());
309+
}
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
module lang::rascalcore::compile::Examples::Tst0
2-
3-
import ValueIO;
4-
import IO;
5-
6-
data D = d1(int n);
7-
8-
void main(){
9-
v = d1(42);
10-
writeBinaryValueFile(|home:///tmp.txt|, v);
11-
println("written <v>");
12-
}
2+
3+
4+
import Reflect;
5+
6+
int XX1 = 14 ;
7+
int XXX = 13;
8+
9+
int main() = XX;

0 commit comments

Comments
 (0)