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
interpreter crash with abstract types and pattern matching #3755
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3755?orig=1
|
James Deikun (jdeikun) said: $$ scala-2.8.0.final/bin/scala -version
Scala code runner version 2.8.0.final -- Copyright 2002-2010, LAMP/EPFL
$$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-4ubuntu3~9.04.2)
OpenJDK Server VM (build 16.0-b13, mixed mode) |
Ben Hardy (benhardy) said: case class Gender(rep:String) {
override def toString = rep
}
case class Male extends Gender("Male")
case class Female extends Gender("Female") In both 2.8.0 and 2.9.0 the output looks like this: $$ ./scala -deprecation
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.
scala> case class Gender(rep:String) {
| override def toString = rep
| }
defined class Gender
scala> case class Male extends Gender("Male")
<console>:1: warning: case classes without a parameter list have been deprecated;
use either case objects or case classes with `()' as parameter list.
case class Male extends Gender("Male")
^
<console>:7: warning: case classes without a parameter list have been deprecated;
use either case objects or case classes with `()' as parameter list.
case class Male extends Gender("Male")
^
<console>:7: warning: case class `class Male' has case class ancestor `class Gender'.
This has been deprecated for unduly complicating both usage and implementation.
You should instead use extractors for pattern matching on non-leaf nodes.
case class Male extends Gender("Male")
^
defined class Male
scala> case class Female extends Gender("Female")
<console>:1: warning: case classes without a parameter list have been deprecated;
use either case objects or case classes with `()' as parameter list.
case class Female extends Gender("Female")
^
<console>:7: warning: case classes without a parameter list have been deprecated;
use either case objects or case classes with `()' as parameter list.
case class Female extends Gender("Female")
^
<console>:7: warning: case class `class Female' has case class ancestor `class Gender'.
This has been deprecated for unduly complicating both usage and implementation.
You should instead use extractors for pattern matching on non-leaf nodes.
case class Female extends Gender("Female")
^ 2.8.0 stacktrace here: [http://pastebin.com/JT8kbBrX] |
@adriaanm said: |
With the attached source file's classes in the classpath, this fails:
(The interpreter has crashed here.)
This succeeds further, but still fails:
More:
Spelling out t's definition works the same as t. Everything seems to work fine if you uncomment the return type for example in the source.
The text was updated successfully, but these errors were encountered: