Skip to content

Modules with Same Name as Grammar Modules Can Cause Verify Failure #2580

@mahills

Description

@mahills

If a module in another project that imports Rascal accidentally shares a name with a module from lang::rascal::grammar::definition a failure is reported when running mvn verify. This was originally triggered in the PHP AiR project with a short module named Names: https://github.com/cwi-swat/php-analysis/blob/main/src/main/rascal/lang/php/syntax/Names.rsc

Changing the module name to Namess removes the error, while changing it to Literals again triggers the error:

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< org.rascalmpl:php-analysis >---------------------
[INFO] Building php-analysis 0.3.3-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] Parameter 'srcIgnores' is unknown for plugin 'rascal-maven-plugin:0.30.0:compile (rascal-compile)'
[WARNING] Parameter 'srcIgnores' is unknown for plugin 'rascal-maven-plugin:0.30.0:package (rascal-package)'
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ php-analysis ---
[INFO] Copying 1 resource from  to target/classes
[INFO] Copying 110 resources from src/main/rascal to target/classes
[INFO] 
[INFO] --- compiler:3.8.0:compile (default-compile) @ php-analysis ---
[INFO] No sources to compile
[INFO] 
[INFO] --- rascal:0.30.0:compile (rascal-compile) @ php-analysis ---
[INFO] Checking if any files need compilation...
[INFO] The Rascal runtime was resolved at /Users/hillsma/.m2/repository/org/rascalmpl/rascal/0.41.1-RC2-SNAPSHOT/rascal-0.41.1-RC2-SNAPSHOT.jar
Job: loading modules
Job: loading modules
Job: Generating parser;
Job: Compiling lang::php::util::Option lang::php::analysis::evaluators::MagicConstants lang::php::ast::NormalizeAST lang::php::stats::Overall lang::php::pp::PrettyPrinter lang::php::analysis::cfg::LabelState lang::php::analysis::signatures::Signatures lang::php::analysis::includes::MatchIncludes lang::php::analysis::callgraph::SimpleCG lang::php::analysis::signatures::Extract lang::php::analysis::cfg::Util lang::php::analysis::usedef::UseDef lang::php::analysis::composer::ComposerAnalysis lang::php::stats::SLOC lang::php::analysis::signatures::Summaries lang::php::util::Constants lang::php::analysis::evaluators::AlgebraicSimplification lang::php::util::Utils lang::php::analysis::slicing::BasicSlicer lang::php::analysis::composer::Composer lang::php::analysis::cfg::CFG lang::php::ast::System lang::php::analysis::evaluators::SimulateCalls lang::php::analysis::cfg::FlowEdge lang::php::semantics::concrete::Value lang::php::util::CLOC lang::php::semantics::shared::Value lang::php::analysis::includes::IncludesInfo lang::php::types::Types lang::php::stats::Stats lang::php::analysis::names::AnalysisNames lang::php::config::Config lang::php::stats::OOMetrics lang::php::analysis::includes::QuickResolve lang::php::semantics::concrete::PHP lang::php::analysis::evaluators::DefinedConstants lang::php::semantics::shared::StoreModel lang::php::analysis::includes::ScriptResolve lang::php::analysis::signatures::BuiltIns lang::php::syntax::Literals lang::php::analysis::evaluators::Simplify lang::php::semantics::abstract::PHP lang::php::util::RepoUtils lang::php::analysis::cfg::BuildCFG lang::php::util::Corpus lang::php::analysis::includes::LibraryIncludes lang::php::analysis::composer::VersionSyntax lang::php::analysis::cfg::Visualize lang::php::analysis::cfg::BasicBlocks lang::php::analysis::cfg::Label lang::php::analysis::includes::NormalizeConstCase lang::php::analysis::includes::IncludeGraph lang::php::metrics::CC lang::php::stats::Unfriendly lang::php::stats::PrepStats lang::php::analysis::NamePaths lang::php::ast::AbstractSyntax lang::php::util::LocUtils
"No module scope found for Literals"
	at getModuleScope(|jar+file:///Users/hillsma/.m2/repository/org/rascalmpl/rascal/0.41.1-RC2-SNAPSHOT/rascal-0.41.1-RC2-SNAPSHOT.jar!/org/rascalmpl/compiler/lang/rascalcore/check/Import.rsc|(16325,390,<373,0>,<383,1>))
	at doSaveModule(|jar+file:///Users/hillsma/.m2/repository/org/rascalmpl/rascal/0.41.1-RC2-SNAPSHOT/rascal-0.41.1-RC2-SNAPSHOT.jar!/org/rascalmpl/compiler/lang/rascalcore/check/Import.rsc|(19051,94,<431,23>,<431,117>))
	at rascalTModelForLocs(|jar+file:///Users/hillsma/.m2/repository/org/rascalmpl/rascal/0.41.1-RC2-SNAPSHOT/rascal-0.41.1-RC2-SNAPSHOT.jar!/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc|(15193,95,<358,21>,<358,116>))
	at check(|jar+file:///Users/hillsma/.m2/repository/org/rascalmpl/rascal/0.41.1-RC2-SNAPSHOT/rascal-0.41.1-RC2-SNAPSHOT.jar!/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc|(22872,64,<561,9>,<561,73>))
	at main(|jar+file:///Users/hillsma/.m2/repository/org/rascalmpl/rascal/0.41.1-RC2-SNAPSHOT/rascal-0.41.1-RC2-SNAPSHOT.jar!/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc|(25851,29,<637,19>,<637,48>))
	at lang::rascalcore::check::Checker(|main:///lang/rascalcore/check/Checker|[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:55 min
[INFO] Finished at: 2025-12-22T16:14:57-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.rascalmpl:rascal-maven-plugin:0.30.0:compile (rascal-compile) on project php-analysis: error launching org.rascalmpl.shell.RascalCompile: org.rascalmpl.shell.RascalCompile exited with error code 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The error, specifically, is in getModuleScope inside the checker. I have not been able to reproduce this in a new project, this may be a project configuration issue in PHP AiR, but the error is unexpected to say the least. To reproduce this, clone the PHP AiR project, then run mvn clean compile followed by mvn package and then mvn verify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions