-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Don't retypecheck erroneous arguments when fixing function #14043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
002f9a0
Don't retypecheck erroneous arguments when fixing function
odersky a3e2840
Refine condition when to not typecheck again
odersky fcf2560
Further refine condition when not to typecheck again
odersky 87fc207
Disable protoquill
odersky 4d0d205
Harden `hasInnerErrors` and fix tests
odersky ee015bc
Revert "Disable protoquill"
odersky 89ec460
Fix protoquill
nicolasstucki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule protoquill
updated
13 files
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.