Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1038,17 +1038,15 @@ object Types {
TypeComparer.isSameTypeWhenFrozen(this, that)

/** Is this type a primitive value type which can be widened to the primitive value type `that`? */
def isValueSubType(that: Type)(using Context): Boolean = widen match {
def isValueSubType(that: Type)(using Context): Boolean = widenDealias match
case self: TypeRef if self.symbol.isPrimitiveValueClass =>
that.widenExpr match {
that.widenExpr.dealias match
case that: TypeRef if that.symbol.isPrimitiveValueClass =>
defn.isValueSubClass(self.symbol, that.symbol)
case _ =>
false
}
case _ =>
false
}

def relaxed_<:<(that: Type)(using Context): Boolean =
(this <:< that) || (this isValueSubType that)
Expand Down
4 changes: 2 additions & 2 deletions tasty/test/dotty/tools/tasty/TastyHeaderUnpicklerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ object TastyHeaderUnpicklerTest {
buf.writeNat(exp)
buf.writeNat(compilerBytes.length)
buf.writeBytes(compilerBytes, compilerBytes.length)
buf.writeUncompressedLong(237478l)
buf.writeUncompressedLong(324789l)
buf.writeUncompressedLong(237478L)
buf.writeUncompressedLong(324789L)
buf
}

Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i12265.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
object OK {
def apply(n: Int ): Unit = ()
def apply(n: Long): Unit = ()
apply(3) // ok
apply(3L) // ok
}

object KO {
type Key = Int
def apply(n: Key ): Unit = ()
def apply(n: Long): Unit = ()
apply(3) // error
apply(3L) // ok
}