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

Higher-kinded implicit conversion with type aliasing has type mismatch error #10372

Closed
soronpo opened this issue Jun 15, 2017 · 0 comments
Closed

Comments

@soronpo
Copy link

soronpo commented Jun 15, 2017

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)
}
TomasMikula added a commit to TomasMikula/scala that referenced this issue Sep 12, 2017
Can cause ambiguous implicits, so is under a compiler flag
-Yhk-typevar-unification.

Fixes scala/bug#10197
Fixes scala/bug#10213
Fixes scala/bug#10238
Fixes scala/bug#10372
Presents an alternative fix to scala/bug#6895.
TomasMikula added a commit to TomasMikula/scala that referenced this issue Sep 14, 2017
Can cause ambiguous implicits, so is under a compiler flag
-Yhk-typevar-unification.

Fixes scala/bug#10197
Fixes scala/bug#10213
Fixes scala/bug#10238
Fixes scala/bug#10372
Presents an alternative fix to scala/bug#6895.
TomasMikula added a commit to TomasMikula/scala that referenced this issue Sep 26, 2017
Can cause ambiguous implicits, so is under a compiler flag
-Yhk-typevar-unification.

Fixes scala/bug#10197
Fixes scala/bug#10213
Fixes scala/bug#10238
Fixes scala/bug#10372
Presents an alternative fix to scala/bug#6895.
TomasMikula added a commit to TomasMikula/scala that referenced this issue Sep 27, 2017
Can cause ambiguous implicits, so is under a compiler flag
-Yhk-typevar-unification.

Fixes scala/bug#10197
Fixes scala/bug#10213
Fixes scala/bug#10238
Fixes scala/bug#10372
Presents an alternative fix to scala/bug#6895.
TomasMikula added a commit to TomasMikula/scala that referenced this issue Sep 27, 2017
Can cause ambiguous implicits, so is under the compiler flag
-Xsource:2.13

Fixes scala/bug#10185
Fixes scala/bug#10195
Fixes scala/bug#10197
Fixes scala/bug#10213
Fixes scala/bug#10238
Fixes scala/bug#10372
Presents an alternative fix to scala/bug#6895.
TomasMikula added a commit to TomasMikula/scala that referenced this issue Sep 27, 2017
Can cause ambiguous implicits, so is under the compiler flag
-Xsource:2.13

Fixes scala/bug#10185
Fixes scala/bug#10195
Fixes scala/bug#10197
Fixes scala/bug#10213
Fixes scala/bug#10238
Fixes scala/bug#10372
Presents an alternative fix to scala/bug#6895.
TomasMikula added a commit to TomasMikula/scala that referenced this issue Sep 28, 2017
Can cause ambiguous implicits, so is under the compiler flag
-Xsource:2.13

Fixes scala/bug#10185
Fixes scala/bug#10195
Fixes scala/bug#10197
Fixes scala/bug#10213
Fixes scala/bug#10238
Fixes scala/bug#10372
Presents an alternative fix to scala/bug#6895.
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

1 participant