@unchecked
pattern binding on type with unsupported isInstanceOf
fails compilation
#14896
Labels
Milestone
Compiler version
3.1.2 and 3.1.3-RC1-bin-20220407-31f871c-NIGHTLY
Minimized code
This arose while working on #14294, the examples below are extracted from our test suite and modified with an
@unchecked
annotation.Example 1
(extracted from tests/pos/extractor-types.scala )
Example 2
(extracted from this Scala.js test)
Output
Example 1
Example 2
Expectation
Both examples compile without the
@unchecked
annotation.Both examples compile with Scala 2.13.
Since
@unchecked
was added to suppress the refutable pattern binding warning (currently under -source future), I expected compilation to be successful here as well.It seems that adding
@unchecked
is causing a type test to be generated that wouldn't be otherwise. Below is a diff of -Xprint:typer on the first example:The text was updated successfully, but these errors were encountered: