File tree 2 files changed +16
-4
lines changed
compiler/src/dotty/tools/dotc/core 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1046,17 +1046,15 @@ object Types {
1046
1046
TypeComparer .isSameTypeWhenFrozen(this , that)
1047
1047
1048
1048
/** Is this type a primitive value type which can be widened to the primitive value type `that`? */
1049
- def isValueSubType (that : Type )(using Context ): Boolean = widen match {
1049
+ def isValueSubType (that : Type )(using Context ): Boolean = widenDealias match
1050
1050
case self : TypeRef if self.symbol.isPrimitiveValueClass =>
1051
- that.widenExpr match {
1051
+ that.widenExpr.dealias match
1052
1052
case that : TypeRef if that.symbol.isPrimitiveValueClass =>
1053
1053
defn.isValueSubClass(self.symbol, that.symbol)
1054
1054
case _ =>
1055
1055
false
1056
- }
1057
1056
case _ =>
1058
1057
false
1059
- }
1060
1058
1061
1059
def relaxed_<:< (that : Type )(using Context ): Boolean =
1062
1060
(this <:< that) || (this isValueSubType that)
Original file line number Diff line number Diff line change
1
+ object OK {
2
+ def apply (n : Int ): Unit = ()
3
+ def apply (n : Long ): Unit = ()
4
+ apply(3 ) // ok
5
+ apply(3L ) // ok
6
+ }
7
+
8
+ object KO {
9
+ type Key = Int
10
+ def apply (n : Key ): Unit = ()
11
+ def apply (n : Long ): Unit = ()
12
+ apply(3 ) // error
13
+ apply(3L ) // ok
14
+ }
You can’t perform that action at this time.
0 commit comments