-
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.
Tighten closure extractor in TreeInfo (#21621)
The previous extractor for closures matches also arbitrary blocks that ended in a (possible deeply nested) closure. This caused wrong use sets in #21620. The new definition is stricter. There is also a new blockEndingInclosure extractor that keeps the old behavior. Fixes #21620
- Loading branch information
Showing
5 changed files
with
54 additions
and
6 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,13 @@ | ||
-- [E129] Potential Issue Warning: tests/neg-custom-args/captures/i21620.scala:5:6 ------------------------------------- | ||
5 | x | ||
| ^ | ||
| A pure expression does nothing in statement position | ||
| | ||
| longer explanation available when compiling with `-explain` | ||
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21620.scala:9:31 ---------------------------------------- | ||
9 | val _: () -> () ->{x} Unit = f // error | ||
| ^ | ||
| Found: () ->{f} () ->{x} Unit | ||
| Required: () -> () ->{x} Unit | ||
| | ||
| 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,10 @@ | ||
class C | ||
def test(x: C^) = | ||
val f = () => | ||
def foo() = | ||
x | ||
() | ||
println(s"hey: $x") | ||
() => foo() | ||
val _: () -> () ->{x} Unit = f // 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 @@ | ||
class C | ||
def test(x: C^) = | ||
def foo() = | ||
x | ||
() | ||
val f = () => | ||
// println() // uncomenting would give an error, but with | ||
// a different way of handling curried functions should be OK | ||
() => foo() | ||
val _: () -> () ->{x} Unit = f | ||
() |