Skip to content

spurious unchecked warning due to non-local return #13096

Open
@lrytz

Description

@lrytz
trait H[T]

class T {
  def m(): H[_] = {
    for (f <- Nil)
      return null.asInstanceOf[H[_]]
    null
  }
}

Warns

/Users/luc/code/scala/scala13/sandbox/T.scala:3: warning: non-variable type argument H[_$1] @unchecked forSome { type _$1 } in type pattern scala.runtime.NonLocalReturnControl[H[_$1] @unchecked forSome { type _$1 }] is unchecked since it is eliminated by erasure
class T {
        ^

The position of the warning at the enclosing class makes it hard to silence.

Similar to #5927, but that one is fixed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions