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

Error if not an annotation #11428

som-snytt opened this Issue Mar 9, 2019 · 1 comment


None yet
2 participants
Copy link

som-snytt commented Mar 9, 2019

Consider this example:

import annotation.switch

class switch {
  def test(x: Int) = (x: @switch) match {
    case 1 | 2 | 3 => ()

Dotty reports:

-- [E007] Type Mismatch Error: tests/allan/Test.scala:4:25 ---------------------
4 |  def test(x: Int) = (x: @switch) match {
  |                         ^^^^^^^
  |                         found:    switch
  |                         required: scala.annotation.Annotation
one error found

And scalac

tests/allan/Test.scala:1: warning: imported `switch` is permanently hidden by definition of class switch
import annotation.switch
one warning found

I would say an error is warranted. One guess is that it was lost under scala/scala#1901.

Description copied from lampepfl/dotty#3617.

@SethTisue SethTisue added this to the Backlog milestone Mar 9, 2019


This comment has been minimized.

Copy link

som-snytt commented Mar 9, 2019

Related PR for related issue scala/scala#7546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.