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

Implicit chain broken for Nothing type #4982

Open
scabug opened this issue Sep 9, 2011 · 2 comments
Open

Implicit chain broken for Nothing type #4982

scabug opened this issue Sep 9, 2011 · 2 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) implicit infer
Milestone

Comments

@scabug
Copy link

scabug commented Sep 9, 2011

Is Nothing type something special..?

class ImplicitChainForNothingTezt {
    
    trait Foo[x]
    
    object Foo {
        implicit val ofInt: Foo[Int] = new Foo[Int] {}
        implicit val ofUnit: Foo[Unit] = new Foo[Unit] {}
        implicit val ofNothing: Foo[Nothing] = new Foo[Nothing] {}
    }
    
    trait MyList[+a]
    
    object MyList {
        implicit def asFoo[a](implicit i: Foo[a]): Foo[MyList[a]] = new Foo[MyList[a]] {}
    }
    
    implicitly[Foo[Int]] // ok
    implicitly[Foo[Unit]] // ok
    implicitly[Foo[Nothing]] // ok
    implicitly[Foo[MyList[Int]]] // ok
    implicitly[Foo[MyList[Unit]]] // ok
    implicitly[Foo[MyList[Nothing]]] // could not find implicit value for parameter e: ImplicitChainForNothingTezt.this.Foo[ImplicitChainForNothingTezt.this.MyList[Nothing]]

}
@scabug
Copy link
Author

scabug commented Sep 9, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4982?orig=1
Reporter: @okomok
Affected Versions: 2.9.1

@scabug
Copy link
Author

scabug commented Oct 29, 2011

@paulp said:
Nothing is indeed used specially internally, which has caused quite a range of less than desirable things. Adriaan and I have worked on it and have a partial fix, but the complete fix is somewhat challenging because of Nothing's widespread internal usage.

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/) implicit infer
Projects
None yet
Development

No branches or pull requests

2 participants