-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14043 from dotty-staging/fix-12941
Don't retypecheck erroneous arguments when fixing function
- Loading branch information
Showing
8 changed files
with
113 additions
and
7 deletions.
There are no files selected for viewing
Submodule protoquill
updated
13 files
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,16 @@ | ||
-- 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? | ||
-- Error: tests/neg-custom-args/deprecation/t3235-minimal.scala:4:16 --------------------------------------------------- | ||
4 | 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.scala:5:32 --------------------------------------------------- | ||
5 | assert(1234567890123456789L.round == 1234567890123456789L) // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|method round in class RichLong 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? | ||
-- Error: tests/neg-custom-args/deprecation/t3235-minimal.scala:6:16 --------------------------------------------------- | ||
6 | 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,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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
object Test { | ||
val xs: List[Int] = ??? | ||
|
||
xs.lazyZip(xs).lazyZip(xs) | ||
.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 | ||
} |
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,20 @@ | ||
import util.matching.Regex | ||
import util.matching.Regex.Match | ||
|
||
// Demonstrate what used to be a failure in specs2, before we refined | ||
// the scheme when not to typecheck a function argument again. | ||
object Test: | ||
|
||
extension (s: String) | ||
|
||
def replaceAll(pairs: (String, String)*): String = | ||
pairs.foldLeft(s) { (res, cur) => | ||
res.replaceAll(cur._1, cur._2) | ||
} | ||
|
||
def replaceAll(exp: String, f: String => String): String = | ||
new Regex(exp).replaceAllIn(s, (m: Match) => f(m.group(0).replace("\\", "\\\\"))) | ||
|
||
def replaceInsideTag(tag: String, p: (String, String)*): String = | ||
s.replaceAll(tag, (s: String) => java.util.regex.Matcher.quoteReplacement(s.replaceAll(p*))) | ||
|
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