File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ object RefChecks {
305305 def info = self.memberInfo(sym1)
306306 val infoStr =
307307 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"
309309 else if (sym1.is(Module )) " "
310310 else if (sym1.isTerm) i " of type $info"
311311 else " "
@@ -430,6 +430,10 @@ object RefChecks {
430430 // direct overrides were already checked on completion (see Checking.chckWellFormed)
431431 // the test here catches indirect overriddes between two inherited base types.
432432 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" )
433437 else if (! other.is(Deferred ) && member.isClass)
434438 overrideError(" cannot be used here - classes can only override abstract types" )
435439 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