Opened 11 years ago

Closed 6 years ago

Last modified 6 years ago

#2321 closed defect (worksforme)

Better import error message for named imports

Reported by: Per Östlund Owned by: Per Östlund
Priority: low Milestone: 2.0.0
Component: New Instantiation Version: trunk
Keywords: Cc:

Description

If a named import uses a name that does not exist, e.g.

model M
  import B = A;
end M;

you get an error message:

Import A not found in scope .

This could be improved by:

  • Use the full import, import B = A, in the error message.
  • Either print out the correct scope, or no scope at all.

Change History (3)

comment:1 by Francesco Casella, 7 years ago

Milestone: Future2.0.0

comment:2 by Francesco Casella, 6 years ago

Resolution: worksforme
Status: newclosed

I just tried this with v1.13.0-dev-798-g1c8bb86de, both old and new FE, and I got them both to compile.

Honestly, I don't see a problem with this as long as the imported name B is not used...

in reply to:  2 comment:3 by Per Östlund, 6 years ago

Replying to casella:

Honestly, I don't see a problem with this as long as the imported name B is not used...

Yeah, the NF only resolves imported names the first time they're used. And if the import isn't used it doesn't matter what it points to.

And for the record, if the import is used the NF will now print an error message with the correct scope. It just so happens that the scope is always <top> since imports are always looked up in the top scope, so it's kind of redundant but still correct.

Note: See TracTickets for help on using tickets.