Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type checking of annotations seems to be broken #7010

Closed
scabug opened this issue Jan 23, 2013 · 3 comments
Closed

Type checking of annotations seems to be broken #7010

scabug opened this issue Jan 23, 2013 · 3 comments

Comments

@scabug
Copy link

scabug commented Jan 23, 2013

The following session of power REPL shows the problem. See comments below.

scala
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.

scala> class C {  @throws(classOf[Throwable]) def meh = ??? }
defined class C

scala> :power
** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'.          **
** scala.tools.nsc._ has been imported      **
** global._, definitions._ also imported    **
** Try  :help, :vals, power.<tab>           **

scala> typeOf[C].typeSymbol.info.member(newTermName("meh"))
res0: $r.intp.global.Symbol = method meh

scala> val ann = res0.annotations.head
ann: $r.intp.global.AnnotationInfo = throws[T](classOf[java.lang.Throwable])

scala> ann.atp.typeArgs
res1: List[$r.intp.global.Type] = List(T)

scala> res1.head.typeSymbol
res2: $r.intp.global.Symbol = type T

scala> res2.getClass
res3: Class[_ <: $r.intp.global.Symbol] = class scala.reflect.internal.Symbols$AbstractTypeSymbol

Last few lines verify that this is not printing problem. The type of annotation has type argument that is not determined. One could think that type inference does not happen for polymorphic annotations but Adriaan checked that and it turns out that we properly type the annotation (including performing correct type inference) but somehow that tree doesn't get back to DefDef node.

@scabug
Copy link
Author

scabug commented Jan 23, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7010?orig=1
Reporter: @gkossakowski
Affected Versions: 2.10.0
Duplicates #6860

@scabug
Copy link
Author

scabug commented Feb 4, 2013

@xeno-by said:
Duplicate of #6860

@scabug scabug closed this as completed Feb 4, 2013
@scabug
Copy link
Author

scabug commented Feb 4, 2013

@gkossakowski said:
Eugene, thanks for closing it. In the future it would be great if you could link (using More actions -> Link) to the issue being duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant