Skip to content

Commit b84ecc5

Browse files
committed
Merge remote-tracking branch 'origin/2.10.0-wip' into merge-2.10-wip
# By Eugene Burmako (1) and others # Via Adriaan Moors (2) and others * origin/2.10.0-wip: Fixing OSGi distribution. Fix for rangepos crasher. SI-6685 fixes error handling in typedApply
2 parents edbcc64 + 18481ce commit b84ecc5

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

build.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2672,7 +2672,12 @@ DISTRIBUTION
26722672
<target name="dist.base" depends="dist.start">
26732673
<mkdir dir="${dist.dir}/lib"/>
26742674
<copy toDir="${dist.dir}/lib">
2675-
<fileset dir="${build-pack.dir}/lib"/>
2675+
<fileset dir="${build-pack.dir}/lib">
2676+
<include name="jline.jar"/>
2677+
<include name="scalacheck.jar"/>
2678+
<include name="scala-partest.jar"/>
2679+
<include name="scalap.jar"/>
2680+
</fileset>
26762681
</copy>
26772682
<mkdir dir="${dist.dir}/bin"/>
26782683
<!-- TODO - Stop being inefficient and don't copy OSGi bundles overtop other jars. -->

src/compiler/scala/tools/nsc/typechecker/Typers.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3367,12 +3367,13 @@ trait Typers extends Modes with Adaptations with Tags {
33673367
// println(util.Position.formatMessage(uncheckedPattern.pos, "made unchecked type test into a checked one", true))
33683368

33693369
val args = List(uncheckedPattern)
3370+
val app = atPos(uncheckedPattern.pos)(Apply(classTagExtractor, args))
33703371
// must call doTypedUnapply directly, as otherwise we get undesirable rewrites
33713372
// and re-typechecks of the target of the unapply call in PATTERNmode,
33723373
// this breaks down when the classTagExtractor (which defineds the unapply member) is not a simple reference to an object,
33733374
// but an arbitrary tree as is the case here
3374-
doTypedUnapply(Apply(classTagExtractor, args), classTagExtractor, classTagExtractor, args, PATTERNmode, pt)
3375-
}
3375+
doTypedUnapply(app, classTagExtractor, classTagExtractor, args, PATTERNmode, pt)
3376+
}
33763377

33773378
// if there's a ClassTag that allows us to turn the unchecked type test for `pt` into a checked type test
33783379
// return the corresponding extractor (an instance of ClassTag[`pt`])
@@ -4517,12 +4518,11 @@ trait Typers extends Modes with Adaptations with Tags {
45174518
// [Eugene] no more MaxArrayDims. ClassTags are flexible enough to allow creation of arrays of arbitrary dimensionality (w.r.t JVM restrictions)
45184519
val Some((level, componentType)) = erasure.GenericArray.unapply(tpt.tpe)
45194520
val tagType = List.iterate(componentType, level)(tpe => appliedType(ArrayClass.toTypeConstructor, List(tpe))).last
4520-
val newArrayApp = atPos(tree.pos) {
4521+
atPos(tree.pos) {
45214522
val tag = resolveClassTag(tree.pos, tagType)
45224523
if (tag.isEmpty) MissingClassTagError(tree, tagType)
4523-
else new ApplyToImplicitArgs(Select(tag, nme.newArray), args)
4524+
else typed(new ApplyToImplicitArgs(Select(tag, nme.newArray), args))
45244525
}
4525-
typed(newArrayApp, mode, pt)
45264526
case Apply(Select(fun, nme.apply), _) if treeInfo.isSuperConstrCall(fun) => //SI-5696
45274527
TooManyArgumentListsForConstructor(tree)
45284528
case tree1 =>

test/files/pos/classtag-pos.flags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Yrangepos

test/files/pos/classtag-pos.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import scala.reflect.runtime.universe._
2+
3+
class A {
4+
def f[T: TypeTag] = typeOf[T] match { case TypeRef(_, _, args) => args }
5+
}

0 commit comments

Comments
 (0)