Closed scabug closed 13 years ago
Imported From: https://issues.scala-lang.org/browse/SI-1239?orig=1 Reporter: @djspiewak
@dragos said: Please add or attach a complete program exhibiting these errors. It would greatly increase the chances for a quick fix...
@TiarkRompf said: I'm afraid we can't do much without having a test case to reproduce the errors. So I'm closing this one for now.
Very strange things happen when I define a method: ==(...). Example definition:
The trick seems to be when defining == not to return of type Boolean. I'm afraid I don't have a minimal test case, but the end result is errors at seemingly-arbitrary (but consistent) points in the code. These points in code are never anywhere near a use of the == method or even any instance of the class which defines it. It seems that what happens is the parser makes certain assumptions about the == method and possibly inlines a few expressions or definitions. This is eventually passed on to the type checker, which recognizes that == does not return Boolean for that type. I'm assuming that odd error locations are due to whatever the parser is doing.
Sample error:
The == method is defined in a superclass of {Numeric, Binary}Expression and is defined to return a value of type BooleanExpression.