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

fix: Crash in the parser. #2649

Merged
merged 4 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- feat: Support for the `{:opaque}` attibute on `const` (https://github.com/dafny-lang/dafny/pull/2545)
- feat: Support for plugin-based code actions on the IDE (https://github.com/dafny-lang/dafny/pull/2021)
- fix: Fixed a crash when parsing `newtype` in the parser (https://github.com/dafny-lang/dafny/pull/2649)
- fix: Added missing error reporting position on string prefix check (https://github.com/dafny-lang/dafny/pull/2652)
- fix: Check all compiled expressions to be compilable (https://github.com/dafny-lang/dafny/pull/2641)
- fix: Better error reporting on counter-examples if an option is not provided (https://github.com/dafny-lang/dafny/pull/2650)
Expand Down
5 changes: 4 additions & 1 deletion Source/Dafny/Dafny.atg
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,10 @@ NewtypeDecl<DeclModifierData dmod, ModuleDefinition module, out TopLevelDecl td>
td.StartToken = dmod.FirstToken;
td.EndToken = t;
.)
) (. td.TokenWithTrailingDocString = t; .)
) (. if (td != null) {
td.TokenWithTrailingDocString = t;
}
.)
.

/*------------------------------------------------------------------------*/
Expand Down
2 changes: 2 additions & 0 deletions Test/dafny0/ParseErrors.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,5 @@ module Older {
function method C(a: A, ghost older older b: B, nameonly ghost older nameonly ghost c: C := "hello"): int
twostate lemma L(nameonly older nameonly c: C := "hello") // error: 'older' is an identifier here
}

newtype T {}
3 changes: 2 additions & 1 deletion Test/dafny0/ParseErrors.dfy.expect
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ ParseErrors.dfy(255,32): Error: formal cannot be declared 'older' in this contex
ParseErrors.dfy(256,11): Error: formal cannot be declared 'older' in this context
ParseErrors.dfy(257,17): Error: formal cannot be declared 'older' in this context
ParseErrors.dfy(261,28): Error: formal cannot be declared 'older' in this context
76 parse errors detected in ParseErrors.dfy
ParseErrors.dfy(264,10): Error: invalid NewtypeDecl
77 parse errors detected in ParseErrors.dfy