Skip to content

Commit 657caec

Browse files
committed
Change doc comment explaining widening rule
1 parent 8e2aae2 commit 657caec

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,8 @@ trait Applications extends Compatibility {
11121112

11131113
/** If `tree` is a complete application of a compiler-generated `apply`
11141114
* or `copy` method of an enum case, widen its type to the underlying
1115-
* type by means of a type ascription, unless the expected type is an
1116-
* enum case itself.
1115+
* type by means of a type ascription, as long as the widened type is
1116+
* still compatible with the expected type.
11171117
* The underlying type is the intersection of all class parents of the
11181118
* orginal type.
11191119
*/

tests/run-macros/i8007/Test_4.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ enum OptInv[+T] {
3939
println(t5) // true
4040
println
4141

42-
// Here invariant case without explicit type parameter will instantiate T to OptInv[Any]
43-
val t5_2 = OptInv.Sm[Int](23) === OptInv.Sm(23)
44-
println(t5) // true
42+
val t5_2 = OptInv.Sm(23) === OptInv.Sm(23)
43+
println(t5_2) // true
4544
println
4645

4746
val t6 = Sm(Person("Test", 23)) === Sm(Person("Test", 23))

0 commit comments

Comments
 (0)