Aladdin - Scala Bugtracking
[#263] project: specification priority: high category: bug
submitter assigned to status date submitted
Stephane Martin won't fix 2003-12-19 19:24:10.0
subject Type mismatch error with wildcard import
code
object Foo {
  val BAR = new Bar();
}

class Bar {
  import Foo._; // import Foo.BAR; is OK !!!

  match {
    case BAR => 0
  }

}
what happened
bug.scala:9: type mismatch;
 found   : Bar
 required: Foo
    case BAR => 0
         ^
one error found
what expected no runtime error !
[back to overview]
Changes of this bug report
Martin  edited on  2004-01-05 13:21:51.0
This is actually OK. Note that `match' is a method of Foo as well as of Bar. By the import Foo._, you have imported it and made it available in unqualified form. Unfortunately, this hides the `match' in Bar. I agree it's a potential trap to fall into. Not yet sure how to fix it though.
Martin  edited on  2004-01-05 14:59:05.0