File tree 3 files changed +32
-10
lines changed
compiler/src/dotty/tools/dotc
3 files changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -1393,10 +1393,10 @@ object SymDenotations {
1393
1393
def thisType (using Context ): Type = NoPrefix
1394
1394
1395
1395
def typeRef (using Context ): TypeRef =
1396
- TypeRef (owner .thisType, symbol)
1396
+ TypeRef (maybeOwner .thisType, symbol)
1397
1397
1398
1398
def termRef (using Context ): TermRef =
1399
- TermRef (owner .thisType, symbol)
1399
+ TermRef (maybeOwner .thisType, symbol)
1400
1400
1401
1401
/** The typeRef applied to its own type parameters */
1402
1402
def appliedRef (using Context ): Type =
Original file line number Diff line number Diff line change @@ -1657,14 +1657,15 @@ sealed class TermRefSet(using Context):
1657
1657
1658
1658
def += (ref : TermRef ): Unit =
1659
1659
val pre = ref.prefix
1660
- val sym = ref.symbol.asTerm
1661
- elems.get(sym) match
1662
- case null =>
1663
- elems.put(sym, pre)
1664
- case prefix : Type =>
1665
- if ! (prefix =:= pre) then elems.put(sym, pre :: prefix :: Nil )
1666
- case prefixes : List [Type ] =>
1667
- if ! prefixes.exists(_ =:= pre) then elems.put(sym, pre :: prefixes)
1660
+ if ref.symbol.exists then
1661
+ val sym = ref.symbol.asTerm
1662
+ elems.get(sym) match
1663
+ case null =>
1664
+ elems.put(sym, pre)
1665
+ case prefix : Type =>
1666
+ if ! (prefix =:= pre) then elems.put(sym, pre :: prefix :: Nil )
1667
+ case prefixes : List [Type ] =>
1668
+ if ! prefixes.exists(_ =:= pre) then elems.put(sym, pre :: prefixes)
1668
1669
1669
1670
def ++= (that : TermRefSet ): Unit =
1670
1671
if ! that.isEmpty then that.foreach(+= )
Original file line number Diff line number Diff line change
1
+ // fuzz test to avoid NoSymbol.owner
2
+ type Id [T ] = T match {
3
+ case _ => T
4
+ }
5
+
6
+ class Foo2 [T <: Id [T ]] // error // error
7
+
8
+ object Foo { // error
9
+ object Foo { }
10
+ Foo { }
11
+ }
12
+ implicit class Foo (a : Float ) // error
13
+ case class Foo ()
14
+
15
+ case class Bar (
16
+ } { ; // error
17
+ object Bar { // error
18
+ class Foo (a : Int ) extends AnyVal
19
+ Foo ()
20
+ }
21
+ type Bar // error
You can’t perform that action at this time.
0 commit comments