-
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.
Backport "Check @TargetNAME when subtyping Refined Types" to LTS (#20781
) Backports #19081 to the LTS branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
5 changed files
with
31 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i18922.scala:11:27 ------------------------------------------------------------ | ||
11 |def test = doClose(Resource()) // error | ||
| ^^^^^^^^^^ | ||
| Found: Resource | ||
| Required: Object{def close(): 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,11 @@ | ||
import scala.annotation.targetName | ||
|
||
def doClose(closable: { def close(): Unit }): Unit = | ||
import reflect.Selectable.reflectiveSelectable | ||
closable.close() | ||
|
||
class Resource: | ||
@targetName("foo") | ||
def close(): Unit = ??? | ||
|
||
def test = doClose(Resource()) // 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,7 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/targetName-refine.scala:7:27 -------------------------------------------------- | ||
7 |val x: T { def f: Int } = C() // error | ||
| ^^^ | ||
| Found: C | ||
| Required: T{def f: Int} | ||
| | ||
| 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