diff options
author | James Iry <jamesiry@gmail.com> | 2013-02-27 04:59:47 -0800 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-02-28 06:55:32 -0800 |
commit | bfd7863406146aa830028ed77f7b0107fc60e5dc (patch) | |
tree | d035580cd2941d0aca688e0f957189555dd8d84b /src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala | |
parent | 4124a09379fe1784a6069f5af482bdabdb69a569 (diff) | |
download | scala-bfd7863406146aa830028ed77f7b0107fc60e5dc.tar.gz scala-bfd7863406146aa830028ed77f7b0107fc60e5dc.tar.bz2 scala-bfd7863406146aa830028ed77f7b0107fc60e5dc.zip |
SI-7159 Distinguish between assignability and sub typing in TypeKinds
TypeKinds said SHORT <:< INT. But that's not quite true on the JVM. You
can assign SHORT to INT, but you can't assign an ARRAY[SHORT] to
ARRAY[INT]. Since JVM arrays are covariant it's clear that assignability
and subtyping are distinct on the JVM.
This commit adds an isAssignable method and moves the rules about
the int sized primitives there. ICodeCheckers, ICodeReader, and
GenICode are all updated to use isAssignable instead of <:<.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala index fb1ef311d2..49f2d9859d 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala @@ -351,7 +351,7 @@ abstract class ICodeCheckers { def typeError(k1: TypeKind, k2: TypeKind) { icodeError("\n expected: " + k1 + "\n found: " + k2) } - def isSubtype(k1: TypeKind, k2: TypeKind) = (k1 <:< k2) || { + def isSubtype(k1: TypeKind, k2: TypeKind) = (k1 isAssignabledTo k2) || { import platform.isMaybeBoxed (k1, k2) match { |