Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undeclared top-level issue #2550

Open
MikaelMayer opened this issue Aug 4, 2022 · 1 comment
Open

Undeclared top-level issue #2550

MikaelMayer opened this issue Aug 4, 2022 · 1 comment
Labels
area: error-reporting Clarity of the error reporting

Comments

@MikaelMayer
Copy link
Member

The following code

type Foo

module bar {
  class C {
    var baz : Foo
  }
}

produces the error

Type Error Error
(6,14): Error: Undeclared top-level type or type parameter: Foo (did you forget to qualify a name or declare a module import 'opened'?) 

In this particular case, the error message should not mention "undeclared top-level type" because it assumes Dafny looked into the top-level types and could not see Foo, but it's a top-level type.
Here are the alternatives on how we could fix it:

  • Remove "top-level" from the error message
  • Reverse the importing rule for the top-level module: children of a top-level module should be able to import their default parent module's definitions
  • Add the message (also, children can't import the definitions of their parents)
@MikaelMayer MikaelMayer added the area: error-reporting Clarity of the error reporting label Aug 4, 2022
@cpitclaudel
Copy link
Member

Remove "top-level" from the error message

I think top-level here means "unqualified" (so it's the use of Foo that's "top-level", not its definition)
(I don't find it very clear and I like the idea of removing it)

davidcok pushed a commit to davidcok/dafny that referenced this issue Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: error-reporting Clarity of the error reporting
Projects
None yet
Development

No branches or pull requests

2 participants