Skip to content

Commit

Permalink
Clean tests
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Oct 18, 2023
1 parent 347feae commit 7ba5ba1
Show file tree
Hide file tree
Showing 59 changed files with 17 additions and 563 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/JavaNullInterop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ object JavaNullInterop {
// This is because `setNames(null)` passes as argument a single-element array containing the value `null`,
// and not a `null` array.
|| !ctx.flexibleTypes && tp.isRef(defn.RepeatedParamClass)
case _ => true
case _ => false
}))

override def apply(tp: Type): Type = tp match {
Expand Down
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -645,14 +645,15 @@ trait Applications extends Compatibility {
missingArg(n)
}

if (formal.isRepeatedParam)
val formal1 = formal.stripFlexible
if (formal1.isRepeatedParam)
args match {
case arg :: Nil if isVarArg(arg) =>
addTyped(arg)
case (arg @ Typed(Literal(Constant(null)), _)) :: Nil if ctx.isAfterTyper =>
addTyped(arg)
case _ =>
val elemFormal = formal.widenExpr.argTypesLo.head
val elemFormal = formal1.widenExpr.argTypesLo.head
val typedArgs =
harmonic(harmonizeArgs, elemFormal) {
args.map { arg =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

// Test that type mapping works with flexible types.
val ll: ArrayList[ArrayList[ArrayList[String]]] = new ArrayList[ArrayList[ArrayList[String]]]
val level1: ArrayList[ArrayList[String]] = ll.get(0)
val level2: ArrayList[String] = ll.get(0).get(0)
val level3: String = ll.get(0).get(0).get(0)
val level1: ArrayList[ArrayList[String]] = ll.get(0) // error
val level2: ArrayList[String] = ll.get(0).get(0) // error
val level3: String = ll.get(0).get(0).get(0) // error

val lb = new ArrayList[ArrayList[ArrayList[String]]]
val levelA = lb.get(0)
val levelB = lb.get(0).get(0)
val levelC = lb.get(0).get(0).get(0)
val levelB = lb.get(0).get(0) // error
val levelC = lb.get(0).get(0).get(0) // error

val x = levelA.get(0)
val x = levelA.get(0) // error
val y = levelB.get(0)
val z: String = levelA.get(0).get(0)
val z: String = levelA.get(0).get(0) // error
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ val s1n: String | Null = j.f1()

val i1: Int = j.f2()

val k: jj.K = jj.f3()
val k: jj.K = jj.f3() // error // error

val s2: String = j.g1[String]() // error

Expand Down

This file was deleted.

5 changes: 5 additions & 0 deletions tests/explicit-nulls/flexible-types/pos/match-null.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test1 =
val s: String = ???
s.trim() match
case _: String =>
case null =>
44 changes: 0 additions & 44 deletions tests/flexible-types/neg/array.scala

This file was deleted.

6 changes: 0 additions & 6 deletions tests/flexible-types/pos-separate/interop-enum-src/Day_1.java

This file was deleted.

19 changes: 0 additions & 19 deletions tests/flexible-types/pos-separate/interop-enum-src/Planet_2.java

This file was deleted.

6 changes: 0 additions & 6 deletions tests/flexible-types/pos-separate/interop-enum-src/S_3.scala

This file was deleted.

1 change: 0 additions & 1 deletion tests/flexible-types/pos/i8981.scala

This file was deleted.

26 changes: 0 additions & 26 deletions tests/flexible-types/pos/instanceof-nothing.scala

This file was deleted.

13 changes: 0 additions & 13 deletions tests/flexible-types/pos/interop-array-src/J.java

This file was deleted.

25 changes: 0 additions & 25 deletions tests/flexible-types/pos/interop-array-src/S.scala

This file was deleted.

5 changes: 0 additions & 5 deletions tests/flexible-types/pos/interop-compare-src/J.java

This file was deleted.

10 changes: 0 additions & 10 deletions tests/flexible-types/pos/interop-compare-src/S.scala

This file was deleted.

7 changes: 0 additions & 7 deletions tests/flexible-types/pos/interop-constructor.scala

This file was deleted.

4 changes: 0 additions & 4 deletions tests/flexible-types/pos/interop-java-varargs-src/Names.java

This file was deleted.

19 changes: 0 additions & 19 deletions tests/flexible-types/pos/interop-java-varargs-src/S.scala

This file was deleted.

22 changes: 0 additions & 22 deletions tests/flexible-types/pos/interop-java-varargs.scala

This file was deleted.

10 changes: 0 additions & 10 deletions tests/flexible-types/pos/override-java-object-arg-src/J.java

This file was deleted.

33 changes: 0 additions & 33 deletions tests/flexible-types/pos/override-java-object-arg-src/S.scala

This file was deleted.

43 changes: 0 additions & 43 deletions tests/flexible-types/pos/override-java-object-arg.scala

This file was deleted.

14 changes: 0 additions & 14 deletions tests/flexible-types/pos/override-java-varargs/S.scala

This file was deleted.

Loading

0 comments on commit 7ba5ba1

Please sign in to comment.