File tree 6 files changed +24
-4
lines changed
scala/quoted/runtime/impl
docs/_docs/reference/other-new-features
6 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -403,7 +403,7 @@ object Denotations {
403
403
}
404
404
case denot1 : SingleDenotation =>
405
405
if (denot1 eq denot2) denot1
406
- else if ( denot1.matches(denot2)) mergeSingleDenot(denot1, denot2)
406
+ else if denot1.matches(denot2) then mergeSingleDenot(denot1, denot2)
407
407
else NoDenotation
408
408
}
409
409
@@ -438,8 +438,11 @@ object Denotations {
438
438
else defn.RootClass )
439
439
440
440
def isHidden (sym : Symbol ) = sym.exists && ! sym.isAccessibleFrom(pre)
441
- val hidden1 = isHidden(sym1)
442
- val hidden2 = isHidden(sym2)
441
+ // In typer phase filter out denotations with symbols that are not
442
+ // accessible. After typer, this is not possible since we cannot guarantee
443
+ // that the current owner is set correctly. See pos/14660.scala.
444
+ val hidden1 = isHidden(sym1) && ctx.isTyper
445
+ val hidden2 = isHidden(sym2) && ctx.isTyper
443
446
if hidden1 && ! hidden2 then denot2
444
447
else if hidden2 && ! hidden1 then denot1
445
448
else
Original file line number Diff line number Diff line change @@ -537,6 +537,7 @@ object Checking {
537
537
checkCombination(Private , Protected )
538
538
checkCombination(Abstract , Override )
539
539
checkCombination(Private , Override )
540
+ if sym.isType && ! sym.isClass then checkCombination(Private , Opaque )
540
541
checkCombination(Lazy , Inline )
541
542
// The issue with `erased inline` is that the erased semantics get lost
542
543
// as the code is inlined and the reference is removed before the erased usage check.
Original file line number Diff line number Diff line change @@ -441,7 +441,7 @@ object QuoteMatcher {
441
441
}
442
442
443
443
/** Result of matching a part of an expression */
444
- private opaque type Matching = Option [Tuple ]
444
+ private type Matching = Option [Tuple ]
445
445
446
446
private object Matching {
447
447
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ object o:
51
51
def id (x : o.T ): o.T = x
52
52
```
53
53
54
+ Opaque type aliases cannot be ` private ` and cannot be overridden in subclasses.
55
+
54
56
## Type Parameters of Opaque Types
55
57
56
58
Opaque type aliases can have a single type parameter list. The following aliases
Original file line number Diff line number Diff line change
1
+ class Bar :
2
+ private opaque type Baz = Int // error
3
+
4
+ private object Foo :
5
+ opaque type O = Int // OK
6
+
7
+ val x : Baz = 1
8
+
Original file line number Diff line number Diff line change
1
+ trait Foo :
2
+ class Bar :
3
+ private [Foo ] opaque type Baz = Int
4
+
5
+ def foo : Bar # Baz
6
+
You can’t perform that action at this time.
0 commit comments