-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)typer
Milestone
Description
From StackOverflow: http://stackoverflow.com/questions/17559687/compile-time-constraints-on-the-order-of-function-composition-in-scala
Compilation fails for a method that explicitly declares a return a type with a compound type parameter, but succeeds and infers the same type when the return type is not explicitly declared:
scala> trait Foo[A] { def bar[B](b: B): Foo[A with B] }
defined trait Foo
scala> def baz[A](foo: Foo[A]) = foo bar 1
baz: [A](foo: Foo[A])Foo[A with Int]
scala> def baz[A](foo: Foo[A]): Foo[A with Int] = foo bar 1
<console>:8: error: type mismatch;
found : Int(1)
required: Nothing
def baz[A](foo: Foo[A]): Foo[A with Int] = foo bar 1
^Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)typer