File tree 2 files changed +18
-1
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ object RefChecks {
305
305
def info = self.memberInfo(sym1)
306
306
val infoStr =
307
307
if (sym1.isAliasType) i " , which equals ${info.bounds.hi}"
308
- else if (sym1.isAbstractOrParamType) i " with bounds $info"
308
+ else if (sym1.isAbstractOrParamType && info != TypeBounds .empty ) i " with bounds $info"
309
309
else if (sym1.is(Module )) " "
310
310
else if (sym1.isTerm) i " of type $info"
311
311
else " "
@@ -430,6 +430,10 @@ object RefChecks {
430
430
// direct overrides were already checked on completion (see Checking.chckWellFormed)
431
431
// the test here catches indirect overriddes between two inherited base types.
432
432
overrideError(" cannot be used here - class definitions cannot be overridden" )
433
+ else if (other.isOpaqueAlias)
434
+ // direct overrides were already checked on completion (see Checking.chckWellFormed)
435
+ // the test here catches indirect overriddes between two inherited base types.
436
+ overrideError(" cannot be used here - opaque type aliases cannot be overridden" )
433
437
else if (! other.is(Deferred ) && member.isClass)
434
438
overrideError(" cannot be used here - classes can only override abstract types" )
435
439
else if other.isEffectivelyFinal then // (1.2)
Original file line number Diff line number Diff line change
1
+ trait Foo {
2
+ opaque type Out = Int
3
+ def out1 : Out
4
+ def out2 : Out = out1
5
+ }
6
+
7
+ object Bar extends Foo {
8
+ override opaque type Out = String // error
9
+ override def out1 = " abc"
10
+ }
11
+
12
+ @ main def run () =
13
+ val x = Bar .out2
You can’t perform that action at this time.
0 commit comments