-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #10082: show friendly error message related to type inference #10100
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
Conversation
@@ -509,6 +509,8 @@ trait Inferencing { this: Typer => | |||
// required: String | |||
// val y: List[List[String]] = List(List(1)) | |||
val hasUnreportedErrors = state.reporter.hasUnreportedErrors | |||
if hasUnreportedErrors then return tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@odersky Any reason we previously still instantiated some type variables when hasUnreportedErrors is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see a reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
@@ -509,6 +509,8 @@ trait Inferencing { this: Typer => | |||
// required: String | |||
// val y: List[List[String]] = List(List(1)) | |||
val hasUnreportedErrors = state.reporter.hasUnreportedErrors | |||
if hasUnreportedErrors then return tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see a reason.
@@ -509,6 +509,8 @@ trait Inferencing { this: Typer => | |||
// required: String | |||
// val y: List[List[String]] = List(List(1)) | |||
val hasUnreportedErrors = state.reporter.hasUnreportedErrors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to define a local variable, it seems. We can simply return if state.reporter.hasUnreportedErrors
is true.
The type `site` in class `NotAMember` might be an uninitialized type variable, but is initialized when we display the error message. It results in confusing error message as in scala#10082. We avoid instantiating the type variable when there is a unreported error in current typerstate.
Fix #10082: show friendly error message related to type inference