Type parameter defines type member under inheritance with Scala 3.2.2 ? #16850
Labels
area:typer
itype:bug
itype:soundness
Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException)
regression
This worked in a previous version but doesn't anymore
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Observation
compiles under 3.2.2 but not under 3.2.1. The latter gives the error:
So it looks like under 3.2.2 it is possible to define the type member from
Trait
with the type parameter fromClass
. That would be nice if this would fail to compile:where I changed
type Y
totype Y <: String
but it does not. This still producesList(42)
.Expectation
Compiler error on the latter code OR the same behaviour as in Scala 3.2.1 of Scala 3.2.2 on the former code .
Discussion
I observed this behaviour on the Jan, 13 and we discussed it om the scala users forum under the title:
Int <: String in Scala 3.2.2?. I had to wait though until Scastie with 3.2.2 was released for easy reference. I tested the latter code also under Scala 3.3.0-RC2 and 3.3.1-RC1-bin-20230204-a356581-NIGHTLY and they behave as 3.2.2 does.
The text was updated successfully, but these errors were encountered: