diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst3.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst3.rsc index 0220f6e3..be1b4188 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst3.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst3.rsc @@ -1 +1,47 @@ module lang::rascalcore::compile::Examples::Tst3 +import lang::rascalcore::check::Checker; +import lang::rascalcore::check::BasicRascalConfig; +import lang::rascalcore::check::RascalConfig; +import IO; +import Message; +import util::FileSystem; +import util::Reflective; + +tuple[PathConfig, RascalCompilerConfig] testConfigs(loc projectPath) { + pcfg = pathConfig( + bin=projectPath + "bin", + libs=[|jar+file:///Users/paulklint/.m2/repository/org/rascalmpl/rascal/0.40.8/rascal-0.40.8.jar!/|], + srcs=[projectPath + "src"], + resources=projectPath + "resources", + generatedSources=projectPath + "generated-sources" + ); + + RascalCompilerConfig ccfg = rascalCompilerConfig(pcfg) + [forceCompilationTopModule = true] + [verbose = true]; + + return ; +} + +void checkModule(loc projectPath, str moduleName, str moduleBody, RascalCompilerConfig ccfg) { + modulePath = projectPath + "src" + ".rsc"; + writeFile(modulePath, moduleBody); + msgs = check([modulePath], ccfg); + iprintln(msgs); +} + +void sameNameImportResolutionBug(loc projectPath = |memory:///TestModule|, bool skipFirst = false) { + remove(projectPath); + = testConfigs(projectPath); + + if (!skipFirst) { + println("*** Checking first version:"); + checkModule(projectPath, "A", "module A", ccfg); + } + + println("*** Checking second version:"); + + // Unexpected 'undefined module' error + // Only occurs if a TPL without that import already exists + checkModule(projectPath, "A", "module A\nimport Exception;", ccfg); +} \ No newline at end of file