Skip to content

Commit 9fcddd3

Browse files
committed
remove faulty assertion in backend
1 parent 27b22af commit 9fcddd3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ abstract class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
9191

9292
assert(classSym != NoSymbol, "Cannot create ClassBType from NoSymbol")
9393
assert(classSym.isClass, s"Cannot create ClassBType from non-class symbol $classSym")
94+
// note: classSym can be scala.Array, see https://github.com/scala/bug/issues/12225#issuecomment-729687859
9495
if (global.settings.debug) {
95-
// OPT these assertions have too much performance overhead to run unconditionally
96-
assertClassNotArrayNotPrimitive(classSym)
96+
// OPT this assertion has too much performance overhead to run unconditionally
9797
assert(!primitiveTypeToBType.contains(classSym) || isCompilingPrimitive, s"Cannot create ClassBType for primitive class symbol $classSym")
9898
}
9999

@@ -221,11 +221,6 @@ abstract class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
221221
assert(sym != definitions.ArrayClass || isCompilingArray, sym)
222222
}
223223

224-
def assertClassNotArrayNotPrimitive(sym: Symbol): Unit = {
225-
assertClassNotArray(sym)
226-
assert(!primitiveTypeToBType.contains(sym) || isCompilingPrimitive, sym)
227-
}
228-
229224
def implementedInterfaces(classSym: Symbol): List[Symbol] = {
230225

231226
def isInterfaceOrTrait(sym: Symbol) = sym.isInterface || sym.isTrait

test/files/pos/t12225.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// scalac: -Ydebug
2+
object Test {
3+
def foo(arr: Array[Int]): Unit = {
4+
val Array(x, y) = arr
5+
}
6+
}

0 commit comments

Comments
 (0)