Skip to content

Odd type error in 2.6.0-RC2. #44

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

Closed
scabug opened this issue Aug 31, 2007 · 4 comments
Closed

Odd type error in 2.6.0-RC2. #44

scabug opened this issue Aug 31, 2007 · 4 comments
Assignees

Comments

@scabug
Copy link

scabug commented Aug 31, 2007

Compiling the following code:

trait X {
    case class Foo();
    object Bar {
       def unapply(foo:Foo):Boolean = false;
    }
}
object Y extends X {
   val foo = Foo()
   foo match {
     case Bar() => println("matched bar!");
   }
}

produces a type mismatch with the following message:

<console>:8: error: type mismatch;
found   : Y.this.Foo
required: X.this.Foo
     case Bar() => println("matched bar!");
          ^

But if instead of an object, we make a subclass with the same exact code, as in:

class Z extends X {
   val foo = Foo()
   foo match {
     case Bar() => println("matched bar!");
   }
}

It compiles and runs normally.

Also, the same code does not present any errors either in 2.6.0-RC1 or in 2.5.1.

@scabug
Copy link
Author

scabug commented Aug 31, 2007

Imported From: https://issues.scala-lang.org/browse/SI-44?orig=1
Reporter: Commit Message Bot (anonymous)

@scabug
Copy link
Author

scabug commented Sep 4, 2007

@odersky said:
Why has the bug been assigned to me? Is there any evidence it is my changes between RC1 and RC2 that did this? I don�t think I did any unapply-related changes.

-- Martin

@scabug
Copy link
Author

scabug commented Sep 4, 2007

@burakemir said:
my bad. fixed in r12795. the original changes were fixes for Philipp's unapply bugs, i verified that these still work with test cases unapplyVal.scala (hopefully they cover enough).

@scabug
Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone 2.6.0 deleted

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

No branches or pull requests

2 participants