You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can't properly type annotation arguments which are empty array
literals because we would need the corresponding parameter type which
would require forcing the annotation constructor early. The previous
commit worked around this by using `WildcardType` as the element type
but that's a hack. Instead, we can fix the problem by always storing
annotation arguments as untyped trees and using `applyOverloaded` to
type them when the annotation tree is forced. This requires some
refactoring to make `applyOverloaded` work both with typed and untyped
arguments (the variants are now accessible using `untpd.applyOverloaded`
and `tpd.applyOverloaded`).
(the abstract `def FunProto` in Trees that gets implemented by
forwarding in untpd/tpd sounds like a good candidate for `export`,
except we can't export a class constructor)
i"matching alternatives: ${alternatives.map(_.symbol.showDcl).mkString(", ")}.") // this is parsed from bytecode tree. there's nothing user can do about it
i"matching alternatives: ${alternatives.map(_.symbol.showDcl).mkString(", ")}.") // this is parsed from bytecode tree. there's nothing user can do about it
if (skip) NoneelseSome(Literal(Constant(pool.getName(index).toString)))
501
+
if (skip) NoneelseSome(lit(Constant(pool.getName(index).toString)))
489
502
caseBOOL_TAG|BYTE_TAG|CHAR_TAG|SHORT_TAG=>
490
-
if (skip) NoneelseSome(Literal(pool.getConstant(index, tag)))
503
+
if (skip) NoneelseSome(lit(pool.getConstant(index, tag)))
491
504
caseINT_TAG|LONG_TAG|FLOAT_TAG|DOUBLE_TAG=>
492
-
if (skip) NoneelseSome(Literal(pool.getConstant(index)))
505
+
if (skip) NoneelseSome(lit(pool.getConstant(index)))
493
506
caseCLASS_TAG=>
494
-
if (skip) NoneelseSome(Literal(Constant(pool.getType(index))))
507
+
if (skip) NoneelseSome(lit(Constant(pool.getType(index))))
495
508
caseENUM_TAG=>
496
509
valt= pool.getType(index)
497
510
valn= pool.getName(in.nextChar)
@@ -500,7 +513,7 @@ class ClassfileParser(
500
513
if (skip)
501
514
None
502
515
elseif (s !=NoSymbol)
503
-
Some(Literal(Constant(s)))
516
+
Some(lit(Constant(s)))
504
517
else {
505
518
ctx.warning(s"""While parsing annotations in ${in.file}, could not find $n in enum $module.\nThis is likely due to an implementation restriction: an annotation argument cannot refer to a member of the annotated class (SI-7014).""")
506
519
None
@@ -517,10 +530,7 @@ class ClassfileParser(
517
530
elseif (skip) None
518
531
else {
519
532
valelems= arr.toList
520
-
valelemType=
521
-
if (elems.isEmpty) WildcardType// No way to figure out the element type without forcing the annotation constructor
0 commit comments