Skip to content
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

make lub take lower bounds on method type params into account #5548

Open
scabug opened this issue Mar 5, 2012 · 3 comments
Open

make lub take lower bounds on method type params into account #5548

scabug opened this issue Mar 5, 2012 · 3 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) infer lub
Milestone

Comments

@scabug
Copy link

scabug commented Mar 5, 2012

this should compile since lub(T, U) = S (since T <: S and U <: S)

abstract class Foo[T] {
  val x: T
  def foo[S >: T]: List[S] = { // T <: S
    def z : U forSome {type U <: S} = ??? // U <: S
    List(x, z)
  }
}
@scabug
Copy link
Author

scabug commented Mar 5, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5548?orig=1
Reporter: @adriaanm

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@scala scala deleted a comment from scabug Mar 2, 2018
@SethTisue
Copy link
Member

SethTisue commented Mar 24, 2023

not sure whether to label with "fixed in Scala 3", since Scala 3 dropped forSome. Can the underlying issue here be encoded another way?

@Jasper-M
Copy link
Member

Doesn't compile in Scala 2 but does in Scala 3:

abstract class Foo[T] {
  val x: T
  def foo[S >: T]: List[S] = { // T <: S
    def z : Some[_ <: S] = ??? // U <: S
    List(x, z.get)
  }
}

👍

@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) infer lub
Projects
None yet
Development

No branches or pull requests

3 participants