Warn that implicit should have explicit type [ci: last-only]
Implicit definitions are required to have an explicit type ascribed in Scala 3. Now Scala 2 warns if the type is missing (and therefore inferred). Under -Xsource:3, the warning becomes an error. (Local implicits are exempted because they are not available before they are defined.)
Fixes scala/bug#5265
-Werror FTW.
[error] /home/jenkins/workspace/scala-2.13.x-validate-main/src/reflect/scala/reflect/api/Internals.scala:1101:18: Implicit definition should have explicit type
[error] implicit val token = new CompatToken
[error] ^
[error] one error found
Fields are not marked implicit, and can't access the accessor without cycles, so mark it and check when typing the getter.
/rebuild
(https://scala-ci.typesafe.com/job/scala-2.13.x-validate-main/16292 got stuck)
meanwhile, Travis-CI has failure information
I didn't switch to draft after handling val, and still doesn't handle val in traits. Plus cycle of test breakage.
Hung again. I don't see the red ex for canceling jenkins job.
Travis:
[info] + IndexScript.allPackages: OK, proved property.
[info] Elapsed time: 0.432 sec
failing seed for mutable.TreeMapProjection.get, contains is WGrJJZh_6eL-dRMg_fX5Komy1UboU3eTd2SlGrJ3d9G=
[info] ! mutable.TreeMapProjection.get, contains: Exception raised on property evaluation.
[info] > ARG_0: HashMap( -> 0)
[info] > ARG_1: None
[info] > ARG_2: Some()
[info] > ARG_0_ORIGINAL: HashMap(պ -> -2147483648)
[info] > ARG_1_ORIGINAL: Some()
[info] > Exception: java.lang.NullPointerException: null
[info] scala.collection.mutable.TreeMap$TreeMapProjection.isInsideViewBounds(TreeMap.scala:193)
[info] scala.collection.mutable.TreeMap$TreeMapProjection.contains(TreeMap.scala:211)
[info] scala.collection.mutable.MutableTreeMapProjectionProperties$.$anonfun$new$125(MutableTreeMap.scala:238)
[info] scala.collection.mutable.MutableTreeMapProjectionProperties$.$anonfun$new$125$adapted(MutableTreeMap.scala:237)
[info] scala.collection.IterableOnceOps.forall(IterableOnce.scala:589)
[info] scala.collection.IterableOnceOps.forall$(IterableOnce.scala:586)
[info] scala.collection.AbstractIterable.forall(Iterable.scala:933)
[info] scala.collection.mutable.MutableTreeMapProjectionProperties$.$anonfun$new$124(MutableTreeMap.scala:237)
[info] scala.collection.mutable.MutableTreeMapProjectionProperties$.$anonfun$new$124$adapted(MutableTreeMap.scala:230)
Locally,
[info] + Range inclusiveByOne.foreach.visited.size: OK, passed 100 tests.
[info] Elapsed time: 0.002 sec
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fad5f9c03fc, pid=30176, tid=30206
#
# JRE version: OpenJDK Runtime Environment (18.0.1.1+2) (build 18.0.1.1+2-6)
# Java VM: OpenJDK 64-Bit Server VM (18.0.1.1+2-6, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xd263fc][info] + Range inclusiveByOne.sum: OK, passed 100 tests.
[info] Elapsed time: 0.002 sec
[info] + Range inclusiveByOne.sumCustomNumeric: OK, passed 100 tests.
[info] Elapsed time: 0.004 sec
Travis says both
export ADOPTOPENJDK=8
$ java -Xmx32m -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
$ javac -J-Xmx32m -version
javac 11.0.2
I should have @SethTisue about cancel culture.
canceled another stuck Jenkins job just now. signed, The Canceler
Oops sorry @SethTisue I forgot to diagnose the hang slash crash. I pushed so I could view diffs.
While I was mechanically adding inferred types, I didn't notice:
- implicit val ord = implicitly[Ordering[K]]
+ private val ord = implicitly[Ordering[K]]
A clean repo crashes in scalacheck/test on latest 18. It would be nice if you could tell which test.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f87d3cd4acc, pid=1203, tid=1219
#
# JRE version: OpenJDK Runtime Environment (18.0.2.1+1) (build 18.0.2.1+1-1)
# Java VM: OpenJDK 64-Bit Server VM (18.0.2.1+1-1, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xd27acc] SubTypeCheckNode::sub(Type const*, Type const*) const+0x26c
Current thread (0x00007f87cc0d0830): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=1219, stack(0x00007f87a84ad000,0x00007f87a85ae000)]
Current CompileTask:
C2: 5155 9279 4 scala.collection.ArrayOps$::prepended$extension (48 bytes)
It's the old space after [ci:] gotcha!
I'll re-squash after @lrytz review.
A clean repo crashes in scalacheck/test on latest 18
mind opening a scala-dev ticket on that?
Could add a lint option if not -Xsource:3? Usually it's deprecation then error.
let's figure this out for ~2.13.10~ 2.13.11
@som-snytt mind resolving the merge conflict? where does this stand, do you believe it is ready for review?
@som-snytt /me turns on the machine that goes "ping!"
Note that this impacts macro authors too; see https://github.com/scala/bug/issues/12798