-
Notifications
You must be signed in to change notification settings - Fork 20
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
version based error recovery #811
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the parser encounters a language item that is not
enabled
/reserved
in the current language version, it currently doesn't attempt to parse it, and eventually entering error recovery:EnumVariant
sField
sPrimaryExpression
Keyword
For example, for Optional
Field
s that are not legal in the current version, instead of skipping, we can still attempt parsing it, and if successful, produce the complete tree, along with an error about versioning. It is a very common case of errors for end users, and a core goal of the DSL v2 to enable:Expected Foo or Bar or Baz
, we will produce meaningful/actionable errors:Foo is not valid in the current language version 'XXX'. It requires language version 'YYY' or above
.I suspect
EnumVariant
s and OptionalField
s have the biggest impact. We can experiment/start with that. That means instead of this:With the errors API we will have by #804, we can switch this bit around:
Open Questions
reason: String
field toVersionSpecifier::Never
, and use it to "manually guide" error recovery. For example, adding anEventDefinition
underSourceUnitMember
withVersionSpecifier::Never(reason = "Events are only valid inside contracts")
.The text was updated successfully, but these errors were encountered: