Skip to content

Commit

Permalink
Harden hasInnerErrors and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Dec 19, 2021
1 parent c62445f commit cc5428f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 29 deletions.
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ object ProtoTypes {
case closureDef(mdef) => hasInnerErrors(mdef.rhs)
case _ =>
t.existsSubTree { t1 =>
if t1.tpe.isError && t1.span.toSynthetic != t.span.toSynthetic then
typr.println(i"error subtree $t1 of $t with ${t1.tpe}, spans = ${t1.span}, ${t.span}")
if t1.typeOpt.isError && t1.span.toSynthetic != t.span.toSynthetic then
typr.println(i"error subtree $t1 of $t with ${t1.typeOpt}, spans = ${t1.span}, ${t.span}")
true
else
false
Expand Down
7 changes: 0 additions & 7 deletions tests/neg/i903.check

This file was deleted.

4 changes: 0 additions & 4 deletions tests/neg/i903.scala

This file was deleted.

11 changes: 0 additions & 11 deletions tests/neg/zipped.check

This file was deleted.

3 changes: 1 addition & 2 deletions tests/neg/zipped.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
object Test {
val xs: List[Int] = ???

// Does not work anynore since auto(un)tupling does not work after conversions
xs.lazyZip(xs).lazyZip(xs)
.map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // error
.map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // ok

xs.lazyZip(xs).lazyZip(xs)
.map( x => x match { case (x, y, z) => x + y + z }) // error
Expand Down
8 changes: 8 additions & 0 deletions tests/pos/i903.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@ object Test {
// f.apply(0)
// ^
}

def test2 = {
val f = "".contains("", (_: Int)) // dotc:
f.apply(0)
// sandbox/eta.scala:18: error: apply is not a member of Boolean(f)
// f.apply(0)
// ^
}
}
7 changes: 4 additions & 3 deletions tests/pos/zipped.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ object Test {
.map( (x: Int, y: Int, z: Int) => x + y + z ) // OK

// 4. The single parameter map works through an inserted conversion
//xs.lazyZip(xs).lazyZip(xs)
// .map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // now also OK
xs.lazyZip(xs).lazyZip(xs)
.map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // now also OK

// 5. If we leave out the parameter type, it now works as well.
// 5. But if that pone is deeper nested, it does not work since we don't retypecheck
// arguments deeply.
//xs.lazyZip(xs).lazyZip(xs)
// .map( x => x match { case (x, y, z) => x + y + z }) // now also OK

Expand Down

0 comments on commit cc5428f

Please sign in to comment.