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
Welcome to Scala2.12.0-M3 (JavaHotSpot(TM) 64-BitServerVM, Java1.8.0_60).
Type in expressions for evaluation. Ortry:help.
scala> (newArray[Byte](2)).sameElements(Array(0x1F, 0x8B))
<console>:12:warning: a typewas inferred to be `AnyVal`; this may indicate a programming error.
(newArray[Byte](2)).sameElements(Array(0x1F, 0x8B))
^
res0:Boolean=false
scala>deff=if ((newArray[Byte](2)).sameElements(Array(0x1F, 0x8B))) trueelsefalse
<console>:11:warning: a typewas inferred to be `AnyVal`; this may indicate a programming error.
deff=if ((newArray[Byte](2)).sameElements(Array(0x1F, 0x8B))) trueelsefalse
^
f:Boolean
@retronym said (edited on Feb 1, 2016 6:06:43 AM UTC): methTypeArgs should accept an extra parameter with the position of the fn tree, rather than trying to reverse engineer the position by throwing darts, blindfolded, at context.tree.
defargumentPosition(idx: Int):Position= context.tree match {
casex: ValOrDefDef=> x.rhs match {
caseApply(fn, args) if idx < args.size => args(idx).pos
case _ => context.tree.pos
}
case _ => context.tree.pos
}
if (settings.warnInferAny && context.reportErrors && canWarnAboutAny) {
foreachWithIndex(targs) ((targ, idx) =>
targ.typeSymbol match {
case sym @ (AnyClass|AnyValClass) =>
reporter.warning(argumentPosition(idx), s"a type was inferred to be `${sym.name}`; this may indicate a programming error.")
case _ =>
}
)
}
Scala 2.11.x for a function:
reports: a type was inferred to be
AnyVal
; this may indicate a programming error.Although an compilation problem corresponds to: signature.sameElements(Array(0x1F, 0x8B)) where second array is Array[Int] and not Array[Byte].
http://stackoverflow.com/questions/35104769/scala-anyval-inferred-instead-of-inputstream
The text was updated successfully, but these errors were encountered: