Skip to content

Commit e6c7f27

Browse files
committed
Another tweak to unknownMembers
Turns out we cannot make TypeParamRefs have unknown members directly. scala.concurrent.TrieMap fails if we do that.
1 parent f7e38af commit e6c7f27

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,25 +162,25 @@ object ProtoTypes {
162162
* 1. The type has Nothing or Wildcard as a prefix or underlying type
163163
* 2. The type is an abstract type with a lower bound that has a unknown
164164
* members and an upper bound that is both provisional and has unknown members.
165-
* 3. The type is a type param ref or uninstiated type var with a lower
166-
* that has unknown members.
165+
* 3. The type is an uninstiated type var with a lower that has unknown members.
167166
* 4. Type proxies have unknown members if their super types do
168167
*/
169168
private def hasUnknownMembers(tp: Type)(using Context): Boolean = tp match
170169
case tp: WildcardType => true
171170
case NoType => true
172171
case tp: TypeRef =>
173172
val sym = tp.symbol
174-
defn.isBottomClass(sym)
175-
|| !sym.isClass
173+
sym == defn.NothingClass
174+
|| !sym.isClass
176175
&& !sym.isStatic
177176
&& {
178177
hasUnknownMembers(tp.prefix)
179178
|| { val bound = tp.info.hiBound
180179
bound.isProvisional && hasUnknownMembers(bound)
181180
} && hasUnknownMembers(tp.info.loBound)
182181
}
183-
case tp: TypeParamRef => hasUnknownMembers(TypeComparer.bounds(tp).lo)
182+
case tp: TypeVar =>
183+
!tp.isInstantiated && hasUnknownMembers(TypeComparer.bounds(tp.origin).lo)
184184
case tp: AppliedType => hasUnknownMembers(tp.tycon) || hasUnknownMembers(tp.superType)
185185
case tp: TypeProxy => hasUnknownMembers(tp.superType)
186186
// It woukd make sense to also include And/OrTypes, but that leads to

0 commit comments

Comments
 (0)