File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -446,16 +446,15 @@ object SymDenotations {
446
446
447
447
/** The name given in an `@alpha` annotation if one is present, `name` otherwise */
448
448
final def erasedName (implicit ctx : Context ): Name =
449
- if (isTerm)
450
- getAnnotation(defn.AlphaAnnot ) match {
451
- case Some (ann) =>
452
- ann.arguments match {
453
- case Literal (Constant (str : String )) :: Nil => str.toTermName
454
- case _ => name
455
- }
456
- case _ => name
457
- }
458
- else name
449
+ getAnnotation(defn.AlphaAnnot ) match {
450
+ case Some (ann) =>
451
+ ann.arguments match {
452
+ case Literal (Constant (str : String )) :: Nil =>
453
+ if (isType) str.toTypeName else str.toTermName
454
+ case _ => name
455
+ }
456
+ case _ => name
457
+ }
459
458
460
459
// ----- Tests -------------------------------------------------
461
460
Original file line number Diff line number Diff line change 4
4
public class Test_2 {
5
5
6
6
public static void main (String [] args ) {
7
- Alpha <String > a = new Beta ();
7
+ Alpha <String > a = new Bar ();
8
8
assert a .foo () == 1 ;
9
9
assert a .bar ("a" ).equals ("aa" );
10
10
Alpha <String > aa = a .append (a );
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ abstract class Alpha[T] {
11
11
12
12
}
13
13
14
- class Beta extends Alpha [String ] {
14
+ @ alpha( " Bar " ) class | extends Alpha [String ] {
15
15
16
16
@ alpha(" bar" ) override def foo (x : String ) = x ++ x
17
17
You can’t perform that action at this time.
0 commit comments