Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/core/TypeErrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class MissingType(val pre: Type, val name: Name)(using Context) extends TypeErro
case _ if givenSelf.exists && givenSelf.member(name).exists =>
i"""$name exists as a member of the self type $givenSelf of $cls
|but it cannot be called on a receiver whose type does not extend $cls"""
case _ if pre.baseClasses.exists(_.findMember(name, pre, Private, EmptyFlags).exists) =>
i"$name is a private member in a base class"
case _ =>
missingClassFile

Expand Down
4 changes: 4 additions & 0 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,10 @@ trait ImplicitRunInfo:
override def stopAt = StopAt.Static
private val seen = util.HashSet[Type]()

override def derivedTypeBounds(tp: TypeBounds, lo: Type, hi: Type): Type =
if lo.exists && hi.exists then super.derivedTypeBounds(tp, lo, hi)
else NoType // Survive inaccessible types, for instance in i21543.scala.

def applyToUnderlying(t: TypeProxy) =
if seen.contains(t) then
WildcardType
Expand Down
22 changes: 22 additions & 0 deletions tests/neg/i21543.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- [E007] Type Mismatch Error: tests/neg/i21543.scala:10:15 ------------------------------------------------------------
10 | Cmd(List("1", "2")) // error // error
| ^^^
| Found: ("1" : String)
| Required: Event
|
| Note that I could not resolve reference Event.
| Event is a private member in a base class
|
|
| longer explanation available when compiling with `-explain`
-- [E007] Type Mismatch Error: tests/neg/i21543.scala:10:20 ------------------------------------------------------------
10 | Cmd(List("1", "2")) // error // error
| ^^^
| Found: ("2" : String)
| Required: Event
|
| Note that I could not resolve reference Event.
| Event is a private member in a base class
|
|
| longer explanation available when compiling with `-explain`
13 changes: 13 additions & 0 deletions tests/neg/i21543.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
object CompilerCrash {
trait Scope {
private type Event = String

case class Cmd(events: List[Event])
}

new Scope {
val commands = List(
Cmd(List("1", "2")) // error // error
)
}
}
Loading