Skip to content

Extractor vals don't work in interpreter #5

Closed
@scabug

Description

@scabug

Aladdin: [http://scala-webapps.epfl.ch/bugtracking/bugs/displayItem.do?id=1295 bug 1295], [http://scala-webapps.epfl.ch/bugtracking/contribs/display.do?id=770 contrib 770]

== Code ==

class X { def unapply(v : Int) = Some(v + 1) }
val q = new X
5 match { case q(x) => x }

== What happened ==

java.lang.ClassCastException:  cannot be cast to 

== What expected ==

Prints 6. This works in the compiler, and works in the interpreter if I use an object rather than class + val.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions