Skip to content

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 15, 2025

No description provided.

@odersky odersky force-pushed the reassignment-errormsg branch from 19342cf to 09086bf Compare October 15, 2025 07:20
def booleanExpected = pt.isRef(defn.BooleanClass)
def booleanNote =
if booleanExpected then
". Maybe you meant to write an equality test using `==`?"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or, for example, I intended to do <= for integers. I agree that having suggestions helps but I don't see where we draw the line for them. Going further, we could investigate further based on the types of lhs and rhs and suggest all the (2 characters methods ending (and starting?) with = that are compatible members)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, just what did you mean would suggest for selections. did you mean Int.!=? or perhaps Int.<=? etc.

Copy link
Contributor Author

@odersky odersky Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely not. The suggestion is for a beginner who comes from a context where = means equality. We have to special case for this and not pollute the message with other suggestions.

We just had a talk here were someone proposed to introduce an educational subset of Scala because the students were too much put off by the current error message. That's the issue this PR addresses.

@som-snytt
Copy link
Contributor

There is an aging improvement at #22869

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants