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

Null pointer exception on underconstrained closures #2074

Closed
MikaelMayer opened this issue Apr 28, 2022 · 1 comment · Fixed by #2382
Closed

Null pointer exception on underconstrained closures #2074

MikaelMayer opened this issue Apr 28, 2022 · 1 comment · Fixed by #2382
Assignees
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: language server Support for LSP in Dafny (server part; client is in ide-vscode repo)

Comments

@MikaelMayer
Copy link
Member

MikaelMayer commented Apr 28, 2022

method m() {
  var f := st => set x | x in st;
}

To test it on the command-line:

echo "method m() { var f := st => set x | x in st; }" | ./Binaries/Dafny.exe -stdin

(1,17): Error: the type of this variable is underspecified
(1,36): Error: the type of this variable is underspecified
(1,32): Error: type of bound variable 'x' could not be determined; please
specify the type explicitly
Unhandled exception. System.AggregateException: One or more errors occurred. (Ob
ject reference not set to an instance of an object.)
---> System.NullReferenceException: Object reference not set to an instance of
an object.
at Microsoft.Dafny.Resolver.DiscoverAllBounds_Aux_SingleVar[VT](List1 bvars, Int32 j, Expression expr, Boolean polarity, List1 knownBounds) in dafny\Source\Dafny\Resolver\BoundsDiscovery.cs:line 197

The error is here:

          case BinaryExpr.ResolvedOpcode.InSeq:
            if (whereIsBv == 0) {
              bounds.Add(new ComprehensionExpr.SeqBoundedPool(e1, e0.Type, e1.Type.AsSeqType.Arg));
            }                                     //AsSeqType seems to return null ^^

After this crash, the IDE extension no longer processes any other Dafny code and crashes until the IDE is restarted

@MikaelMayer MikaelMayer added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: language server Support for LSP in Dafny (server part; client is in ide-vscode repo) labels Apr 28, 2022
@cpitclaudel cpitclaudel added the crash Dafny crashes on this input, or generates malformed code that can not be executed label May 7, 2022
@MikaelMayer
Copy link
Member Author

Good news, since recent changes, the issue is still there, but the LSP server is no longer stuck. I only displays the error in the diagnostics window, making it possible for the user to identify what is wrong by dissecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: language server Support for LSP in Dafny (server part; client is in ide-vscode repo)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants