-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Checkout DoesNotCompile vs Compiles1 and Compile2.
The higherKinds is somehow related since the if Func has no arguments, the code also compiles.
This code compiles in Dotty.
Possibly related bug: #10197
Scalac run in scastie: https://scastie.scala-lang.org/0nFlyoRDSRiOqdp2XsGbJQ
Dotty run in scastie: https://scastie.scala-lang.org/soronpo/7qttyh67RsmTUoQ8mHlBkw
import scala.language.higherKinds
import scala.language.implicitConversions
class Expected[T, Func[_]]
implicit def conv[T, Func[_]](i : Int) : Expected[T, Func] = ???
type FuncId[T] = T
object DoesNotCompile {
class Bla {
type Alias[T] = Expected[T, FuncId]
def bla[T](expected : Alias[T]) : Unit = {}
}
(new Bla).bla(2) //type mismatch
}
object Compiles1 { //Compiles with alias placed in different scope
type Alias[T] = Expected[T, FuncId]
class Bla {
def bla[T](expected : Alias[T]) : Unit = {}
}
(new Bla).bla(2)
}
object Compiles2 { //Compiles if the call to `bla` is separated from object creation
class Bla {
type Alias[T] = Expected[T, FuncId]
def bla[T](expected : Alias[T]) : Unit = {}
}
val a = new Bla
a.bla(2)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels