File tree Expand file tree Collapse file tree 5 files changed +30
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 5 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,7 @@ object StdNames {
371371 val Import : N = " Import"
372372 val Literal : N = " Literal"
373373 val LiteralAnnotArg : N = " LiteralAnnotArg"
374+ val Matchable : N = " Matchable"
374375 val MatchCase : N = " MatchCase"
375376 val MirroredElemTypes : N = " MirroredElemTypes"
376377 val MirroredElemLabels : N = " MirroredElemLabels"
@@ -387,7 +388,6 @@ object StdNames {
387388 val Ref : N = " Ref"
388389 val RootPackage : N = " RootPackage"
389390 val RootClass : N = " RootClass"
390- val Matchable : N = " Matchable"
391391 val Select : N = " Select"
392392 val Shape : N = " Shape"
393393 val StringContext : N = " StringContext"
Original file line number Diff line number Diff line change @@ -141,4 +141,4 @@ class ReTyper extends Typer with ReChecking {
141141 override protected def addAccessorDefs (cls : Symbol , body : List [Tree ])(using Context ): List [Tree ] = body
142142 override protected def checkEqualityEvidence (tree : tpd.Tree , pt : Type )(using Context ): Unit = ()
143143 override protected def matchingApply (methType : MethodOrPoly , pt : FunProto )(using Context ): Boolean = true
144- }
144+ }
Original file line number Diff line number Diff line change @@ -3411,6 +3411,9 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
34113411 /** The class symbol of core class `scala.Any`. */
34123412 def AnyClass : Symbol
34133413
3414+ /** The class symbol of core trait `scala.Matchable` */
3415+ def MatchableClass : Symbol
3416+
34143417 /** The class symbol of core class `scala.AnyVal`. */
34153418 def AnyValClass : Symbol
34163419
Original file line number Diff line number Diff line change 1+ trait M0 extends Matchable // inferred base type is AnyRef
2+ trait M extends Any , Matchable
3+
4+ class C extends Matchable // OK inferred base type is AnyRef
5+ class D (x : Int ) extends AnyVal , Matchable // OK
6+ class E extends AnyRef , Matchable // OK
7+ class F extends Any , Matchable // error: Any does not have a constructor
8+
9+ class C1 extends M // OK inferred base type is AnyRef
10+ class D1 (x : Int ) extends AnyVal , M // OK
11+ class E1 extends AnyRef , M // OK
12+ class F1 extends Any , M // error: Any does not have a constructor
13+
14+ class C2 extends M0 // OK inferred base type is AnyRef
15+ class D2 (x : Int ) extends AnyVal , M0 // error: illegal trait inheritance
16+ class E2 extends AnyRef , M0 // OK
17+ class F2 extends Any , M0 // error: Any does not have a constructor // error: illegal trait inheritance
18+
19+
20+
21+
22+
23+
Original file line number Diff line number Diff line change 11object Test {
22 def f [X ](x : X ) =
3+ ??? .getClass.getMethods.head.getParameterTypes.mkString(" ," )
4+ // this is the current behavior. But it would also be OK if `???.getClass` fails
35 x.getClass.getMethods.head.getParameterTypes.mkString(" ," )
46}
You can’t perform that action at this time.
0 commit comments