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
This looks similar to #4024. I am very pleased that the compiler is giving itself variance advice.
classA {
valclazz=Class.forName("xxx")
valctr= clazz.getConstructor(Nil: _*)
// also crashes// val ctr = clazz.getConstructor(List(): _*)//// does not crash// val ctr = clazz.getConstructor(List[Class[_]]: _*)
}
[paulp@leaf bug]$$ scalac29 a.scala
exception when traversing A.this.clazz.getConstructor((immutable.this.Nil: _*))
exception when traversing private[this] valctr: java.lang.reflect.Constructor[_] =A.this.clazz.getConstructor((immutable.this.Nil: _*))
exception when traversing java.lang.ObjectwithScalaObject {
defthis():A= {
A.super.this();
()
};
private[this] valclazz: java.lang.Class[_] = java.this.lang.Class.forName("xxx");
...
Exception in thread "main" scala.tools.nsc.symtab.Types$$TypeError:typemismatch;
found : scala.reflect.Manifest[Nothing]
required: scala.reflect.ClassManifest[B]
Note:Nothing<:B, but traitClassManifest is invariant in typeT.
You may wish to investigate a wildcard typesuch as `_ <: B`. (SLS3.2.10)
at scala.tools.nsc.typechecker.Contexts$$Context.error(Contexts.scala:291)
at scala.tools.nsc.typechecker.Infer$$Inferencer.error(Infer.scala:205)
at scala.tools.nsc.typechecker.Infer$$Inferencer.typeError(Infer.scala:215)
at scala.tools.nsc.typechecker.Infer$$Inferencer.typeErrorTree(Infer.scala:230)
at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:926)
at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4142)
at scala.tools.nsc.typechecker.Typers$$Typer.typedArg(Typers.scala:2131)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$3.apply(Typers.scala:2144)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$3.apply(Typers.scala:2143)
The text was updated successfully, but these errors were encountered:
@paulp said:
This looks to be a duplicate of the first comment in the now-reopened #4024, which I reported a couple months before this one. Am I duplicating my own tickets? There's a sobering idea.
This looks similar to #4024. I am very pleased that the compiler is giving itself variance advice.
The text was updated successfully, but these errors were encountered: