rascal icon indicating copy to clipboard operation
rascal copied to clipboard

TModel contents are inconsistent for some kinds of IDs

Open toinehartman opened this issue 8 months ago • 0 comments

Describe the bug

The TModel contains information about definitions, uses, and types in a module. Generally, any name has a definition and uses of that name map to the definition. For some names in Rascal, this is not consistent with all others.

To Reproduce

@bootstrapParser

module TModelAnomalies

import lang::rascalcore::check::Checker;
import lang::rascalcore::check::BasicRascalConfig;

import lang::rascal::\syntax::Rascal;

import IO;
import ParseTree;
import Relation;

import util::Reflective;

TModel typeCheck(str moduleBody, str moduleName = "M") {
    contents = "
        'module <moduleName>
        '<moduleBody>";
    println("Module:\n---------------------------------------------------<parse(#start[Module], contents)>\n---------------------------------------------------\n");

    projLoc = |memory://tests/tmodels|;
    pcfg = pathConfig(srcs = [projLoc + "rascal"], resources = projLoc + "target");
    writeFile(pcfg.srcs[0] + "<moduleName>.rsc", contents);

    ccfg = rascalCompilerConfig(pcfg);
    ms = rascalTModelForNames([moduleName], ccfg, dummy_compile1);
    <found, tm, ms> = getTModelForModule(moduleName, ms);
    if (!found) throw "No TModel! <ms.messages>";

    return tm;
}

Expected behavior Definitions and uses consistently for each kind of identifier. No uses at definition name sites. See sub-issues for specifics.

Desktop (please complete the following information):

  • Context: Eclipse plugin, Commandline REPL
  • Rascal Version: 0.41.0-RC10, Rascal Core 0.12.16

toinehartman avatar Mar 03 '25 15:03 toinehartman