diff options
-rw-r--r-- | src/actors/scala/actors/scheduler/ThreadPoolConfig.scala | 5 | ||||
-rw-r--r-- | src/build/maven/maven-deploy.xml | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 9 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala | 6 | ||||
-rw-r--r-- | src/library/scala/util/Properties.scala | 16 | ||||
-rw-r--r-- | test/files/neg/t7473.check | 7 | ||||
-rw-r--r-- | test/files/neg/t7473.scala | 7 | ||||
-rw-r--r-- | test/files/pos/lub-dealias-widen.scala | 34 |
8 files changed, 69 insertions, 21 deletions
diff --git a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala index ee8776f397..bfd4e7ac40 100644 --- a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala +++ b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala @@ -42,10 +42,7 @@ private[actors] object ThreadPoolConfig { (propIsSetTo("actors.enableForkJoin", "true") || { Debug.info(this+": java.version = "+javaVersion) Debug.info(this+": java.vm.vendor = "+javaVmVendor) - - // on IBM J9 1.6 do not use ForkJoinPool - // XXX this all needs to go into Properties. - isJavaAtLeast("1.6") && ((javaVmVendor contains "Oracle") || (javaVmVendor contains "Sun") || (javaVmVendor contains "Apple")) + isJavaAtLeast("1.6") }) catch { case _: SecurityException => false diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml index bd946bf0f3..e70173319e 100644 --- a/src/build/maven/maven-deploy.xml +++ b/src/build/maven/maven-deploy.xml @@ -164,11 +164,7 @@ <attribute name="repository" /> <attribute name="version" /> <sequential> - <deploy-remote name="scala-library" version="@{version}" repository="@{repository}"> - <extra-attachments> - <artifact:attach type="jar" file="scala-library/scala-library-docs.jar" classifier="javadoc" /> - </extra-attachments> - </deploy-remote> + <deploy-remote name="scala-library" version="@{version}" repository="@{repository}"/> <deploy-remote name="jline" version="@{version}" repository="@{repository}"/> <deploy-remote name="scala-reflect" version="@{version}" repository="@{repository}"/> <deploy-remote name="scala-compiler" version="@{version}" repository="@{repository}" /> diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index b8791c15dc..50398824e1 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1474,8 +1474,9 @@ self => * }}} */ def postfixExpr(): Tree = { - val base = opstack - var top = prefixExpr() + val start = in.offset + val base = opstack + var top = prefixExpr() while (isIdent) { top = reduceStack(isExpr = true, base, top, precedence(in.name), leftAssoc = treeInfo.isLeftAssoc(in.name)) @@ -1493,9 +1494,7 @@ self => val topinfo = opstack.head opstack = opstack.tail val od = stripParens(reduceStack(isExpr = true, base, topinfo.operand, 0, leftAssoc = true)) - return atPos(od.pos.startOrPoint, topinfo.offset) { - new PostfixSelect(od, topinfo.operator.encode) - } + return makePostfixSelect(start, topinfo.offset, od, topinfo.operator) } } reduceStack(isExpr = true, base, top, 0, leftAssoc = true) diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index b5771454f8..e92c3e1654 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -245,6 +245,12 @@ abstract class TreeBuilder { Assign(lhs, rhs) } + /** Tree for `od op`, start is start0 if od.pos is borked. */ + def makePostfixSelect(start0: Int, end: Int, od: Tree, op: Name): Tree = { + val start = if (od.pos.isDefined) od.pos.startOrPoint else start0 + atPos(r2p(start, end, end)) { new PostfixSelect(od, op.encode) } + } + /** A type tree corresponding to (possibly unary) intersection type */ def makeIntersectionTypeTree(tps: List[Tree]): Tree = if (tps.tail.isEmpty) tps.head diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala index cc145134c4..3cd6eb8659 100644 --- a/src/library/scala/util/Properties.scala +++ b/src/library/scala/util/Properties.scala @@ -72,7 +72,7 @@ private[scala] trait PropertiesTrait { * it is an RC, Beta, etc. or was built from source, or if the version * cannot be read. */ - val releaseVersion = + val releaseVersion = for { v <- scalaPropOrNone("maven.version.number") if !(v endsWith "-SNAPSHOT") @@ -86,7 +86,7 @@ private[scala] trait PropertiesTrait { * @return Some(version) if this is a non-final version, None if this * is a final release or the version cannot be read. */ - val developmentVersion = + val developmentVersion = for { v <- scalaPropOrNone("maven.version.number") if v endsWith "-SNAPSHOT" @@ -119,8 +119,7 @@ private[scala] trait PropertiesTrait { */ def lineSeparator = propOrElse("line.separator", "\n") - /** Various well-known properties. - */ + /* Various well-known properties. */ def javaClassPath = propOrEmpty("java.class.path") def javaHome = propOrEmpty("java.home") def javaVendor = propOrEmpty("java.vendor") @@ -136,10 +135,13 @@ private[scala] trait PropertiesTrait { def userHome = propOrEmpty("user.home") def userName = propOrEmpty("user.name") - /** Some derived values. - */ + /* Some derived values. */ + /** Returns `true` iff the underlying operating system is a version of Microsoft Windows. */ def isWin = osName startsWith "Windows" - def isMac = javaVendor startsWith "Apple" + // See http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-November/005148.html for + // the reason why we don't follow developer.apple.com/library/mac/#technotes/tn2002/tn2110. + /** Returns `true` iff the underlying operating system is a version of Apple Mac OSX. */ + def isMac = osName startsWith "Mac OS X" // This is looking for javac, tools.jar, etc. // Tries JDK_HOME first, then the more common but likely jre JAVA_HOME, diff --git a/test/files/neg/t7473.check b/test/files/neg/t7473.check new file mode 100644 index 0000000000..bc8c29d463 --- /dev/null +++ b/test/files/neg/t7473.check @@ -0,0 +1,7 @@ +t7473.scala:6: error: '<-' expected but '=' found. + (for (x = Option(i); if x == j) yield 42) toList + ^ +t7473.scala:6: error: illegal start of simple expression + (for (x = Option(i); if x == j) yield 42) toList + ^ +two errors found diff --git a/test/files/neg/t7473.scala b/test/files/neg/t7473.scala new file mode 100644 index 0000000000..593231d5f2 --- /dev/null +++ b/test/files/neg/t7473.scala @@ -0,0 +1,7 @@ + +object Foo { + val i,j = 3 + //for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found. + // evil postfix! + (for (x = Option(i); if x == j) yield 42) toList +} diff --git a/test/files/pos/lub-dealias-widen.scala b/test/files/pos/lub-dealias-widen.scala new file mode 100644 index 0000000000..38854fbc5c --- /dev/null +++ b/test/files/pos/lub-dealias-widen.scala @@ -0,0 +1,34 @@ +import scala.language.higherKinds + +sealed trait Path { + type EncodeFunc + type Route[R] = List[String] => R + + def >>(f: Route[Int]): Sitelet[EncodeFunc] = ??? +} + +case object PAny extends Path { + type EncodeFunc = List[String] => String +} + +case class PLit[Next <: Path]() extends Path { + type EncodeFunc = Next#EncodeFunc +} + +trait Sitelet[EncodeFunc] { self => + def &[G <: H, H >: EncodeFunc](that: Sitelet[G]): Sitelet[H] = ??? +} + +object Test { + val r: Sitelet[Int => (Int => String)] = ??? + + val p2: PLit[PAny.type] = ??? + val r2 /*: Sitelet[List[String] => String] */ // annotate type and it compiles with 2.10.0 + = p2 >> { (xs: List[String]) => 0 } + + // This works after https://github.com/scala/scala/commit/a06d31f6a + // Before: error: inferred type arguments [List[String] => String,List[String] => String] + // do not conform to method &'s type parameter bounds + // [G <: H,H >: Int => (Int => String)] + val s = r & r2 +}
\ No newline at end of file |