@@ -1223,7 +1223,7 @@ extends DeclarationMsg(OverrideErrorID), NoDisambiguation:
12231223 override def canExplain =
12241224 memberTp.exists && otherTp.exists
12251225 def explain (using Context ) =
1226- if canExplain then err.whyNoMatchStr(memberTp, otherTp) else " "
1226+ if canExplain then err.whyNoMatchStr(memberTp, otherTp, frozen = true ) else " "
12271227
12281228class ForwardReferenceExtendsOverDefinition (value : Symbol , definition : Symbol )(using Context )
12291229extends ReferenceMsg (ForwardReferenceExtendsOverDefinitionID ) {
@@ -3960,7 +3960,7 @@ final class IllegalUseOfSpecialized(using Context)
39603960 inline def foo[T: Specialized](v: Vec[T]) = v.x
39613961
39623962 In this instance it was used in a way which is unsupported, such as
3963- trying to create a type synonym or a value with explicit type Specialized[X].
3963+ trying to create a type synonym or a value with explicit type Specialized[X].
39643964 """
39653965
39663966/** Shows up as a TypeError (in the notes field) if variance is attempted
@@ -3974,17 +3974,17 @@ final class IllegalVarianceInSpecializedTraitsNote(using Context) extends Note:
39743974 - Primitives are specialized: Foo[Int] erases to Foo $$ sp $$ Int
39753975 - Reference types are specialized to the highest non-top class: Foo[Lion] erases to Foo $$ sp $$ Animal
39763976 - Top classes are erased normally: Foo[Any] / Foo[AnyVal] / Foo[Object] / Foo[AnyRef] erase to Foo.
3977- This means that variance patterns that cross these erasure categories will fail at
3977+ This means that variance patterns that cross these erasure categories will fail at
39783978 runtime due to a ClassCastException, so they are not permitted.
39793979
39803980 Please see the docs for more information on how specialized traits are erased.
39813981 Suggested fixes:
39823982 - Make the type of the target site more general e.g. Foo[Object] instead of Foo[Animal].
3983- - Reconsider if you really need to use Nothing / Object / Any / AnyRef / AnyVal in your code.
3983+ - Reconsider if you really need to use Nothing / Object / Any / AnyRef / AnyVal in your code.
39843984 - Remove Specialized from the definition of the corresponding parameter.
39853985 """
39863986
3987- override def covers (other : Note )(using Context ): Boolean =
3987+ override def covers (other : Note )(using Context ): Boolean =
39883988 other.isInstanceOf [IllegalVarianceInSpecializedTraitsNote ]
39893989
39903990final class VarianceInSpecializedTraitsLimitation (using Context )
@@ -3997,17 +3997,17 @@ final class VarianceInSpecializedTraitsLimitation(using Context)
39973997 - Primitives are specialized: Foo[Int] erases to Foo $$ sp $$ Int
39983998 - Reference types are specialized to the highest non-top class: Foo[Lion] erases to Foo $$ sp $$ Animal
39993999 - Top classes are erased normally: Foo[Any] / Foo[AnyVal] / Foo[Object] / Foo[AnyRef] erase to Foo.
4000- This means that certain variance patterns that cross these erasure categories will fail at
4000+ This means that certain variance patterns that cross these erasure categories will fail at
40014001 runtime due to a ClassCastException, so they are not permitted.
4002-
4003- For example, treating Foo[Any] as Foo[Animal] via contravariance is not allowed with Specialized.
4002+
4003+ For example, treating Foo[Any] as Foo[Animal] via contravariance is not allowed with Specialized.
40044004
40054005 Please see the docs for more information on how specialized traits are erased.
40064006
40074007 If you accept this limitation you can silence this warning with @nowarn. For example:
4008-
4008+
40094009 @nowarn("id=E ${VarianceInSpecializedTraitsLimitationID .errorNumber}")
40104010 inline trait Foo[-T: Specialized]:
4011-
4011+
40124012 Otherwise, remove Specialized, or remove the variance.
40134013 """
0 commit comments