Skip to content

Spans that mix macro expansions with other expressions do not produce correct error messages #8

@liquidev

Description

@liquidev

Reproduction case:

if (`GameManager.GetCurrentMapFilename() ~= `GameManager.HubMapName)

Error message:

error: expression cannot be called
   ┌─ /home/daknus/Games/steamapps/common/HatinTime/Development/Src/HatinTimeGameContent/Globals.uci:3:21
   │  
 3 │   `define GameManager Hat_GameManager(class'WorldInfo'.static.GetWorldInfo().Game)
   │ ╭─────────────────────^
 4 │ │ `define NPCManager Hat_GameNPCManager(class'WorldInfo'.static.GetWorldInfo().Game)
 5 │ │ `define SaveManager Hat_SaveManager(class'Hat_SaveManager'.static.GetSaveManager(class'Hat_SaveManager'))
 6 │ │ `define MusicManager class'Hat_GameManager'.static.GetStaticMusicManager()
   │ ╰──────────────────────────────────────────────────────────────────────────^ this expression does not denote a function
   │  
   ┌─ mcu8_mods_NoMoreDwellerShit/Classes/mcu8_NMDS_Main.uc:19:41
   │
19 │         if (`GameManager.GetCurrentMapFilename() ~= `GameManager.HubMapName )
   │                                               --
   │                                               │ 
   │                                               this `(` begins a function call

which should look more like:

error: expression cannot be called
   ┌─ mcu8_mods_NoMoreDwellerShit/Classes/mcu8_NMDS_Main.uc:19:41
   │
19 │         if (`GameManager.GetCurrentMapFilename() ~= `GameManager.HubMapName )
   │             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--
   │                                             │ │ 
   │                                             │ this `(` begins a function call
   │                                             this expression does not denote a function

(not representative of what codespan-reporting would render)

For this we need some way for the preprocessor to tell the parser "hey, this should be the error reporting span" in addition to "hey, this is where you should source tokens to parse from." Perhaps even a way to link disjoint spans together, though I haven't thought about that very deeply yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions