-
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 "Explain unresolvable references better" to LTS (#21129)
Backports #20477 to the LTS branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
8 changed files
with
94 additions
and
15 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,6 @@ | ||
-- Error: tests/neg/i11226.scala:13:36 --------------------------------------------------------------------------------- | ||
13 | def test(a: ActorRef): Unit = bus.unsubscribe(a) // error | ||
| ^ | ||
| Cannot resolve reference to type (Unsubscriber.this.bus : ManagedActorClassification).Subscriber. | ||
| Subscriber exists as a member of the self type ActorEventBus of trait ManagedActorClassification | ||
| but it cannot be called on a receiver whose type does not extend trait ManagedActorClassification. |
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,14 @@ | ||
trait ActorRef | ||
|
||
trait ActorEventBus { | ||
type Subscriber = ActorRef | ||
} | ||
|
||
trait ManagedActorClassification { this: ActorEventBus => | ||
def unsubscribe(subscriber: Subscriber, from: Any): Unit | ||
def unsubscribe(subscriber: Subscriber): Unit | ||
} | ||
|
||
class Unsubscriber(bus: ManagedActorClassification) { | ||
def test(a: ActorRef): Unit = bus.unsubscribe(a) // 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,12 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i11226a.scala:12:48 ----------------------------------------------------------- | ||
12 | def test(a: ActorRef): Unit = bus.unsubscribe(a) // error | ||
| ^ | ||
| Found: (a : ActorRef) | ||
| Required: Unsubscriber.this.bus.Subscriber | ||
| | ||
| Note that I could not resolve reference Unsubscriber.this.bus.Subscriber. | ||
| Subscriber exists as a member of the self type ActorEventBus of trait ManagedActorClassification | ||
| but it cannot be called on a receiver whose type does not extend trait ManagedActorClassification | ||
| | ||
| | ||
| 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,13 @@ | ||
trait ActorRef | ||
|
||
trait ActorEventBus { | ||
type Subscriber = ActorRef | ||
} | ||
|
||
trait ManagedActorClassification { this: ActorEventBus => | ||
def unsubscribe(subscriber: Subscriber): Unit | ||
} | ||
|
||
class Unsubscriber(bus: ManagedActorClassification) { | ||
def test(a: ActorRef): Unit = bus.unsubscribe(a) // 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
-- Error: tests/neg/i16407.scala:2:2 ----------------------------------------------------------------------------------- | ||
2 | f(g()) // error // error | ||
| ^ | ||
| cannot resolve reference to type (X.this : Y & X).A | ||
| the classfile defining the type might be missing from the classpath | ||
| or the self type of (X.this : Y & X) might not contain all transitive dependencies | ||
| Cannot resolve reference to type (X.this : Y & X).A. | ||
| The classfile defining the type might be missing from the classpath | ||
| or the self type of (X.this : Y & X) might not contain all transitive dependencies. | ||
-- Error: tests/neg/i16407.scala:2:4 ----------------------------------------------------------------------------------- | ||
2 | f(g()) // error // error | ||
| ^ | ||
| cannot resolve reference to type (X.this : Y & X).A | ||
| the classfile defining the type might be missing from the classpath | ||
| or the self type of (X.this : Y & X) might not contain all transitive dependencies | ||
| Cannot resolve reference to type (X.this : Y & X).A. | ||
| The classfile defining the type might be missing from the classpath | ||
| or the self type of (X.this : Y & X) might not contain all transitive dependencies. |
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 @@ | ||
trait A { | ||
class T() | ||
} | ||
trait B { | ||
this: A => | ||
def f(a: Int = 0): Any | ||
} | ||
trait C extends B { | ||
this: A => | ||
def f(t: T): Any | ||
} |