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

implicitNotFound annotation is not inherited #10098

Closed
prolativ opened this issue Oct 27, 2020 · 1 comment
Closed

implicitNotFound annotation is not inherited #10098

prolativ opened this issue Oct 27, 2020 · 1 comment

Comments

@prolativ
Copy link
Contributor

Minimized code

@annotation.implicitNotFound("There's no Foo1")
trait Foo1

@annotation.implicitNotFound("There's no Foo2")
trait Foo2

trait Bar12 extends Foo1 with Foo2

trait Bar21 extends Foo2 with Foo1

object Bar {
  implicitly[Bar12]
  implicitly[Bar21]
}

Output

no implicit argument of type Bar12 was found for parameter ev of method implicitly in object DottyPredef

no implicit argument of type Bar21 was found for parameter ev of method implicitly in object DottyPredef

Expectation

There's no Foo2

There's no Foo1

According to the comment on scala.annotation.implicitNotFound:

The annotation is effectively inherited by subtypes if they are not annotated.

In scala 2.13 this works as described. Although not explicitly documented, the order of inheritance is taken into account there and it makes sense to keep this behaviour.

@odersky
Copy link
Contributor

odersky commented Oct 28, 2020

I agree we should follow scala 2.13's behavior here.

@smarter smarter closed this as completed in e5a1da5 Nov 6, 2020
smarter added a commit that referenced this issue Nov 6, 2020
Fix #10098: Handle inheritance for implicitNotFound annotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants