forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't retypecheck erroneous arguments when fixing function
Don't retypecheck erroneous arguments when trying conversions or extensions on the function part. Generally, we should avoid typechecking untyped trees several times, this can quickly explode exponentially. Fixes scala#12941
- Loading branch information
Showing
15 changed files
with
101 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- Error: tests/neg-custom-args/deprecation/t3235-minimal-v2.scala:3:16 ------------------------------------------------ | ||
3 | assert(math.round(123456789) == 123456789) // error | ||
| ^^^^^^^^^^ | ||
|method round in package scala.math is deprecated since 2.11.0: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value? | ||
-- Error: tests/neg-custom-args/deprecation/t3235-minimal-v2.scala:4:16 ------------------------------------------------ | ||
4 | assert(math.round(1234567890123456789L) == 1234567890123456789L) // error | ||
| ^^^^^^^^^^ | ||
|method round in package scala.math is deprecated since 2.11.0: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
assert(math.round(123456789) == 123456789) // error | ||
assert(math.round(1234567890123456789L) == 1234567890123456789L) // error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
assert(1234567890123456789L.round == 1234567890123456789L) // error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Error: tests/neg-custom-args/deprecation/t3235-minimal.scala:3:21 --------------------------------------------------- | ||
3 | assert(123456789.round == 123456789) // error | ||
| ^^^^^^^^^^^^^^^ | ||
|method round in class RichInt is deprecated since 2.11.0: this is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
assert(123456789.round == 123456789) // error | ||
assert(math.round(123456789) == 123456789) // error | ||
assert(1234567890123456789L.round == 1234567890123456789L) // error | ||
assert(math.round(1234567890123456789L) == 1234567890123456789L) // error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
object A: | ||
def myFun(op: String ?=> Unit) = () | ||
|
||
@main def func: Unit = | ||
A.myFun { | ||
val res: String = summon[String] | ||
println(ress) // error | ||
} | ||
|
||
class I: | ||
def runSth: Int = 1 | ||
|
||
abstract class A: | ||
def myFun(op: I ?=> Unit) = | ||
op(using I()) | ||
1 | ||
|
||
class B extends A | ||
|
||
def assertEquals(x: String, y: Int, z: Int): Unit = () | ||
|
||
@main def hello: Unit = | ||
|
||
B().myFun { | ||
val res = summon[I].runSth | ||
assertEquals("", 1, res, "asd") // error | ||
println("Hello!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i903.scala:3:16 --------------------------------------------------------------- | ||
3 | "".contains("", (_: Int)) // error | ||
| ^^^^^^^^^^^^ | ||
| Found: (String, Int) | ||
| Required: CharSequence | ||
|
||
longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
object Test { | ||
def test2 = | ||
"".contains("", (_: Int)) // error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/zipped.scala:6:10 ------------------------------------------------------------- | ||
6 | .map( (x: (Int, Int, Int)) => x match { case (x, y, z) => x + y + z }) // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Found: ((Int, Int, Int)) => Int | ||
| Required: (Int, Int, Int) => Int | ||
|
||
longer explanation available when compiling with `-explain` | ||
-- [E086] Syntax Error: tests/neg/zipped.scala:9:12 -------------------------------------------------------------------- | ||
9 | .map( x => x match { case (x, y, z) => x + y + z }) // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Wrong number of parameters, expected: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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 | ||
|
||
xs.lazyZip(xs).lazyZip(xs) | ||
.map( x => x match { case (x, y, z) => x + y + z }) // error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters