summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/disabled/run/t7843-jsr223-service.scala18
-rw-r--r--test/files/filters2
-rw-r--r--test/files/jvm/t6941/Analyzed_1.scala2
-rw-r--r--test/files/neg/abstract-report2.check8
-rw-r--r--test/files/neg/abstract-report2.scala6
-rw-r--r--test/files/neg/accesses.check6
-rw-r--r--test/files/neg/accesses2.check10
-rw-r--r--test/files/neg/missing-param-type-tuple.check6
-rw-r--r--test/files/neg/names-defaults-neg.check2
-rw-r--r--test/files/neg/no-implicit-to-anyref-any-val.check34
-rw-r--r--test/files/neg/no-implicit-to-anyref-any-val.scala (renamed from test/files/neg/no-implicit-to-anyref.scala)4
-rw-r--r--test/files/neg/no-implicit-to-anyref.check22
-rw-r--r--test/files/neg/quasiquotes-syntax-error-position.check5
-rw-r--r--test/files/neg/quasiquotes-syntax-error-position.scala3
-rw-r--r--test/files/neg/stringinterpolation_macro-neg.check134
-rw-r--r--test/files/neg/stringinterpolation_macro-neg.scala45
-rw-r--r--test/files/neg/t6844.check6
-rw-r--r--test/files/neg/t6844.scala5
-rw-r--r--test/files/neg/t7325.check8
-rw-r--r--test/files/neg/t8143a.check5
-rw-r--r--test/files/neg/t8143a.scala15
-rw-r--r--test/files/neg/t8182.check22
-rw-r--r--test/files/neg/t8182.scala18
-rw-r--r--test/files/neg/t8207.check7
-rw-r--r--test/files/neg/t8207.scala3
-rw-r--r--test/files/neg/t8228.check4
-rw-r--r--test/files/neg/t8228.scala7
-rw-r--r--test/files/neg/t8237-default.check13
-rw-r--r--test/files/neg/t8237-default.scala29
-rw-r--r--test/files/pos/annotated-original/M_1.scala2
-rw-r--r--test/files/pos/annotated-treecopy/Impls_Macros_1.scala2
-rw-r--r--test/files/pos/implicit-anyval-2.10.flags1
-rw-r--r--test/files/pos/implicit-anyval-2.10.scala3
-rw-r--r--test/files/pos/t2066-2.10-compat.flags1
-rw-r--r--test/files/pos/t2066-2.10-compat.scala71
-rw-r--r--test/files/pos/t6169/Exist.java4
-rw-r--r--test/files/pos/t6169/ExistF.java4
-rw-r--r--test/files/pos/t6169/ExistIndir.java4
-rw-r--r--test/files/pos/t6169/OP.java1
-rw-r--r--test/files/pos/t6169/Skin.java1
-rw-r--r--test/files/pos/t6169/Skinnable.java3
-rw-r--r--test/files/pos/t6169/skinnable.scala14
-rw-r--r--test/files/pos/t6169/t6169.scala7
-rw-r--r--test/files/pos/t7322.scala11
-rw-r--r--test/files/pos/t7377/Macro_1.scala2
-rw-r--r--test/files/pos/t7516/A_1.scala2
-rw-r--r--test/files/pos/t7919.scala6
-rw-r--r--test/files/pos/t8064/Macro_1.scala2
-rw-r--r--test/files/pos/t8170.scala27
-rw-r--r--test/files/pos/t8170b.scala25
-rw-r--r--test/files/pos/t8207.scala6
-rw-r--r--test/files/pos/t8237.scala29
-rw-r--r--test/files/pos/t8237b.scala10
-rw-r--r--test/files/run/global-showdef.scala2
-rw-r--r--test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala2
-rw-r--r--test/files/run/private-override.scala17
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.check2
-rw-r--r--test/files/run/reflection-sync-potpourri.scala (renamed from test/pending/run/reflection-sync-potpourri.scala)2
-rw-r--r--test/files/run/stringinterpolation_macro-run.check5
-rw-r--r--test/files/run/stringinterpolation_macro-run.scala15
-rw-r--r--test/files/run/t6261.scala7
-rw-r--r--test/files/run/t6411a.check96
-rw-r--r--test/files/run/t6411a.scala81
-rw-r--r--test/files/run/t6411b.check1
-rw-r--r--test/files/run/t6411b.scala12
-rw-r--r--test/files/run/t7240/Macros_1.scala2
-rw-r--r--test/files/run/t7319.check2
-rw-r--r--test/files/run/t7328.check4
-rw-r--r--test/files/run/t7328.scala18
-rw-r--r--test/files/run/t7445.scala6
-rw-r--r--test/files/run/t7700.check2
-rw-r--r--test/files/run/t7700.scala17
-rw-r--r--test/files/run/t7843-jsr223-service.check (renamed from test/disabled/run/t7843-jsr223-service.check)0
-rw-r--r--test/files/run/t7843-jsr223-service.scala8
-rw-r--r--test/files/run/t7933.check2
-rw-r--r--test/files/run/t7933.scala11
-rw-r--r--test/files/run/t8199.scala105
-rw-r--r--test/files/run/t8233-bcode.flags1
-rw-r--r--test/files/run/t8233-bcode.scala18
-rw-r--r--test/files/run/t8233.scala18
-rw-r--r--test/files/run/t8245.scala14
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala67
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala106
-rw-r--r--test/files/scalacheck/quasiquotes/ErrorProps.scala28
-rw-r--r--test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala12
-rw-r--r--test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala5
-rw-r--r--test/files/scalacheck/quasiquotes/TermConstructionProps.scala82
-rw-r--r--test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala53
-rw-r--r--test/files/scalacheck/quasiquotes/TypeConstructionProps.scala8
-rw-r--r--test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala38
-rw-r--r--test/files/scalacheck/quasiquotes/TypecheckedProps.scala9
-rw-r--r--test/junit/scala/collection/SetMapConsistencyTest.scala31
-rw-r--r--test/junit/scala/reflect/internal/util/SourceFileTest.scala55
-rw-r--r--test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala1
-rw-r--r--test/osgi/src/BasicReflection.scala2
-rw-r--r--test/osgi/src/ScalaOsgiHelper.scala6
-rw-r--r--test/pending/run/idempotency-partial-functions.scala2
-rw-r--r--test/scaladoc/resources/SI-4014_0.scala4
-rw-r--r--test/scaladoc/resources/SI-4014_1.scala5
-rw-r--r--test/scaladoc/resources/SI-4014_2.scala6
-rw-r--r--test/scaladoc/run/t7124.check3
-rw-r--r--test/scaladoc/run/t7124.scala22
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala46
103 files changed, 1552 insertions, 196 deletions
diff --git a/test/disabled/run/t7843-jsr223-service.scala b/test/disabled/run/t7843-jsr223-service.scala
deleted file mode 100644
index e2ea850698..0000000000
--- a/test/disabled/run/t7843-jsr223-service.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-/*DISABLED:
- For Paul, it steals focus when it runs.
-
- For me, it fails with some platform specific extra output:
-
- -ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider apple.applescript.AppleScriptEngin
- n: Object = 10
- 12345678910
-*/
-import javax.script._
-import scala.tools.nsc.interpreter.IMain
-
-object Test extends App {
- val engine = new ScriptEngineManager getEngineByName "scala"
- engine.asInstanceOf[IMain].settings.usejavacp.value = true
- engine put ("n", 10)
- engine eval "1 to n.asInstanceOf[Int] foreach print"
-}
diff --git a/test/files/filters b/test/files/filters
index 70d7dcff70..51a7507848 100644
--- a/test/files/filters
+++ b/test/files/filters
@@ -4,3 +4,5 @@ Java HotSpot\(TM\) .* warning:
# Hotspot receiving VM options through the $_JAVA_OPTIONS
# env variable outputs them on stderr
Picked up _JAVA_OPTIONS:
+# Filter out a message caused by this bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8021205
+objc\[\d+\]: Class JavaLaunchHelper is implemented in both .* and .*\. One of the two will be used\. Which one is undefined\.
diff --git a/test/files/jvm/t6941/Analyzed_1.scala b/test/files/jvm/t6941/Analyzed_1.scala
index 549abd5e64..b6951f71ee 100644
--- a/test/files/jvm/t6941/Analyzed_1.scala
+++ b/test/files/jvm/t6941/Analyzed_1.scala
@@ -6,6 +6,6 @@ class SameBytecode {
}
def b(xs: List[Int]) = xs match {
- case xs: ::[Int] => xs.hd$1
+ case xs: ::[Int] => xs.head
}
} \ No newline at end of file
diff --git a/test/files/neg/abstract-report2.check b/test/files/neg/abstract-report2.check
index 6ea949353a..9be3d822f2 100644
--- a/test/files/neg/abstract-report2.check
+++ b/test/files/neg/abstract-report2.check
@@ -61,7 +61,7 @@ it has 13 unimplemented members.
class Baz[T] extends Collection[T]
^
-abstract-report2.scala:11: error: class Dingus needs to be abstract, since:
+abstract-report2.scala:15: error: class Dingus needs to be abstract, since:
it has 24 unimplemented members.
/** As seen from class Dingus, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
@@ -84,9 +84,6 @@ it has 24 unimplemented members.
def toIterator: Iterator[(Set[Int], String)] = ???
def toStream: Stream[(Set[Int], String)] = ???
- // Members declared in scala.math.Ordering
- def compare(x: List[Int],y: List[Int]): Int = ???
-
// Members declared in scala.collection.TraversableOnce
def copyToArray[B >: (Set[Int], String)](xs: Array[B],start: Int,len: Int): Unit = ???
def exists(p: ((Set[Int], String)) => Boolean): Boolean = ???
@@ -98,6 +95,9 @@ it has 24 unimplemented members.
def seq: scala.collection.TraversableOnce[(Set[Int], String)] = ???
def toTraversable: Traversable[(Set[Int], String)] = ???
+ // Members declared in Xyz
+ def foo(x: List[Int]): Boolean = ???
+
class Dingus extends Bippy[String, Set[Int], List[Int]]
^
four errors found
diff --git a/test/files/neg/abstract-report2.scala b/test/files/neg/abstract-report2.scala
index b6327b0766..8825340d4a 100644
--- a/test/files/neg/abstract-report2.scala
+++ b/test/files/neg/abstract-report2.scala
@@ -6,6 +6,10 @@ class Bar extends Collection[List[_ <: String]]
class Baz[T] extends Collection[T]
-trait Bippy[T1, T2, T3] extends Collection[T1] with TraversableOnce[(T2, String)] with Ordering[T3]
+trait Xyz[T] {
+ def foo(x: T): Boolean
+}
+
+trait Bippy[T1, T2, T3] extends Collection[T1] with TraversableOnce[(T2, String)] with Xyz[T3]
class Dingus extends Bippy[String, Set[Int], List[Int]] \ No newline at end of file
diff --git a/test/files/neg/accesses.check b/test/files/neg/accesses.check
index 5a5e03233e..db58af12ce 100644
--- a/test/files/neg/accesses.check
+++ b/test/files/neg/accesses.check
@@ -1,3 +1,7 @@
+accesses.scala:23: error: overriding method f2 in class A of type ()Unit;
+ method f2 has weaker access privileges; it should not be private
+ private def f2(): Unit = ()
+ ^
accesses.scala:24: error: overriding method f3 in class A of type ()Unit;
method f3 has weaker access privileges; it should be at least protected
private[p2] def f3(): Unit = ()
@@ -10,4 +14,4 @@ accesses.scala:26: error: overriding method f5 in class A of type ()Unit;
method f5 has weaker access privileges; it should be at least protected[p1]
protected[p2] def f5(): Unit
^
-three errors found
+four errors found
diff --git a/test/files/neg/accesses2.check b/test/files/neg/accesses2.check
index 554a7b4c81..66cf9a116e 100644
--- a/test/files/neg/accesses2.check
+++ b/test/files/neg/accesses2.check
@@ -1,4 +1,12 @@
+accesses2.scala:6: error: overriding method f2 in class A of type ()Int;
+ method f2 has weaker access privileges; it should not be private
+ private def f2(): Int = 1
+ ^
accesses2.scala:5: error: class B1 needs to be abstract, since method f2 in class A of type ()Int is not defined
class B1 extends A {
^
-one error found
+accesses2.scala:9: error: overriding method f2 in class A of type ()Int;
+ method f2 has weaker access privileges; it should not be private
+ private def f2(): Int = 1
+ ^
+three errors found
diff --git a/test/files/neg/missing-param-type-tuple.check b/test/files/neg/missing-param-type-tuple.check
index bc46ba1023..3a4258ff8c 100644
--- a/test/files/neg/missing-param-type-tuple.check
+++ b/test/files/neg/missing-param-type-tuple.check
@@ -1,6 +1,6 @@
missing-param-type-tuple.scala:3: error: missing parameter type
Note: The expected type requires a one-argument function accepting a 2-Tuple.
- Consider a pattern matching anoynmous function, `{ case (a, b) => ... }`
+ Consider a pattern matching anonymous function, `{ case (a, b) => ... }`
val x: ((Int, Int)) => Int = (a, b) => 0
^
missing-param-type-tuple.scala:3: error: missing parameter type
@@ -8,7 +8,7 @@ missing-param-type-tuple.scala:3: error: missing parameter type
^
missing-param-type-tuple.scala:5: error: missing parameter type
Note: The expected type requires a one-argument function accepting a 3-Tuple.
- Consider a pattern matching anoynmous function, `{ case (param1, ..., param3) => ... }`
+ Consider a pattern matching anonymous function, `{ case (param1, ..., param3) => ... }`
val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0
^
missing-param-type-tuple.scala:5: error: missing parameter type
@@ -19,7 +19,7 @@ missing-param-type-tuple.scala:5: error: missing parameter type
^
missing-param-type-tuple.scala:7: error: missing parameter type
Note: The expected type requires a one-argument function accepting a 3-Tuple.
- Consider a pattern matching anoynmous function, `{ case (param1, ..., param3) => ... }`
+ Consider a pattern matching anonymous function, `{ case (param1, ..., param3) => ... }`
val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0
^
missing-param-type-tuple.scala:7: error: missing parameter type
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check
index 880ddc4327..20ddd55f1f 100644
--- a/test/files/neg/names-defaults-neg.check
+++ b/test/files/neg/names-defaults-neg.check
@@ -88,7 +88,7 @@ names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T
--- because ---
argument expression's type is not compatible with formal parameter type;
found : List[Int]
- required: ?T
+ required: ?T[?T[List[?T[X forSome { type X }]]]]
Error occurred in an application involving default arguments.
test4()
^
diff --git a/test/files/neg/no-implicit-to-anyref-any-val.check b/test/files/neg/no-implicit-to-anyref-any-val.check
new file mode 100644
index 0000000000..5953e1bd6d
--- /dev/null
+++ b/test/files/neg/no-implicit-to-anyref-any-val.check
@@ -0,0 +1,34 @@
+no-implicit-to-anyref-any-val.scala:11: error: the result type of an implicit conversion must be more specific than AnyRef
+ 1: AnyRef
+ ^
+no-implicit-to-anyref-any-val.scala:17: error: type mismatch;
+ found : Any
+ required: AnyRef
+ (null: Any): AnyRef
+ ^
+no-implicit-to-anyref-any-val.scala:21: error: type mismatch;
+ found : AnyVal
+ required: AnyRef
+ (0: AnyVal): AnyRef
+ ^
+no-implicit-to-anyref-any-val.scala:27: error: type mismatch;
+ found : Test.AV
+ required: AnyRef
+Note that AV extends Any, not AnyRef.
+Such types can participate in value classes, but instances
+cannot appear in singleton types or in reference comparisons.
+ new AV(0): AnyRef
+ ^
+no-implicit-to-anyref-any-val.scala:30: error: the result type of an implicit conversion must be more specific than AnyVal
+ "": AnyVal
+ ^
+no-implicit-to-anyref-any-val.scala:32: error: type mismatch;
+ found : Object
+ required: AnyVal
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method ArrowAssoc in object Predef of type [A](self: A)ArrowAssoc[A]
+ and method Ensuring in object Predef of type [A](self: A)Ensuring[A]
+ are possible conversion functions from Object to AnyVal
+ new Object() : AnyVal
+ ^
+6 errors found
diff --git a/test/files/neg/no-implicit-to-anyref.scala b/test/files/neg/no-implicit-to-anyref-any-val.scala
index 3e3d373e38..f5daf541af 100644
--- a/test/files/neg/no-implicit-to-anyref.scala
+++ b/test/files/neg/no-implicit-to-anyref-any-val.scala
@@ -26,4 +26,8 @@ object Test {
locally {
new AV(0): AnyRef
}
+
+ "": AnyVal
+
+ new Object() : AnyVal
}
diff --git a/test/files/neg/no-implicit-to-anyref.check b/test/files/neg/no-implicit-to-anyref.check
deleted file mode 100644
index fe417ad8b0..0000000000
--- a/test/files/neg/no-implicit-to-anyref.check
+++ /dev/null
@@ -1,22 +0,0 @@
-no-implicit-to-anyref.scala:11: error: the result type of an implicit conversion must be more specific than AnyRef
- 1: AnyRef
- ^
-no-implicit-to-anyref.scala:17: error: type mismatch;
- found : Any
- required: AnyRef
- (null: Any): AnyRef
- ^
-no-implicit-to-anyref.scala:21: error: type mismatch;
- found : AnyVal
- required: AnyRef
- (0: AnyVal): AnyRef
- ^
-no-implicit-to-anyref.scala:27: error: type mismatch;
- found : Test.AV
- required: AnyRef
-Note that AV extends Any, not AnyRef.
-Such types can participate in value classes, but instances
-cannot appear in singleton types or in reference comparisons.
- new AV(0): AnyRef
- ^
-four errors found
diff --git a/test/files/neg/quasiquotes-syntax-error-position.check b/test/files/neg/quasiquotes-syntax-error-position.check
index 25e5b8d75a..14fef16e01 100644
--- a/test/files/neg/quasiquotes-syntax-error-position.check
+++ b/test/files/neg/quasiquotes-syntax-error-position.check
@@ -29,4 +29,7 @@ quasiquotes-syntax-error-position.scala:13: error: end of quote expected but 'ca
quasiquotes-syntax-error-position.scala:14: error: ')' expected but end of quote found.
pq"$a(bar"
^
-10 errors found
+quasiquotes-syntax-error-position.scala:15: error: ':' expected but ')' found.
+ q"def foo(x)"
+ ^
+11 errors found
diff --git a/test/files/neg/quasiquotes-syntax-error-position.scala b/test/files/neg/quasiquotes-syntax-error-position.scala
index b97af52cfc..7b1d66ba00 100644
--- a/test/files/neg/quasiquotes-syntax-error-position.scala
+++ b/test/files/neg/quasiquotes-syntax-error-position.scala
@@ -12,4 +12,5 @@ object test extends App {
tq"$t => $t $t]"
cq"pattern => body ; case pattern2 =>"
pq"$a(bar"
-} \ No newline at end of file
+ q"def foo(x)"
+}
diff --git a/test/files/neg/stringinterpolation_macro-neg.check b/test/files/neg/stringinterpolation_macro-neg.check
index 457f497f2f..703846ad62 100644
--- a/test/files/neg/stringinterpolation_macro-neg.check
+++ b/test/files/neg/stringinterpolation_macro-neg.check
@@ -1,61 +1,61 @@
-stringinterpolation_macro-neg.scala:8: error: too few parts
+stringinterpolation_macro-neg.scala:13: error: there are no parts
new StringContext().f()
^
-stringinterpolation_macro-neg.scala:9: error: too few arguments for interpolated string
+stringinterpolation_macro-neg.scala:14: error: too few arguments for interpolated string
new StringContext("", " is ", "%2d years old").f(s)
^
-stringinterpolation_macro-neg.scala:10: error: too many arguments for interpolated string
+stringinterpolation_macro-neg.scala:15: error: too many arguments for interpolated string
new StringContext("", " is ", "%2d years old").f(s, d, d)
^
-stringinterpolation_macro-neg.scala:11: error: too few arguments for interpolated string
+stringinterpolation_macro-neg.scala:16: error: too few arguments for interpolated string
new StringContext("", "").f()
^
-stringinterpolation_macro-neg.scala:14: error: type mismatch;
+stringinterpolation_macro-neg.scala:19: error: type mismatch;
found : String
required: Boolean
f"$s%b"
^
-stringinterpolation_macro-neg.scala:15: error: type mismatch;
+stringinterpolation_macro-neg.scala:20: error: type mismatch;
found : String
required: Char
f"$s%c"
^
-stringinterpolation_macro-neg.scala:16: error: type mismatch;
+stringinterpolation_macro-neg.scala:21: error: type mismatch;
found : Double
required: Char
f"$f%c"
^
-stringinterpolation_macro-neg.scala:17: error: type mismatch;
+stringinterpolation_macro-neg.scala:22: error: type mismatch;
found : String
required: Int
f"$s%x"
^
-stringinterpolation_macro-neg.scala:18: error: type mismatch;
+stringinterpolation_macro-neg.scala:23: error: type mismatch;
found : Boolean
required: Int
f"$b%d"
^
-stringinterpolation_macro-neg.scala:19: error: type mismatch;
+stringinterpolation_macro-neg.scala:24: error: type mismatch;
found : String
required: Int
f"$s%d"
^
-stringinterpolation_macro-neg.scala:20: error: type mismatch;
+stringinterpolation_macro-neg.scala:25: error: type mismatch;
found : Double
required: Int
f"$f%o"
^
-stringinterpolation_macro-neg.scala:21: error: type mismatch;
+stringinterpolation_macro-neg.scala:26: error: type mismatch;
found : String
required: Double
f"$s%e"
^
-stringinterpolation_macro-neg.scala:22: error: type mismatch;
+stringinterpolation_macro-neg.scala:27: error: type mismatch;
found : Boolean
required: Double
f"$b%f"
^
-stringinterpolation_macro-neg.scala:27: error: type mismatch;
+stringinterpolation_macro-neg.scala:32: error: type mismatch;
found : String
required: Int
Note that implicit conversions are not applicable because they are ambiguous:
@@ -64,7 +64,109 @@ Note that implicit conversions are not applicable because they are ambiguous:
are possible conversion functions from String to Int
f"$s%d"
^
-stringinterpolation_macro-neg.scala:30: error: illegal conversion character
+stringinterpolation_macro-neg.scala:35: error: illegal conversion character 'i'
f"$s%i"
^
-15 errors found
+stringinterpolation_macro-neg.scala:38: error: Illegal flag '+'
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag ' '
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag '0'
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag ','
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:38: error: Illegal flag '('
+ f"$s%+ 0,(s"
+ ^
+stringinterpolation_macro-neg.scala:39: error: Only '-' allowed for c conversion
+ f"$c%#+ 0,(c"
+ ^
+stringinterpolation_macro-neg.scala:40: error: # not allowed for d conversion
+ f"$d%#d"
+ ^
+stringinterpolation_macro-neg.scala:41: error: ',' only allowed for d conversion of integral types
+ f"$d%,x"
+ ^
+stringinterpolation_macro-neg.scala:42: error: only use '+' for BigInt conversions to o, x, X
+ f"$d%+ (x"
+ ^
+stringinterpolation_macro-neg.scala:42: error: only use ' ' for BigInt conversions to o, x, X
+ f"$d%+ (x"
+ ^
+stringinterpolation_macro-neg.scala:42: error: only use '(' for BigInt conversions to o, x, X
+ f"$d%+ (x"
+ ^
+stringinterpolation_macro-neg.scala:43: error: ',' not allowed for a, A
+ f"$f%,(a"
+ ^
+stringinterpolation_macro-neg.scala:43: error: '(' not allowed for a, A
+ f"$f%,(a"
+ ^
+stringinterpolation_macro-neg.scala:44: error: Only '-' allowed for date/time conversions
+ f"$t%#+ 0,(tT"
+ ^
+stringinterpolation_macro-neg.scala:47: error: precision not allowed
+ f"$c%.2c"
+ ^
+stringinterpolation_macro-neg.scala:48: error: precision not allowed
+ f"$d%.2d"
+ ^
+stringinterpolation_macro-neg.scala:49: error: precision not allowed
+ f"%.2%"
+ ^
+stringinterpolation_macro-neg.scala:50: error: precision not allowed
+ f"%.2n"
+ ^
+stringinterpolation_macro-neg.scala:51: error: precision not allowed
+ f"$f%.2a"
+ ^
+stringinterpolation_macro-neg.scala:52: error: precision not allowed
+ f"$t%.2tT"
+ ^
+stringinterpolation_macro-neg.scala:55: error: No last arg
+ f"%<s"
+ ^
+stringinterpolation_macro-neg.scala:56: error: No last arg
+ f"%<c"
+ ^
+stringinterpolation_macro-neg.scala:57: error: No last arg
+ f"%<tT"
+ ^
+stringinterpolation_macro-neg.scala:58: error: Argument index out of range
+ f"${8}%d ${9}%d%3$$d"
+ ^
+stringinterpolation_macro-neg.scala:59: error: Argument index out of range
+ f"${8}%d ${9}%d%0$$d"
+ ^
+stringinterpolation_macro-neg.scala:62: warning: Index is not this arg
+ f"${8}%d ${9}%1$$d"
+ ^
+stringinterpolation_macro-neg.scala:63: warning: Argument index ignored if '<' flag is present
+ f"$s%s $s%s %1$$<s"
+ ^
+stringinterpolation_macro-neg.scala:64: warning: Index is not this arg
+ f"$s%s $s%1$$s"
+ ^
+stringinterpolation_macro-neg.scala:67: error: type mismatch;
+ found : String
+ required: java.util.Formattable
+ f"$s%#s"
+ ^
+stringinterpolation_macro-neg.scala:70: error: 'G' doesn't seem to be a date or time conversion
+ f"$t%tG"
+ ^
+stringinterpolation_macro-neg.scala:71: error: Date/time conversion must have two characters
+ f"$t%t"
+ ^
+stringinterpolation_macro-neg.scala:72: error: Missing conversion operator in '%10.5'; use %% for literal %, %n for newline
+ f"$s%10.5"
+ ^
+stringinterpolation_macro-neg.scala:75: error: conversions must follow a splice; use %% for literal %, %n for newline
+ f"${d}random-leading-junk%d"
+ ^
+three warnings found
+45 errors found
diff --git a/test/files/neg/stringinterpolation_macro-neg.scala b/test/files/neg/stringinterpolation_macro-neg.scala
index ac9d97d678..3869d42d66 100644
--- a/test/files/neg/stringinterpolation_macro-neg.scala
+++ b/test/files/neg/stringinterpolation_macro-neg.scala
@@ -3,6 +3,11 @@ object Test extends App {
val d = 8
val b = false
val f = 3.14159
+ val c = 'c'
+ val t = new java.util.Date
+ val x = new java.util.Formattable {
+ def formatTo(ff: java.util.Formatter, g: Int, w: Int, p: Int): Unit = ff format "xxx"
+ }
// 1) number of arguments
new StringContext().f()
@@ -28,4 +33,44 @@ object Test extends App {
}
f"$s%i"
+
+ // 3) flag mismatches
+ f"$s%+ 0,(s"
+ f"$c%#+ 0,(c"
+ f"$d%#d"
+ f"$d%,x"
+ f"$d%+ (x"
+ f"$f%,(a"
+ f"$t%#+ 0,(tT"
+
+ // 4) bad precisions
+ f"$c%.2c"
+ f"$d%.2d"
+ f"%.2%"
+ f"%.2n"
+ f"$f%.2a"
+ f"$t%.2tT"
+
+ // 5) bad indexes
+ f"%<s"
+ f"%<c"
+ f"%<tT"
+ f"${8}%d ${9}%d%3$$d"
+ f"${8}%d ${9}%d%0$$d"
+
+ // warnings
+ f"${8}%d ${9}%1$$d"
+ f"$s%s $s%s %1$$<s"
+ f"$s%s $s%1$$s"
+
+ // 6) bad arg types
+ f"$s%#s"
+
+ // 7) misunderstood conversions
+ f"$t%tG"
+ f"$t%t"
+ f"$s%10.5"
+
+ // 8) other brain failures
+ f"${d}random-leading-junk%d"
}
diff --git a/test/files/neg/t6844.check b/test/files/neg/t6844.check
new file mode 100644
index 0000000000..1fc2485520
--- /dev/null
+++ b/test/files/neg/t6844.check
@@ -0,0 +1,6 @@
+t6844.scala:4: error: type mismatch;
+ found : reflect.runtime.universe.TermName
+ required: reflect.runtime.universe.Tree
+ q"def foo($x)"
+ ^
+one error found
diff --git a/test/files/neg/t6844.scala b/test/files/neg/t6844.scala
new file mode 100644
index 0000000000..809d9d0f98
--- /dev/null
+++ b/test/files/neg/t6844.scala
@@ -0,0 +1,5 @@
+import scala.reflect.runtime.universe._
+object Test extends App {
+ val x = TermName("x")
+ q"def foo($x)"
+}
diff --git a/test/files/neg/t7325.check b/test/files/neg/t7325.check
index d2c40f4df8..61c33f99b1 100644
--- a/test/files/neg/t7325.check
+++ b/test/files/neg/t7325.check
@@ -1,13 +1,13 @@
-t7325.scala:2: error: conversions must follow a splice; use %% for literal %, %n for newline
+t7325.scala:2: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
println(f"%")
^
-t7325.scala:4: error: conversions must follow a splice; use %% for literal %, %n for newline
+t7325.scala:4: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
println(f"%%%")
^
-t7325.scala:6: error: conversions must follow a splice; use %% for literal %, %n for newline
+t7325.scala:6: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
println(f"%%%%%")
^
-t7325.scala:16: error: wrong conversion string
+t7325.scala:16: error: Missing conversion operator in '%'; use %% for literal %, %n for newline
println(f"${0}%")
^
t7325.scala:19: error: conversions must follow a splice; use %% for literal %, %n for newline
diff --git a/test/files/neg/t8143a.check b/test/files/neg/t8143a.check
new file mode 100644
index 0000000000..4e11000a2a
--- /dev/null
+++ b/test/files/neg/t8143a.check
@@ -0,0 +1,5 @@
+t8143a.scala:2: error: overriding method f in class Foo of type => Int;
+ method f has weaker access privileges; it should not be private
+class Bar extends Foo { private def f = 10 }
+ ^
+one error found
diff --git a/test/files/neg/t8143a.scala b/test/files/neg/t8143a.scala
new file mode 100644
index 0000000000..4ec539e671
--- /dev/null
+++ b/test/files/neg/t8143a.scala
@@ -0,0 +1,15 @@
+class Foo { def f = 5 }
+class Bar extends Foo { private def f = 10 }
+
+
+class Foo1 { private def f = 5 }
+class Bar1 extends Foo1 { def f = 10 } // okay
+
+class Foo2 { private def f = 5 }
+class Bar2 extends Foo2 { private def f = 10 } // okay
+
+class Foo3 { private[this] def f = 5 }
+class Bar3 extends Foo3 { private def f = 10 } // okay
+
+class Foo4 { private def f = 5 }
+class Bar4 extends Foo4 { private[this] def f = 10 } // okay \ No newline at end of file
diff --git a/test/files/neg/t8182.check b/test/files/neg/t8182.check
new file mode 100644
index 0000000000..a156d70883
--- /dev/null
+++ b/test/files/neg/t8182.check
@@ -0,0 +1,22 @@
+t8182.scala:4: error: illegal start of simple pattern
+}
+^
+t8182.scala:7: error: illegal start of simple pattern
+}
+^
+t8182.scala:6: error: type application is not allowed in pattern
+ val a b[B] // error then continue as for X
+ ^
+t8182.scala:10: error: illegal start of simple pattern
+ case a b[B] => // bumpy recovery
+ ^
+t8182.scala:10: error: type application is not allowed in pattern
+ case a b[B] => // bumpy recovery
+ ^
+t8182.scala:11: error: '=>' expected but '}' found.
+ }
+ ^
+t8182.scala:16: error: type application is not allowed in pattern
+ case a B[T] b =>
+ ^
+7 errors found
diff --git a/test/files/neg/t8182.scala b/test/files/neg/t8182.scala
new file mode 100644
index 0000000000..1b3bc9821f
--- /dev/null
+++ b/test/files/neg/t8182.scala
@@ -0,0 +1,18 @@
+
+trait X {
+ val a b // something missing
+}
+trait Y {
+ val a b[B] // error then continue as for X
+}
+trait Z {
+ (null: Any) match {
+ case a b[B] => // bumpy recovery
+ }
+}
+object B { def unapply[W](a: Any) = Some((1,2)) }
+trait Z {
+ (null: Any) match {
+ case a B[T] b =>
+ }
+}
diff --git a/test/files/neg/t8207.check b/test/files/neg/t8207.check
new file mode 100644
index 0000000000..59facd897a
--- /dev/null
+++ b/test/files/neg/t8207.check
@@ -0,0 +1,7 @@
+t8207.scala:1: error: '.' expected but '}' found.
+class C { import C.this.toString }
+ ^
+t8207.scala:3: error: '.' expected but '}' found.
+class D { import D.this.toString }
+ ^
+two errors found
diff --git a/test/files/neg/t8207.scala b/test/files/neg/t8207.scala
new file mode 100644
index 0000000000..738ce381f4
--- /dev/null
+++ b/test/files/neg/t8207.scala
@@ -0,0 +1,3 @@
+class C { import C.this.toString }
+
+class D { import D.this.toString }
diff --git a/test/files/neg/t8228.check b/test/files/neg/t8228.check
new file mode 100644
index 0000000000..02eff4b1b7
--- /dev/null
+++ b/test/files/neg/t8228.check
@@ -0,0 +1,4 @@
+t8228.scala:4: error: recursive value foo needs type
+ val foo = foo(null)
+ ^
+one error found
diff --git a/test/files/neg/t8228.scala b/test/files/neg/t8228.scala
new file mode 100644
index 0000000000..19d71aeab4
--- /dev/null
+++ b/test/files/neg/t8228.scala
@@ -0,0 +1,7 @@
+object X {
+ def bar = {
+ def foo(x: Any) = ""
+ val foo = foo(null)
+ foo(null) // cycle in isApplicableBasedOnArity
+ }
+}
diff --git a/test/files/neg/t8237-default.check b/test/files/neg/t8237-default.check
new file mode 100644
index 0000000000..59fe21ed03
--- /dev/null
+++ b/test/files/neg/t8237-default.check
@@ -0,0 +1,13 @@
+t8237-default.scala:5: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T[?T[List[?T[X forSome { type X }]]]]
+ test4(test4$default$1)
+ ^
+t8237-default.scala:5: error: type mismatch;
+ found : List[Int]
+ required: T[T[List[T[X forSome { type X }]]]]
+ test4(test4$default$1)
+ ^
+two errors found
diff --git a/test/files/neg/t8237-default.scala b/test/files/neg/t8237-default.scala
new file mode 100644
index 0000000000..f695aa523f
--- /dev/null
+++ b/test/files/neg/t8237-default.scala
@@ -0,0 +1,29 @@
+// This test case was extracte from `names-defaults-neg.scala`
+// It pinpoints an improvement an error message that results from
+// a type inference failure
+object Test extends App {
+ test4(test4$default$1)
+
+ def test4[T[P]](x: T[T[List[T[X forSome { type X }]]]]) = ???
+ def test4$default$1[T[P]]: List[Int] = ???
+}
+
+/*
+OLD:
+ no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T
+ test4(test4$default$1)
+ ^
+
+NEW:
+
+no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])Nothing exist so that it can be applied to arguments (List[Int])
+ --- because ---
+argument expression's type is not compatible with formal parameter type;
+ found : List[Int]
+ required: ?T[?T[List[?T[X forSome { type X }]]]
+ test4(test4$default$1)
+*/
diff --git a/test/files/pos/annotated-original/M_1.scala b/test/files/pos/annotated-original/M_1.scala
index e312f9abbf..84a01bcce5 100644
--- a/test/files/pos/annotated-original/M_1.scala
+++ b/test/files/pos/annotated-original/M_1.scala
@@ -2,6 +2,6 @@ import language.experimental.macros
import scala.reflect.macros.blackbox.Context
object M {
- def impl(c: Context)(a: c.Expr[Any]) = c.Expr[Any](c.resetLocalAttrs(a.tree))
+ def impl(c: Context)(a: c.Expr[Any]) = c.Expr[Any](c.untypecheck(a.tree))
def m(a: Any) = macro impl
}
diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
index b02864b994..fdf9c72c31 100644
--- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
+++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
@@ -44,7 +44,7 @@ object Macros {
val typeOut = c.Expr[String](q"${ttag.tpe.toString}").splice
def apply(_arg: T): U = c.Expr[U](b1)(ttag.asInstanceOf[c.WeakTypeTag[U]]).splice
})
- val untyped = c.resetLocalAttrs(template.tree)
+ val untyped = c.untypecheck(template.tree)
c.Expr[T => U](untyped)
case _ => sys.error("Bad function type")
diff --git a/test/files/pos/implicit-anyval-2.10.flags b/test/files/pos/implicit-anyval-2.10.flags
new file mode 100644
index 0000000000..94c8056747
--- /dev/null
+++ b/test/files/pos/implicit-anyval-2.10.flags
@@ -0,0 +1 @@
+-Xsource:2.10
diff --git a/test/files/pos/implicit-anyval-2.10.scala b/test/files/pos/implicit-anyval-2.10.scala
new file mode 100644
index 0000000000..3082af73b8
--- /dev/null
+++ b/test/files/pos/implicit-anyval-2.10.scala
@@ -0,0 +1,3 @@
+object Test {
+ "": AnyVal // newly prohibited in 2.11, allowed under -Xsourse:2.10
+} \ No newline at end of file
diff --git a/test/files/pos/t2066-2.10-compat.flags b/test/files/pos/t2066-2.10-compat.flags
new file mode 100644
index 0000000000..94c8056747
--- /dev/null
+++ b/test/files/pos/t2066-2.10-compat.flags
@@ -0,0 +1 @@
+-Xsource:2.10
diff --git a/test/files/pos/t2066-2.10-compat.scala b/test/files/pos/t2066-2.10-compat.scala
new file mode 100644
index 0000000000..fb8103e4ad
--- /dev/null
+++ b/test/files/pos/t2066-2.10-compat.scala
@@ -0,0 +1,71 @@
+import language._
+trait A1 {
+ def f[T[_]] = ()
+}
+
+trait B1 extends A1 {
+ override def f[T[+_]] = ()
+}
+
+trait C1 extends A1 {
+ override def f[T[-_]] = ()
+}
+
+
+trait A2 {
+ def f[T[+_]] = ()
+}
+
+trait B2 extends A2 {
+ override def f[T[_]] = () // okay
+}
+
+trait C2 extends A2 {
+ override def f[T[-_]] = ()
+}
+
+
+trait A3 {
+ def f[T[-_]] = ()
+}
+
+trait B3 extends A3 {
+ override def f[T[_]] = () // okay
+}
+
+trait C3 extends A3 {
+ override def f[T[-_]] = ()
+}
+
+
+trait A4 {
+ def f[T[X[+_]]] = ()
+}
+
+trait B4 extends A4 {
+ override def f[T[X[_]]] = ()
+}
+
+trait A5 {
+ def f[T[X[-_]]] = ()
+}
+
+trait B5 extends A5 {
+ override def f[T[X[_]]] = ()
+}
+
+
+
+trait A6 {
+ def f[T[X[_]]] = ()
+}
+
+trait B6 extends A6 {
+ override def f[T[X[+_]]] = () // okay
+}
+trait C6 extends A6 {
+ override def f[T[X[_]]] = () // okay
+}
+trait D6 extends A6 {
+ override def f[T[X[-_]]] = ()
+}
diff --git a/test/files/pos/t6169/Exist.java b/test/files/pos/t6169/Exist.java
new file mode 100644
index 0000000000..dfc6b36b33
--- /dev/null
+++ b/test/files/pos/t6169/Exist.java
@@ -0,0 +1,4 @@
+public class Exist<T extends String> {
+ // java helpfully re-interprets Exist<?> as Exist<? extends String>
+ public Exist<?> foo() { throw new RuntimeException(); }
+} \ No newline at end of file
diff --git a/test/files/pos/t6169/ExistF.java b/test/files/pos/t6169/ExistF.java
new file mode 100644
index 0000000000..70fabd74cf
--- /dev/null
+++ b/test/files/pos/t6169/ExistF.java
@@ -0,0 +1,4 @@
+public class ExistF<T extends ExistF<T>> {
+ // java helpfully re-interprets ExistF<?> as ExistF<?0 extends ExistF<?0>>
+ public ExistF<?> foo() { throw new RuntimeException(); }
+} \ No newline at end of file
diff --git a/test/files/pos/t6169/ExistIndir.java b/test/files/pos/t6169/ExistIndir.java
new file mode 100644
index 0000000000..e66d1698c4
--- /dev/null
+++ b/test/files/pos/t6169/ExistIndir.java
@@ -0,0 +1,4 @@
+public class ExistIndir<T extends String, U extends T> {
+ // java helpfully re-interprets ExistIndir<?> as ExistIndir<? extends String>
+ public ExistIndir<?, ?> foo() { throw new RuntimeException(); }
+}
diff --git a/test/files/pos/t6169/OP.java b/test/files/pos/t6169/OP.java
new file mode 100644
index 0000000000..15e4c5640f
--- /dev/null
+++ b/test/files/pos/t6169/OP.java
@@ -0,0 +1 @@
+public abstract class OP<T> { }
diff --git a/test/files/pos/t6169/Skin.java b/test/files/pos/t6169/Skin.java
new file mode 100644
index 0000000000..780de1ee09
--- /dev/null
+++ b/test/files/pos/t6169/Skin.java
@@ -0,0 +1 @@
+public interface Skin<C extends Skinnable> { }
diff --git a/test/files/pos/t6169/Skinnable.java b/test/files/pos/t6169/Skinnable.java
new file mode 100644
index 0000000000..f91eaa30d8
--- /dev/null
+++ b/test/files/pos/t6169/Skinnable.java
@@ -0,0 +1,3 @@
+public interface Skinnable {
+ OP<Skin<?>> skinProperty();
+}
diff --git a/test/files/pos/t6169/skinnable.scala b/test/files/pos/t6169/skinnable.scala
new file mode 100644
index 0000000000..3ba2734526
--- /dev/null
+++ b/test/files/pos/t6169/skinnable.scala
@@ -0,0 +1,14 @@
+object ObjectProperty {
+ implicit def jfxObjectProperty2sfx[T](p: OP[T]) = new ObjectProperty[T](p)
+}
+
+class ObjectProperty[T](val delegate: OP[T])
+
+trait TestWildcardBoundInference {
+ def delegate: Skinnable
+ def skin: ObjectProperty[Skin[_ /* inferred: <: Skinnable */]] = ObjectProperty.jfxObjectProperty2sfx(delegate.skinProperty)
+ skin: ObjectProperty[Skin[_ <: Skinnable]]
+
+ def skinCheckInference = delegate.skinProperty
+ skinCheckInference: ObjectProperty[Skin[_ <: Skinnable]]
+} \ No newline at end of file
diff --git a/test/files/pos/t6169/t6169.scala b/test/files/pos/t6169/t6169.scala
new file mode 100644
index 0000000000..37f42619ca
--- /dev/null
+++ b/test/files/pos/t6169/t6169.scala
@@ -0,0 +1,7 @@
+class Test {
+ class MyExist extends ExistF[MyExist]
+ // SI-8197, SI-6169: java infers the bounds of existentials, so we have to as well now that SI-1786 is fixed...
+ def stringy: Exist[_ <: String] = (new Exist[String]).foo
+ def fbounded: (ExistF[t] forSome {type t <: ExistF[t] }) = (new MyExist).foo
+ def indir: ExistIndir[_ <: String, _ <: String] = (new ExistIndir[String, String]).foo
+} \ No newline at end of file
diff --git a/test/files/pos/t7322.scala b/test/files/pos/t7322.scala
new file mode 100644
index 0000000000..006bf89e9f
--- /dev/null
+++ b/test/files/pos/t7322.scala
@@ -0,0 +1,11 @@
+
+package object t7322 {
+ implicit class X(sc: StringContext) {
+ def x_?(args: Any*) = "hi there"
+ }
+}
+package t7322 {
+ trait Y {
+ x_?"junk" // assume that if it compiles, it works
+ }
+}
diff --git a/test/files/pos/t7377/Macro_1.scala b/test/files/pos/t7377/Macro_1.scala
index 9f51248095..b38687c8b3 100644
--- a/test/files/pos/t7377/Macro_1.scala
+++ b/test/files/pos/t7377/Macro_1.scala
@@ -2,6 +2,6 @@ import language.experimental._
import scala.reflect.macros.blackbox.Context
object M {
- def noopImpl[A](c: Context)(expr: c.Expr[A]): c.Expr[A] = c.Expr(c.typecheck(c.resetLocalAttrs(expr.tree)))
+ def noopImpl[A](c: Context)(expr: c.Expr[A]): c.Expr[A] = c.Expr(c.typecheck(c.untypecheck(expr.tree)))
def noop[A](expr: A): A = macro noopImpl[A]
}
diff --git a/test/files/pos/t7516/A_1.scala b/test/files/pos/t7516/A_1.scala
index 3bba19966d..3bd477dcda 100644
--- a/test/files/pos/t7516/A_1.scala
+++ b/test/files/pos/t7516/A_1.scala
@@ -3,7 +3,7 @@ import scala.reflect._,macros._, scala.language.experimental.macros
object A {
def impl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = {
val r = c.universe.reify { List(t.splice) }
- c.Expr[List[T]]( c.resetLocalAttrs(r.tree) )
+ c.Expr[List[T]]( c.untypecheck(r.tree) )
}
def demo[T](t: T): List[T] = macro impl[T]
}
diff --git a/test/files/pos/t7919.scala b/test/files/pos/t7919.scala
new file mode 100644
index 0000000000..64f261ec16
--- /dev/null
+++ b/test/files/pos/t7919.scala
@@ -0,0 +1,6 @@
+
+object X {
+ val x = s""
+ val y = true
+}
+
diff --git a/test/files/pos/t8064/Macro_1.scala b/test/files/pos/t8064/Macro_1.scala
index dd42950b34..9f1e6955b4 100644
--- a/test/files/pos/t8064/Macro_1.scala
+++ b/test/files/pos/t8064/Macro_1.scala
@@ -5,6 +5,6 @@ object Macro {
def apply(a: Any): Any = macro impl
def impl(c: Context)(a: c.Tree): c.Tree = {
- c.resetLocalAttrs(a)
+ c.untypecheck(a)
}
}
diff --git a/test/files/pos/t8170.scala b/test/files/pos/t8170.scala
new file mode 100644
index 0000000000..b65f4b8572
--- /dev/null
+++ b/test/files/pos/t8170.scala
@@ -0,0 +1,27 @@
+object O {
+ trait X
+ trait B extends A {
+ override type T[F1 <: X] = F1
+ }
+ trait A {
+ type T[F <: X]
+ }
+}
+
+object Test {
+ import O._
+ val a: B = ???
+ val b: a.T[X] = ???
+ b.ensuring(x => true) // trigger an implicit search
+}
+
+
+/*
+this = {AliasArgsTypeRef@3004}"Test#7680.a#14899.T#14823[O#7702.X#7793]"
+ sym = type T#14823
+ info = namer: [F#14824 <: O#7703.X#7793]F#14824
+result = {AbstractNoArgsTypeRef@3237}"F#24451"
+tp = {PolyType@3235}"[F#14824 <: O#7703.X#7793]F#14824"
+tparams =
+ (0) = {AbstractTypeSymbol@3247}"type F#24451"
+*/ \ No newline at end of file
diff --git a/test/files/pos/t8170b.scala b/test/files/pos/t8170b.scala
new file mode 100644
index 0000000000..53036f6c8a
--- /dev/null
+++ b/test/files/pos/t8170b.scala
@@ -0,0 +1,25 @@
+import language._
+
+object ScalaZeee {
+ trait HFold[M[_], U] {
+ type Apply[E, A <: U] <: U
+ }
+ trait GenericCons[M[_], H, +T <: GenericList[M]] extends GenericList[M] {
+ val tail: T
+ override type Folded[N[X] >: M[X], U, F <: HFold[N, U]] = F#Apply[H, tail.Folded[N, U, F]]
+ }
+ val KNil: GenericList[Nothing] = ???
+ sealed trait GenericList[+M[_]] {
+ type Folded[N[X] >: M[X], U, F <: HFold[N, U]] <: U
+ }
+}
+
+object TypelevelUsage {
+ import ScalaZeee._
+ type T = GenericCons[Some, String, KNil.type]
+ val klist1: T = ???
+ type T2 = klist1.Folded[Option, Int, HFold[Option, Int]]
+ val count2: T2 = ???
+
+ count2.ensuring(x => true).toChar // trigger an implicit search
+}
diff --git a/test/files/pos/t8207.scala b/test/files/pos/t8207.scala
new file mode 100644
index 0000000000..680b40f379
--- /dev/null
+++ b/test/files/pos/t8207.scala
@@ -0,0 +1,6 @@
+class C { me =>
+ import me.{toString => ts}
+ locally(this: me.type)
+ trait T
+ type X = me.T
+}
diff --git a/test/files/pos/t8237.scala b/test/files/pos/t8237.scala
new file mode 100644
index 0000000000..005089079e
--- /dev/null
+++ b/test/files/pos/t8237.scala
@@ -0,0 +1,29 @@
+import scala.language.higherKinds
+
+object TestExplicit {
+ trait TC[A]
+ def fTt[A,E[X] <: List[X]](a: A)(implicit tt: TC[E[A]]) = a
+ implicit def tc[T]: TC[T] = ???
+
+ // Typechecking results in SOE in TypeVar.isGround
+ fTt(1)(tc)
+ // fun = TestExplicit.this.fTt[Int, E](1)
+ // args = TestExplicit.this.tc[E[Int]]
+ // argTpes.head.instantiateTypeParams = TC[?E#1[Int]]
+ // formals.head.instantiateTypeParams = TC[?E#2[Int]]
+ // (where ?E#1 and ?E#2 as distinct AppliedTypeVars that resulted
+ // from separate applications of type args to the same HKTypeVar, ?E)
+ //
+ // As we check if the argument conforms to the formal, we would have
+ // AppliedTypeVars sharing the same TypeConstraints on the LHS and RHS,
+ // which leads to a cyclic constraint.
+}
+
+object TestImplicit {
+ trait TC[A]
+ def fTt[A,E[X] <: List[X]](a: A)(implicit tt: TC[E[A]]) = a
+ implicit def tc[T]: TC[T] = ???
+
+ // Oddly enough, this one works.
+ fTt(1)
+}
diff --git a/test/files/pos/t8237b.scala b/test/files/pos/t8237b.scala
new file mode 100644
index 0000000000..52bb310e8b
--- /dev/null
+++ b/test/files/pos/t8237b.scala
@@ -0,0 +1,10 @@
+import scala.language.higherKinds
+import scala.reflect.runtime.universe._
+object Test {
+
+ def fTt[A,E[X]<:List[X]](a: A)(implicit tt: TypeTag[E[A]]) = a
+
+ trait TC[A]
+ implicit def TCListInt[A]: TC[A] = ???
+ fTt(1)
+}
diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala
index c3ace590ed..1d4891fd1f 100644
--- a/test/files/run/global-showdef.scala
+++ b/test/files/run/global-showdef.scala
@@ -54,7 +54,7 @@ object Bippy {
val run = new compiler.Run()
run.compileSources(List(src))
}
- output.linesIterator.toList
+ output.lines.toList
}
def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name)
def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name)
diff --git a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala
index 624479480d..f038d8714f 100644
--- a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.blackbox.Context
object Impls {
def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
- val x1 = c.Expr[Int](c.resetAllAttrs(x.tree))
+ val x1 = c.Expr[Int](c.untypecheck(x.tree))
c.Expr[Int](Literal(Constant(c.eval(x1))))
}
}
diff --git a/test/files/run/private-override.scala b/test/files/run/private-override.scala
deleted file mode 100644
index 0a3f57f97c..0000000000
--- a/test/files/run/private-override.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-package test.p1.p2 {
- abstract class A {
- private[p2] def f2(): Int = 1
- }
- abstract class Other extends A {
- // It's a private method - not a private[p2] method. Not a failed
- // "weaker access privileges" override, a different namespace.
- private def f2(): Int = super.f2() + 2
- def go() = f2()
- }
-}
-
-object Test extends test.p1.p2.Other {
- def main(args: Array[String]): Unit = {
- println(go())
- }
-}
diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check
index 352aefaf25..43116858de 100644
--- a/test/files/run/reflection-magicsymbols-invoke.check
+++ b/test/files/run/reflection-magicsymbols-invoke.check
@@ -28,7 +28,7 @@ it's important to print the list of AnyVal's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor AnyVal: ()AnyVal
method getClass: ()Class[_ <: AnyVal]
-testing AnyVal.<init>: class java.lang.InstantiationException: null
+testing AnyVal.<init>: class scala.ScalaReflectionException: unsupported symbol constructor AnyVal when invoking bytecodeless method mirror for scala.AnyVal.<init>(): AnyVal (bound to null)
testing AnyVal.getClass: class scala.ScalaReflectionException: expected a member of class Integer, you provided method scala.AnyVal.getClass
============
AnyRef
diff --git a/test/pending/run/reflection-sync-potpourri.scala b/test/files/run/reflection-sync-potpourri.scala
index 0ad5f2ab66..0c96974df7 100644
--- a/test/pending/run/reflection-sync-potpourri.scala
+++ b/test/files/run/reflection-sync-potpourri.scala
@@ -24,7 +24,7 @@ object Test extends App {
override def run(): Unit = {
val s1 = foo("42")
val s2 = perms(diceRolls(i - 1)).map(x => force(x)).sorted.mkString(", ")
- assert(s1 == "java.lang.String")
+ assert(s1 == "String" || s1 == "java.lang.String")
assert(s2 == "java.lang.annotation.Annotation, java.lang.reflect.Method, scala.io.BufferedSource, scala.io.Codec")
}
})
diff --git a/test/files/run/stringinterpolation_macro-run.check b/test/files/run/stringinterpolation_macro-run.check
index be62c5780b..ead61e76ac 100644
--- a/test/files/run/stringinterpolation_macro-run.check
+++ b/test/files/run/stringinterpolation_macro-run.check
@@ -46,6 +46,8 @@ S
120
120
120
+ 0X4
+She is 4 feet tall.
120
42
3.400000e+00
@@ -60,3 +62,6 @@ S
05/26/12
05/26/12
05/26/12
+%
+7 7 9
+7 9 9
diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala
index 1138cd0860..ff779dd1d3 100644
--- a/test/files/run/stringinterpolation_macro-run.scala
+++ b/test/files/run/stringinterpolation_macro-run.scala
@@ -72,6 +72,14 @@ println(f"${120 : java.lang.Integer}%d")
println(f"${120 : java.lang.Long}%d")
println(f"${BigInt(120)}%d")
println(f"${new java.math.BigInteger("120")}%d")
+println(f"${4}%#10X")
+
+locally {
+ val fff = new java.util.Formattable {
+ def formatTo(f: java.util.Formatter, g: Int, w: Int, p: Int) = f.format("4")
+ }
+ println(f"She is ${fff}%#s feet tall.")
+}
{
implicit val strToShort = (s: String) => java.lang.Short.parseShort(s)
@@ -103,4 +111,11 @@ println(f"${c.getTime.getTime}%TD")
implicit val strToDate = (x: String) => c
println(f"""${"1234"}%TD""")
+
+
+// literals and arg indexes
+println(f"%%")
+println(f"${7}%d %<d ${9}%d")
+println(f"${7}%d %2$$d ${9}%d")
+
}
diff --git a/test/files/run/t6261.scala b/test/files/run/t6261.scala
index b4463256c9..bf6d640de3 100644
--- a/test/files/run/t6261.scala
+++ b/test/files/run/t6261.scala
@@ -2,12 +2,6 @@ import scala.collection.immutable._
object Test extends App {
- def test0() {
- val m=ListMap(1->2,3->4)
- if(m.tail ne m.tail)
- println("ListMap.tail uses a builder, so it is not O(1)")
- }
-
def test1() {
// test that a HashTrieMap with one leaf element is not created!
val x = HashMap.empty + (1->1) + (2->2)
@@ -92,7 +86,6 @@ object Test extends App {
// StructureTests.printStructure(z)
require(z.size == 2 && z.contains(a._1) && z.contains(c._1))
}
- test0()
test1()
test2()
test3()
diff --git a/test/files/run/t6411a.check b/test/files/run/t6411a.check
new file mode 100644
index 0000000000..9226146195
--- /dev/null
+++ b/test/files/run/t6411a.check
@@ -0,0 +1,96 @@
+meth = method yg_1
+as seen by Scala reflection: def yg_1[T](y: Y[T]): T
+as seen by Java reflection: public java.lang.Object a$.yg_1(java.lang.Object)
+result = 1
+meth = method yg_1
+as seen by Scala reflection: def yg_1[T](y: Y[T]): T
+as seen by Java reflection: public java.lang.Object a$.yg_1(java.lang.Object)
+result = 1
+meth = method yi_2
+as seen by Scala reflection: def yi_2(y: Y[Int]): Int
+as seen by Java reflection: public int a$.yi_2(java.lang.Integer)
+result = 2
+meth = method yi_2
+as seen by Scala reflection: def yi_2(y: Y[Int]): Int
+as seen by Java reflection: public int a$.yi_2(java.lang.Integer)
+result = class java.lang.IllegalArgumentException: argument type mismatch
+meth = method ys_3
+as seen by Scala reflection: def ys_3(y: Y[String]): String
+as seen by Java reflection: public java.lang.String a$.ys_3(java.lang.String)
+result = class java.lang.IllegalArgumentException: argument type mismatch
+meth = method ys_3
+as seen by Scala reflection: def ys_3(y: Y[String]): String
+as seen by Java reflection: public java.lang.String a$.ys_3(java.lang.String)
+result = 3
+meth = method ya_4
+as seen by Scala reflection: def ya_4(ys: Array[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.ya_4(Y[])
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method ya_4
+as seen by Scala reflection: def ya_4(ys: Array[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.ya_4(Y[])
+result = List(4)
+meth = method yl_5
+as seen by Scala reflection: def yl_5(ys: List[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.yl_5(scala.collection.immutable.List)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method yl_5
+as seen by Scala reflection: def yl_5(ys: List[Y[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.yl_5(scala.collection.immutable.List)
+result = List(5)
+meth = method yni_7
+as seen by Scala reflection: def yni_7(y: => Y[Int]): Int
+as seen by Java reflection: public int a$.yni_7(scala.Function0)
+result = 7
+meth = method yns_8
+as seen by Scala reflection: def yns_8(y: => Y[String]): String
+as seen by Java reflection: public java.lang.String a$.yns_8(scala.Function0)
+result = 8
+meth = method zg_1
+as seen by Scala reflection: def zg_1[T](z: Z[T]): T
+as seen by Java reflection: public java.lang.Object a$.zg_1(Z)
+result = 1
+meth = method zg_1
+as seen by Scala reflection: def zg_1[T](z: Z[T]): T
+as seen by Java reflection: public java.lang.Object a$.zg_1(Z)
+result = 1
+meth = method zi_2
+as seen by Scala reflection: def zi_2(z: Z[Int]): Int
+as seen by Java reflection: public int a$.zi_2(Z)
+result = 2
+meth = method zi_2
+as seen by Scala reflection: def zi_2(z: Z[Int]): Int
+as seen by Java reflection: public int a$.zi_2(Z)
+result = class java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
+meth = method zs_3
+as seen by Scala reflection: def zs_3(z: Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zs_3(Z)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method zs_3
+as seen by Scala reflection: def zs_3(z: Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zs_3(Z)
+result = 3
+meth = method za_4
+as seen by Scala reflection: def za_4(zs: Array[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.za_4(Z[])
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method za_4
+as seen by Scala reflection: def za_4(zs: Array[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.za_4(Z[])
+result = List(4)
+meth = method zl_5
+as seen by Scala reflection: def zl_5(zs: List[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.zl_5(scala.collection.immutable.List)
+result = class java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
+meth = method zl_5
+as seen by Scala reflection: def zl_5(zs: List[Z[String]]): List[String]
+as seen by Java reflection: public scala.collection.immutable.List a$.zl_5(scala.collection.immutable.List)
+result = List(5)
+meth = method zni_7
+as seen by Scala reflection: def zni_7(z: => Z[Int]): Int
+as seen by Java reflection: public int a$.zni_7(scala.Function0)
+result = 7
+meth = method zns_8
+as seen by Scala reflection: def zns_8(z: => Z[String]): String
+as seen by Java reflection: public java.lang.String a$.zns_8(scala.Function0)
+result = 8
diff --git a/test/files/run/t6411a.scala b/test/files/run/t6411a.scala
new file mode 100644
index 0000000000..3bfeac2890
--- /dev/null
+++ b/test/files/run/t6411a.scala
@@ -0,0 +1,81 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.language.reflectiveCalls
+
+class Y[T](val i: T) extends AnyVal {
+ override def toString = s"Y($i)"
+}
+class Z[T](val i: T) extends AnyRef {
+ override def toString = s"Z($i)"
+}
+
+object a {
+ def yg_1[T](y: Y[T]) = y.i
+ def yi_2(y: Y[Int]) = y.i
+ def ys_3(y: Y[String]) = y.i
+ def ya_4(ys: Array[Y[String]]) = ys.toList.map(_.i)
+ def yl_5(ys: List[Y[String]]) = ys.map(_.i)
+ def yv_6(ys: Y[String]*) = ys.toList.map(_.i)
+ def yni_7(y: => Y[Int]) = y.i
+ def yns_8(y: => Y[String]) = y.i
+
+ def zg_1[T](z: Z[T]) = z.i
+ def zi_2(z: Z[Int]) = z.i
+ def zs_3(z: Z[String]) = z.i
+ def za_4(zs: Array[Z[String]]) = zs.toList.map(_.i)
+ def zl_5(zs: List[Z[String]]) = zs.map(_.i)
+ def zv_6(zs: Z[String]*) = zs.toList.map(_.i)
+ def zni_7(z: => Z[Int]) = z.i
+ def zns_8(z: => Z[String]) = z.i
+}
+
+object Test extends App {
+ def test(methName: String, arg: Any) = {
+ val moduleA = cm.reflect(a)
+ val msym = moduleA.symbol.typeSignature.declaration(TermName(methName)).asMethod
+ println(s"meth = $msym")
+ val mmirror = moduleA.reflectMethod(msym)
+ val mresult =
+ try { mmirror(arg) }
+ catch {
+ case ex: Exception =>
+ val ex1 = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ s"${ex1.getClass}: ${ex1.getMessage}"
+ }
+ println(s"as seen by Scala reflection: ${msym.asInstanceOf[scala.reflect.internal.Symbols#Symbol].defString}")
+ println(s"as seen by Java reflection: ${mmirror.asInstanceOf[{val jmeth: java.lang.reflect.Method}].jmeth}")
+ println(s"result = $mresult")
+ }
+
+ test("yg_1", new Y(1))
+ test("yg_1", new Y("1"))
+ test("yi_2", new Y(2))
+ test("yi_2", new Y("2"))
+ test("ys_3", new Y(3))
+ test("ys_3", new Y("3"))
+ test("ya_4", Array(new Y(4)))
+ test("ya_4", Array(new Y("4")))
+ test("yl_5", List(new Y(5)))
+ test("yl_5", List(new Y("5")))
+ // FIXME: disabled because of SI-7056
+ // test("yv_6", new Y(6))
+ // test("yv_6", new Y("6"))
+ test("yni_7", new Y(7))
+ test("yns_8", new Y("8"))
+
+ test("zg_1", new Z(1))
+ test("zg_1", new Z("1"))
+ test("zi_2", new Z(2))
+ test("zi_2", new Z("2"))
+ test("zs_3", new Z(3))
+ test("zs_3", new Z("3"))
+ test("za_4", Array(new Z(4)))
+ test("za_4", Array(new Z("4")))
+ test("zl_5", List(new Z(5)))
+ test("zl_5", List(new Z("5")))
+ // FIXME: disabled because of SI-7056
+ // test("zv_6", new Z(6))
+ // test("zv_6", new Z("6"))
+ test("zni_7", new Z(7))
+ test("zns_8", new Z("8"))
+} \ No newline at end of file
diff --git a/test/files/run/t6411b.check b/test/files/run/t6411b.check
new file mode 100644
index 0000000000..e20bed6d8d
--- /dev/null
+++ b/test/files/run/t6411b.check
@@ -0,0 +1 @@
+Bar(Foo(3))
diff --git a/test/files/run/t6411b.scala b/test/files/run/t6411b.scala
new file mode 100644
index 0000000000..af30108826
--- /dev/null
+++ b/test/files/run/t6411b.scala
@@ -0,0 +1,12 @@
+import scala.reflect.runtime.universe._
+
+case class Foo(n: Int) extends AnyVal
+case class Bar(foo: Foo)
+
+object Test extends App {
+ val mirror = runtimeMirror(getClass.getClassLoader)
+ val cm = mirror.reflectClass(typeOf[Bar].typeSymbol.asClass)
+ val ctor = typeOf[Bar].declaration(nme.CONSTRUCTOR).asMethod
+ val ctorm = cm.reflectConstructor(ctor)
+ println(ctorm(Foo(3)))
+} \ No newline at end of file
diff --git a/test/files/run/t7240/Macros_1.scala b/test/files/run/t7240/Macros_1.scala
index 019ddf7cd6..c6e976038d 100644
--- a/test/files/run/t7240/Macros_1.scala
+++ b/test/files/run/t7240/Macros_1.scala
@@ -41,7 +41,7 @@ object Bakery {
def constructor = Apply(Select(New(Ident(newTypeName("eval"))), nme.CONSTRUCTOR), List())
c.eval(c.Expr[Any](
- c.resetAllAttrs(Block(composeDSL(Literal(Constant(1))), constructor))))
+ c.untypecheck(Block(composeDSL(Literal(Constant(1))), constructor))))
c.Expr[Any](Literal(Constant(1)))
}
diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check
index d03ee3a6cf..b7443aa0c4 100644
--- a/test/files/run/t7319.check
+++ b/test/files/run/t7319.check
@@ -21,7 +21,7 @@ scala> convert(Some[Int](0))
--- because ---
argument expression's type is not compatible with formal parameter type;
found : Some[Int]
- required: ?F forSome { type _$1 <: ?F forSome { type _$2 } }
+ required: ?F[_$1] forSome { type _$1 <: ?F[_$2] forSome { type _$2 } }
convert(Some[Int](0))
^
<console>:12: error: type mismatch;
diff --git a/test/files/run/t7328.check b/test/files/run/t7328.check
new file mode 100644
index 0000000000..e386fe70d9
--- /dev/null
+++ b/test/files/run/t7328.check
@@ -0,0 +1,4 @@
+Foo
+Foo(3)
+Foo(3)
+Foo(5)
diff --git a/test/files/run/t7328.scala b/test/files/run/t7328.scala
new file mode 100644
index 0000000000..8816fa2347
--- /dev/null
+++ b/test/files/run/t7328.scala
@@ -0,0 +1,18 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+
+case class Foo(x: Int) extends AnyVal
+case class Bar(foo: Foo)
+
+object Test extends App {
+ val foo = typeOf[Bar].declaration(TermName("foo")).asMethod
+ println(foo.returnType) // Foo
+
+ val bar = Bar(Foo(3))
+ println(bar.foo) // Foo(3)
+
+ val im = cm.reflect(bar)
+ println(im.reflectField(foo).get) // incorrectly gives java.lang.Integer(3) not Foo(3)
+ im.reflectField(foo).set(Foo(5)) // java.lang.IllegalArgumentException: Can not set int field Bar.foo to Foo
+ println(im.reflectMethod(foo)()) // incorrectly gives java.lang.Integer(3) not Foo(3)
+} \ No newline at end of file
diff --git a/test/files/run/t7445.scala b/test/files/run/t7445.scala
new file mode 100644
index 0000000000..e4ffeb8e1a
--- /dev/null
+++ b/test/files/run/t7445.scala
@@ -0,0 +1,6 @@
+import scala.collection.immutable.ListMap
+
+object Test extends App {
+ val a = ListMap(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4, 5 -> 5);
+ require(a.tail == ListMap(2 -> 2, 3 -> 3, 4 -> 4, 5 -> 5));
+}
diff --git a/test/files/run/t7700.check b/test/files/run/t7700.check
new file mode 100644
index 0000000000..ca8e686984
--- /dev/null
+++ b/test/files/run/t7700.check
@@ -0,0 +1,2 @@
+public abstract java.lang.Object C.bar(java.lang.Object)
+public abstract java.lang.Object C.foo(java.lang.Object)
diff --git a/test/files/run/t7700.scala b/test/files/run/t7700.scala
new file mode 100644
index 0000000000..76d16b808c
--- /dev/null
+++ b/test/files/run/t7700.scala
@@ -0,0 +1,17 @@
+import scala.annotation._
+
+trait C[@specialized U] {
+ @unspecialized
+ def foo(u: U): U
+ @unspecialized
+ def bar[A](u: U) = u
+}
+
+object Test extends App {
+ val declared = classOf[C[_]].getDeclaredMethods.sortBy(_.getName)
+ println(declared.mkString("\n"))
+ object CInt extends C[Int] { def foo(i: Int) = i }
+ object CAny extends C[Any] { def foo(a: Any) = a }
+ assert(CInt.foo(1) == 1)
+ assert(CAny.foo("") == "")
+}
diff --git a/test/disabled/run/t7843-jsr223-service.check b/test/files/run/t7843-jsr223-service.check
index a668df3567..a668df3567 100644
--- a/test/disabled/run/t7843-jsr223-service.check
+++ b/test/files/run/t7843-jsr223-service.check
diff --git a/test/files/run/t7843-jsr223-service.scala b/test/files/run/t7843-jsr223-service.scala
new file mode 100644
index 0000000000..31112212ea
--- /dev/null
+++ b/test/files/run/t7843-jsr223-service.scala
@@ -0,0 +1,8 @@
+import scala.tools.nsc.interpreter.IMain
+
+object Test extends App {
+ val engine = new IMain.Factory getScriptEngine()
+ engine.asInstanceOf[IMain].settings.usejavacp.value = true
+ engine put ("n", 10)
+ engine eval "1 to n.asInstanceOf[Int] foreach print"
+}
diff --git a/test/files/run/t7933.check b/test/files/run/t7933.check
new file mode 100644
index 0000000000..317e9677c3
--- /dev/null
+++ b/test/files/run/t7933.check
@@ -0,0 +1,2 @@
+hello
+hello
diff --git a/test/files/run/t7933.scala b/test/files/run/t7933.scala
new file mode 100644
index 0000000000..b06dffcd80
--- /dev/null
+++ b/test/files/run/t7933.scala
@@ -0,0 +1,11 @@
+import scala.tools.nsc.interpreter.IMain
+
+object Test extends App {
+ val engine = new IMain.Factory getScriptEngine()
+ engine.asInstanceOf[IMain].settings.usejavacp.value = true
+ val res2 = engine.asInstanceOf[javax.script.Compilable]
+ res2 compile "8" eval()
+ val res5 = res2 compile """println("hello") ; 8"""
+ res5 eval()
+ res5 eval()
+}
diff --git a/test/files/run/t8199.scala b/test/files/run/t8199.scala
new file mode 100644
index 0000000000..50994159ed
--- /dev/null
+++ b/test/files/run/t8199.scala
@@ -0,0 +1,105 @@
+class reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname {
+object obj0
+object obj01
+object obj012
+object obj0123
+object obj01234
+object obj012345
+object obj0123456
+object obj01234567
+object obj012345678
+object obj0123456789
+object obj01234567890
+class cls0
+class cls01
+class cls012
+class cls0123
+class cls01234
+class cls012345
+class cls0123456
+class cls01234567
+class cls012345678
+class cls0123456789
+class cls01234567890
+trait trt0 { def x = Test.checkCallerImplClassName() }
+trait trt01 { def x = Test.checkCallerImplClassName() }
+trait trt012 { def x = Test.checkCallerImplClassName() }
+trait trt0123 { def x = Test.checkCallerImplClassName() }
+trait trt01234 { def x = Test.checkCallerImplClassName() }
+trait trt012345 { def x = Test.checkCallerImplClassName() }
+trait trt0123456 { def x = Test.checkCallerImplClassName() }
+trait trt01234567 { def x = Test.checkCallerImplClassName() }
+trait trt012345678 { def x = Test.checkCallerImplClassName() }
+trait trt0123456789 { def x = Test.checkCallerImplClassName() }
+trait trt01234567890 { def x = Test.checkCallerImplClassName() }
+}
+
+object Test extends App {
+ def check(c: Class[_]) {
+ checkClassName(c.getName)
+ }
+ def checkClassName(name: String) {
+ val defaultMaxClassFileLength = 255
+ assert((name + ".class").length <= defaultMaxClassFileLength, name)
+ }
+ def checkCallerImplClassName() {
+ val name = Thread.currentThread.getStackTrace.apply(2).getClassName
+ assert(name.contains("$class"))
+ Test.checkClassName(name)
+ }
+
+ val c = new reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname
+ import c._
+
+ check(obj0.getClass)
+ check(obj01.getClass)
+ check(obj012.getClass)
+ check(obj0123.getClass)
+ check(obj01234.getClass)
+ check(obj012345.getClass)
+ check(obj0123456.getClass)
+ check(obj01234567.getClass)
+ check(obj012345678.getClass)
+ check(obj0123456789.getClass)
+ check(obj01234567890.getClass)
+
+ check(classOf[cls0])
+ check(classOf[cls01])
+ check(classOf[cls012])
+ check(classOf[cls0123])
+ check(classOf[cls01234])
+ check(classOf[cls012345])
+ check(classOf[cls0123456])
+ check(classOf[cls01234567])
+ check(classOf[cls012345678])
+ check(classOf[cls0123456789])
+ check(classOf[cls01234567890])
+
+ // interface facets
+ check(classOf[trt0])
+ check(classOf[trt01])
+ check(classOf[trt012])
+ check(classOf[trt0123])
+ check(classOf[trt01234])
+ check(classOf[trt012345])
+ check(classOf[trt0123456])
+ check(classOf[trt01234567])
+ check(classOf[trt012345678])
+ check(classOf[trt0123456789])
+ check(classOf[trt01234567890])
+
+ // impl classes are harder to find the names of to test!
+ (new trt0 {}).x
+ (new trt01 {}).x
+ (new trt012 {}).x
+ (new trt0123 {}).x
+ (new trt01234 {}).x
+ (new trt012345 {}).x
+ (new trt0123456 {}).x
+ (new trt01234567 {}).x
+ (new trt012345678 {}).x
+ (new trt0123456789 {}).x
+ (new trt01234567890 {}).x
+}
+
+// filename too long: reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname$obj012345$.class
diff --git a/test/files/run/t8233-bcode.flags b/test/files/run/t8233-bcode.flags
new file mode 100644
index 0000000000..c30091d3de
--- /dev/null
+++ b/test/files/run/t8233-bcode.flags
@@ -0,0 +1 @@
+-Ybackend:GenBCode
diff --git a/test/files/run/t8233-bcode.scala b/test/files/run/t8233-bcode.scala
new file mode 100644
index 0000000000..fae1c2b702
--- /dev/null
+++ b/test/files/run/t8233-bcode.scala
@@ -0,0 +1,18 @@
+object Test {
+ def bar(s: String) = s;
+ val o: Option[Null] = None
+ def nullReference {
+ val a: Null = o.get
+ bar(a) // Was: VerifyError under GenICode
+ }
+
+ def literal {
+ val a: Null = null
+ bar(a)
+ }
+
+ def main(args: Array[String]) = {
+ try { nullReference } catch { case _: NoSuchElementException => }
+ literal
+ }
+}
diff --git a/test/files/run/t8233.scala b/test/files/run/t8233.scala
new file mode 100644
index 0000000000..fae1c2b702
--- /dev/null
+++ b/test/files/run/t8233.scala
@@ -0,0 +1,18 @@
+object Test {
+ def bar(s: String) = s;
+ val o: Option[Null] = None
+ def nullReference {
+ val a: Null = o.get
+ bar(a) // Was: VerifyError under GenICode
+ }
+
+ def literal {
+ val a: Null = null
+ bar(a)
+ }
+
+ def main(args: Array[String]) = {
+ try { nullReference } catch { case _: NoSuchElementException => }
+ literal
+ }
+}
diff --git a/test/files/run/t8245.scala b/test/files/run/t8245.scala
new file mode 100644
index 0000000000..d44defbb9e
--- /dev/null
+++ b/test/files/run/t8245.scala
@@ -0,0 +1,14 @@
+object Test {
+ def foo(o: Option[Int]): Int = {
+ lazy val i: Int = {
+ def local: Int = {if ("".isEmpty) return 42; -42}
+ assert(local == 42)
+ o.getOrElse(return -1)
+ }
+ i + 1
+ }
+
+ def main(args: Array[String]) {
+ assert(foo(None) == -1)
+ }
+}
diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
index 2af656c7c9..dcd4f63a4d 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
@@ -7,7 +7,9 @@ object DefinitionConstructionProps
with TraitConstruction
with TypeDefConstruction
with ValDefConstruction
- with PackageConstruction {
+ with DefConstruction
+ with PackageConstruction
+ with ImportConstruction {
property("SI-6842") = test {
val x: Tree = q"val x: Int"
assertEqAst(q"def f($x) = 0", "def f(x: Int) = 0")
@@ -228,13 +230,13 @@ trait MethodConstruction { self: QuasiquoteProperties =>
property("splice type name into annotation") = test {
val name = TypeName("annot")
- assertSameAnnots(q"@$name def foo", List(annot(name)))
+ assertSameAnnots(q"@$name def foo", List(q"new $name"))
}
property("splice ident into annotation") = test {
val name = TypeName("annot")
val ident = Ident(name)
- assertSameAnnots(q"@$ident def foo", List(annot(name)))
+ assertSameAnnots(q"@$ident def foo", List(q"new $name"))
}
property("splice idents into annotation") = test {
@@ -244,36 +246,36 @@ trait MethodConstruction { self: QuasiquoteProperties =>
}
property("splice constructor calls into annotation") = test {
- val ctorcalls = List(annot("a1"), annot("a2"))
+ val ctorcalls = List(q"new a1", q"new a2")
assertSameAnnots(q"@..$ctorcalls def foo", ctorcalls)
}
property("splice multiple annotations (1)") = test {
- val annot1 = annot("a1")
- val annot2 = annot("a2")
+ val annot1 = q"new a1"
+ val annot2 = q"new a2"
val res = q"@$annot1 @$annot2 def foo"
assertSameAnnots(res, List(annot1, annot2))
}
property("splice multiple annotations (2)") = test {
- val annot1 = annot("a1")
- val annots = List(annot("a2"), annot("a3"))
+ val annot1 = q"new a1"
+ val annots = List(q"new a2", q"new a3")
val res = q"@$annot1 @..$annots def foo"
assertSameAnnots(res, annot1 :: annots)
}
property("splice annotations with arguments (1)") = test {
- val a = annot("a", List(q"x"))
+ val a = q"new a(x)"
assertSameAnnots(q"@$a def foo", q"@a(x) def foo")
}
property("splice annotations with arguments (2)") = test {
- val a = newTypeName("a")
+ val a = TypeName("a")
assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo")
}
property("splice annotations with arguments (3") = test {
- val a = Ident(newTypeName("a"))
+ val a = Ident(TypeName("a"))
assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo")
}
@@ -285,7 +287,7 @@ trait MethodConstruction { self: QuasiquoteProperties =>
}
property("can't splice annotations with arguments specificed twice") = test {
- val a = annot("a", List(q"x"))
+ val a = q"new a(x)"
assertThrows[IllegalArgumentException] {
q"@$a(y) def foo"
}
@@ -349,4 +351,43 @@ trait PackageConstruction { self: QuasiquoteProperties =>
assertEqAst(q"package object foo extends { ..$edefs } with Any",
"package object foo extends { val x = 1; type I = Int } with Any")
}
-} \ No newline at end of file
+}
+
+trait DefConstruction { self: QuasiquoteProperties =>
+ property("construct implicit args (1)") = test {
+ val x = q"val x: Int"
+ assertEqAst(q"def foo(implicit $x) = x", "def foo(implicit x: Int) = x")
+ }
+
+ property("construct implicit args (2)") = test {
+ val xs = q"val x1: Int" :: q"val x2: Long" :: Nil
+ assertEqAst(q"def foo(implicit ..$xs) = x1 + x2", "def foo(implicit x1: Int, x2: Long) = x1 + x2")
+ }
+}
+
+trait ImportConstruction { self: QuasiquoteProperties =>
+ property("construct wildcard import") = test {
+ val sel = pq"_"
+ assert(q"import foo.$sel" ≈ q"import foo._")
+ }
+
+ property("construct named import") = test {
+ val sel = pq"bar"
+ assert(q"import foo.$sel" ≈ q"import foo.bar")
+ }
+
+ property("construct renaming import") = test {
+ val sel = pq"bar -> baz"
+ assert(q"import foo.$sel" ≈ q"import foo.{bar => baz}")
+ }
+
+ property("construct unimport import") = test {
+ val sels = pq"poison -> _" :: pq"_" :: Nil
+ assert(q"import foo.{..$sels}" ≈ q"import foo.{poison => _, _}")
+ }
+
+ property("construct mixed import") = test {
+ val sels = pq"a -> b" :: pq"c -> _" :: pq"_" :: Nil
+ assert(q"import foo.{..$sels}" ≈ q"import foo.{a => b, c => _, _}")
+ }
+}
diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
index 94465930ed..e2d1757d48 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
@@ -8,7 +8,9 @@ object DefinitionDeconstructionProps
with ObjectDeconstruction
with ModsDeconstruction
with ValVarDeconstruction
+ with DefDeconstruction
with PackageDeconstruction
+ with ImportDeconstruction
trait TraitDeconstruction { self: QuasiquoteProperties =>
property("exhaustive trait matcher") = test {
@@ -124,18 +126,28 @@ trait ModsDeconstruction { self: QuasiquoteProperties =>
}
property("@..$annots def foo") = test {
- val a = annot("a")
- val b = annot("b")
+ val a = q"new a"
+ val b = q"new b"
val q"@..$annots def foo" = q"@$a @$b def foo"
annots ≈ List(a, b)
}
property("@$annot @..$annots def foo") = test {
- val a = annot("a")
- val b = annot("b")
- val c = annot("c")
+ val a = q"new a"
+ val b = q"new b"
+ val c = q"new c"
val q"@$first @..$rest def foo" = q"@$a @$b @$c def foo"
- first ≈ a && rest ≈ List(b, c)
+ assert(first ≈ a)
+ assert(rest ≈ List(b, c))
+ }
+
+ property("@..$anots @$annot def foo") = test {
+ val a = q"new a"
+ val b = q"new b"
+ val c = q"new c"
+ val q"@..$init @$last def foo" = q"@$a @$b @$c def foo"
+ assert(init ≈ List(a, b))
+ assert(last ≈ c)
}
}
@@ -179,4 +191,84 @@ trait PackageDeconstruction { self: QuasiquoteProperties =>
matches("package object foo extends { val early = 1 } with daddy")
assertThrows[MatchError] { matches("object foo") }
}
-} \ No newline at end of file
+}
+
+trait DefDeconstruction { self: QuasiquoteProperties =>
+ property("exhaustive def matcher") = test {
+ def matches(line: String) = {
+ val t = parse(line)
+ val q"$mods0 def $name0[..$targs0](...$argss0): $restpe0 = $body0" = t
+ val q"$mods1 def $name1[..$targs1](...$argss1)(implicit ..$impl1): $restpe1 = $body1" = t
+ }
+ matches("def foo = foo")
+ matches("implicit def foo: Int = 2")
+ matches("def foo[T](x: T): T = x")
+ matches("def foo[A: B] = implicitly[B[A]]")
+ matches("private def foo = 0")
+ matches("def foo[A <% B] = null")
+ matches("def foo(one: One)(two: Two) = (one, two)")
+ matches("def foo[T](args: T*) = args.toList")
+ }
+
+ property("extract implicit arg list (1)") = test {
+ val q"def foo(...$argss)(implicit ..$impl)" = q"def foo(x: Int)(implicit y: Int)"
+ assert(impl ≈ List(q"${Modifiers(IMPLICIT | PARAM)} val y: Int"))
+ }
+
+ property("extract implicit arg list (2)") = test {
+ val q"def foo(...$argss)(implicit ..$impl)" = q"def foo(x: Int)"
+ assert(impl.isEmpty)
+ }
+}
+
+trait ImportDeconstruction { self: QuasiquoteProperties =>
+ property("exhaustive import matcher") = test {
+ def matches(line: String) = {
+ val q"import $ref.{..$sels}" = parse(line)
+ }
+ matches("import foo.bar")
+ matches("import foo.{bar, baz}")
+ matches("import foo.{a => b, c => d}")
+ matches("import foo.{poision => _, _}")
+ matches("import foo.bar.baz._")
+ }
+
+ property("extract import binding") = test {
+ val q"import $_.$sel" = q"import foo.bar"
+ val pq"bar" = sel
+ }
+
+ property("extract import wildcard") = test {
+ val q"import $_.$sel" = q"import foo._"
+ val pq"_" = sel
+ }
+
+ property("extract import rename") = test {
+ val q"import $_.$sel" = q"import foo.{bar => baz}"
+ val pq"bar -> baz" = sel
+ val pq"$left -> $right" = sel
+ val pq"bar" = left
+ val pq"baz" = right
+ }
+
+ property("extract import unimport") = test {
+ val q"import $_.$sel" = q"import foo.{bar => _}"
+ val pq"bar -> _" = sel
+ val pq"$left -> $right" = sel
+ val pq"bar" = left
+ val pq"_" = right
+ }
+
+ property("splice names into import selector") = forAll {
+ (expr: Tree, plain: TermName, oldname: TermName, newname: TermName, discard: TermName) =>
+
+ val Import(expr1, List(
+ ImportSelector(plain11, _, plain12, _),
+ ImportSelector(oldname1, _, newname1, _),
+ ImportSelector(discard1, _, wildcard, _))) =
+ q"import $expr.{$plain, $oldname => $newname, $discard => _}"
+
+ expr1 ≈ expr && plain11 == plain12 && plain12 == plain &&
+ oldname1 == oldname && newname1 == newname && discard1 == discard && wildcard == nme.WILDCARD
+ }
+}
diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala
index 92d299bede..1ba9bba381 100644
--- a/test/files/scalacheck/quasiquotes/ErrorProps.scala
+++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala
@@ -32,12 +32,6 @@ object ErrorProps extends QuasiquoteProperties("errors") {
q"@...$annots def foo"
""")
- property("@..$first @$rest def foo") = fails(
- "Can't extract with .. here",
- """
- q"@a @b @c def foo" match { case q"@..$first @$rest def foo" => }
- """)
-
property("only literal string arguments") = fails(
"Quasiquotes can only be used with literal strings",
"""
@@ -52,13 +46,6 @@ object ErrorProps extends QuasiquoteProperties("errors") {
StringContext("\"", "\"").q(x)
""")
- property("expected different cardinality") = fails(
- "Can't splice List[reflect.runtime.universe.Tree] with ..., consider using ..",
- """
- val args: List[Tree] = Nil
- q"f(...$args)"
- """)
-
property("non-liftable type ..") = fails(
"Can't splice List[StringBuilder] with .., consider omitting the dots or providing an implicit instance of Liftable[StringBuilder]",
"""
@@ -90,13 +77,6 @@ object ErrorProps extends QuasiquoteProperties("errors") {
q"$xs"
""")
- property("use zero card") = fails(
- "Can't splice reflect.runtime.universe.Tree with .., consider omitting the dots",
- """
- val t = EmptyTree
- q"f(..$t)"
- """)
-
property("not liftable or natively supported") = fails(
"Can't splice StringBuilder, consider providing an implicit instance of Liftable[StringBuilder]",
"""
@@ -154,12 +134,6 @@ object ErrorProps extends QuasiquoteProperties("errors") {
q"$m1 $m2 def foo"
""")
- property("can't extract with .. card here") = fails(
- "Can't extract with .. here",
- """
- val q"f(..$xs, $y)" = EmptyTree
- """)
-
property("can't extract mods with annots") = fails(
"Can't extract modifiers together with annotations, consider extracting just modifiers",
"""
@@ -188,4 +162,4 @@ object ErrorProps extends QuasiquoteProperties("errors") {
// // Make sure a nice error is reported in this case
// { import Flag._; val mods = NoMods; q"lazy $mods val x: Int" }
-} \ No newline at end of file
+}
diff --git a/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
index cccf8095db..c8e66c7ef5 100644
--- a/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
@@ -22,8 +22,18 @@ object PatternDeconstructionProps extends QuasiquoteProperties("pattern deconstr
pat0 ≈ pat && subpat0 ≈ subpat
}
+ property("extract apply many") = forAll { (pat: Tree, subpats: List[Tree]) =>
+ val pq"$pat0(..$subpats0)" = pq"$pat(..$subpats)"
+ pat0 ≈ pat && subpats0 ≈ subpats
+ }
+
+ property("extract apply last") = forAll { (pat: Tree, subpats: List[Tree], subpatlast: Tree) =>
+ val pq"$pat0(..$subpats0, $subpatlast0)" = pq"$pat(..$subpats, $subpatlast)"
+ pat0 ≈ pat && subpats0 ≈ subpats && subpatlast0 ≈ subpatlast
+ }
+
property("extract casedef") = forAll { (pat: Tree, cond: Tree, body: Tree) =>
val cq"$pat0 if $cond0 => $body0" = cq"$pat if $cond => $body"
pat0 ≈ pat && cond0 ≈ cond && body0 ≈ body
}
-} \ No newline at end of file
+}
diff --git a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
index e4ee5dfcae..589b8d4d72 100644
--- a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
+++ b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
@@ -116,10 +116,5 @@ trait Helpers {
}
}
- def annot(name: String): Tree = annot(TypeName(name), Nil)
- def annot(name: TypeName): Tree = annot(name, Nil)
- def annot(name: String, args: List[Tree]): Tree = annot(TypeName(name), args)
- def annot(name: TypeName, args: List[Tree]): Tree = q"new $name(..$args)"
-
val scalapkg = build.setSymbol(Ident(TermName("scala")), definitions.ScalaPackage)
}
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
index 38fbfa9f7f..058880a25c 100644
--- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
@@ -85,19 +85,6 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
q"$fun[..$types]" ≈ (if (types.nonEmpty) TypeApply(fun, types) else fun)
}
- property("splice names into import selector") = forAll {
- (expr: Tree, plain: Name, oldname: Name, newname: Name, discard: Name) =>
-
- val Import(expr1, List(
- ImportSelector(plain11, _, plain12, _),
- ImportSelector(oldname1, _, newname1, _),
- ImportSelector(discard1, _, wildcard, _))) =
- q"import $expr.{$plain, $oldname => $newname, $discard => _}"
-
- expr1 ≈ expr && plain11 == plain12 && plain12 == plain &&
- oldname1 == oldname && newname1 == newname && discard1 == discard && wildcard == nme.WILDCARD
- }
-
property("splice trees into while loop") = forAll { (cond: Tree, body: Tree) =>
val LabelDef(_, List(), If(cond1, Block(List(body1), Apply(_, List())), Literal(Constant(())))) = q"while($cond) $body"
body1 ≈ body && cond1 ≈ cond
@@ -116,7 +103,7 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
def blockInvariant(quote: Tree, trees: List[Tree]) =
quote ≈ (trees match {
- case Nil => q"()"
+ case Nil => q""
case _ :+ last if !last.isTerm => Block(trees, q"()")
case head :: Nil => head
case init :+ last => Block(init, last)
@@ -229,4 +216,71 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
val q"($a, $b) => $_" = q"_ + _"
assert(a.name != b.name)
}
+
+ property("SI-7275 a") = test {
+ val t = q"stat1; stat2"
+ assertEqAst(q"..$t", "{stat1; stat2}")
+ }
+
+ property("SI-7275 b") = test {
+ def f(t: Tree) = q"..$t"
+ assertEqAst(f(q"stat1; stat2"), "{stat1; stat2}")
+ }
+
+ property("SI-7275 c1") = test {
+ object O
+ implicit val liftO = Liftable[O.type] { _ => q"foo; bar" }
+ assertEqAst(q"f(..$O)", "f(foo, bar)")
+ }
+
+ property("SI-7275 c2") = test {
+ object O
+ implicit val liftO = Liftable[O.type] { _ => q"{ foo; bar }; { baz; bax }" }
+ assertEqAst(q"f(...$O)", "f(foo, bar)(baz, bax)")
+ }
+
+ property("SI-7275 d") = test {
+ val l = q"a; b" :: q"c; d" :: Nil
+ assertEqAst(q"f(...$l)", "f(a, b)(c, d)")
+ val l2: Iterable[Tree] = l
+ assertEqAst(q"f(...$l2)", "f(a, b)(c, d)")
+ }
+
+ property("SI-7275 e") = test {
+ val t = q"{ a; b }; { c; d }"
+ assertEqAst(q"f(...$t)", "f(a, b)(c, d)")
+ }
+
+ property("SI-7275 e2") = test {
+ val t = q"{ a; b }; c; d"
+ assertEqAst(q"f(...$t)", "f(a, b)(c)(d)")
+ }
+
+ property("remove synthetic unit") = test {
+ val q"{ ..$stats1 }" = q"{ def x = 2 }"
+ assert(stats1 ≈ List(q"def x = 2"))
+ val q"{ ..$stats2 }" = q"{ class X }"
+ assert(stats2 ≈ List(q"class X"))
+ val q"{ ..$stats3 }" = q"{ type X = Int }"
+ assert(stats3 ≈ List(q"type X = Int"))
+ val q"{ ..$stats4 }" = q"{ val x = 2 }"
+ assert(stats4 ≈ List(q"val x = 2"))
+ }
+
+ property("don't remove user-defined unit") = test {
+ val q"{ ..$stats }" = q"{ def x = 2; () }"
+ assert(stats ≈ List(q"def x = 2", q"()"))
+ }
+
+ property("empty-tree as block") = test {
+ val q"{ ..$stats1 }" = q" "
+ assert(stats1.isEmpty)
+ val stats2 = List.empty[Tree]
+ assert(q"{ ..$stats2 }" ≈ q"")
+ }
+
+ property("consistent variable order") = test {
+ val q"$a = $b = $c = $d = $e = $f = $g = $h = $k = $l" = q"a = b = c = d = e = f = g = h = k = l"
+ assert(a ≈ q"a" && b ≈ q"b" && c ≈ q"c" && d ≈ q"d" && e ≈ q"e" && g ≈ q"g" && h ≈ q"h" && k ≈ q"k" && l ≈ q"l")
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
index 8d1ada342a..148bb383b0 100644
--- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -29,14 +29,34 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
y1 ≈ x1 && y2 ≈ x2 && ys ≈ List(x3)
}
+ property("f(y1, ..ys, yn)") = forAll { (x1: Tree, x2: Tree, x3: Tree, x4: Tree) =>
+ val q"f($y1, ..$ys, $yn)" = q"f($x1, $x2, $x3, $x4)"
+ y1 ≈ x1 && ys ≈ List(x2, x3) && yn ≈ x4
+ }
+
+ property("f(..ys, y_{n-1}, y_n)") = forAll { (x1: Tree, x2: Tree, x3: Tree, x4: Tree) =>
+ val q"f(..$ys, $yn1, $yn)" = q"f($x1, $x2, $x3, $x4)"
+ ys ≈ List(x1, x2) && yn1 ≈ x3 && yn ≈ x4
+ }
+
property("f(...xss)") = forAll { (x1: Tree, x2: Tree) =>
- val q"f(...$argss)" = q"f($x1)($x2)"
- argss ≈ List(List(x1), List(x2))
+ val q"f(...$xss)" = q"f($x1)($x2)"
+ xss ≈ List(List(x1), List(x2))
+ }
+
+ property("f(...$xss)(..$last)") = forAll { (x1: Tree, x2: Tree, x3: Tree) =>
+ val q"f(...$xss)(..$last)" = q"f($x1)($x2)($x3)"
+ xss ≈ List(List(x1), List(x2)) && last ≈ List(x3)
+ }
+
+ property("f(...$xss)(..$lastinit, $lastlast)") = forAll { (x1: Tree, x2: Tree, x3: Tree, x4: Tree) =>
+ val q"f(...$xss)(..$lastinit, $lastlast)" = q"f($x1)($x2, $x3, $x4)"
+ xss ≈ List(List(x1)) && lastinit ≈ List(x2, x3) && lastlast ≈ x4
}
property("f(...xss) = f") = forAll { (x1: Tree, x2: Tree) =>
- val q"f(...$argss)" = q"f"
- argss ≈ List()
+ val q"f(...$xss)" = q"f"
+ xss ≈ List()
}
property("deconstruct unit as tuple") = test {
@@ -51,12 +71,27 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
property("deconstruct tuple mixed") = test {
val q"($first, ..$rest)" = q"(a, b, c)"
- assert(first ≈ q"a" && rest ≈ List(q"b", q"c"))
+ assert(first ≈ q"a")
+ assert(rest ≈ List(q"b", q"c"))
+ }
+
+ property("deconstruct tuple last element") = test {
+ val q"($first, ..$rest, $last)" = q"(a, b, c, d)"
+ assert(first ≈ q"a")
+ assert(rest ≈ List(q"b", q"c"))
+ assert(last ≈ q"d")
}
property("deconstruct cases") = test {
val q"$x match { case ..$cases }" = q"x match { case 1 => case 2 => }"
- x ≈ q"x" && cases ≈ List(cq"1 =>", cq"2 =>")
+ assert(x ≈ q"x")
+ assert(cases ≈ List(cq"1 =>", cq"2 =>"))
+ }
+
+ property("deconstruct splitting last case") = test {
+ val q"$_ match { case ..$cases case $last }" = q"x match { case 1 => case 2 => case 3 => }"
+ assert(cases ≈ List(cq"1 =>", cq"2 =>"))
+ assert(last ≈ cq"3 =>")
}
property("deconstruct block") = test {
@@ -64,6 +99,12 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
assert(xs ≈ List(q"x1", q"x2", q"x3"))
}
+ property("deconstruct last element of a block") = test {
+ val q"{ ..$xs; $x }" = q"x1; x2; x3; x4"
+ assert(xs ≈ List(q"x1", q"x2", q"x3"))
+ assert(x ≈ q"x4")
+ }
+
property("exhaustive function matcher") = test {
def matches(line: String) { val q"(..$args) => $body" = parse(line) }
matches("() => bippy")
diff --git a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
index be7a96d91e..78b54a4e49 100644
--- a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
@@ -28,4 +28,10 @@ object TypeConstructionProps extends QuasiquoteProperties("type construction")
val restpe = tq"C"
assert(tq"..$argtpes => $restpe" ≈ tq"(A, B) => C")
}
-} \ No newline at end of file
+
+ property("empty tq") = test {
+ val tt: TypeTree = tq""
+ assert(tt.tpe == null)
+ assert(tt.original == null)
+ }
+}
diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
index 499f5d6d8e..0fdcc19052 100644
--- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
@@ -13,23 +13,49 @@ object TypeDeconstructionProps extends QuasiquoteProperties("type deconstruction
a ≈ Ident(name1) && b ≈ Ident(name2)
}
- property("tuple type") = test {
+ property("tuple type (1)") = test {
val tq"(..$empty)" = tq"_root_.scala.Unit"
assert(empty.isEmpty)
+ }
+
+ property("tuple type (2)") = test {
val tq"(..$ts)" = tq"(t1, t2)"
assert(ts ≈ List(tq"t1", tq"t2"))
+ }
+
+ property("tuple type (3)") = test {
val tq"($head, ..$tail)" = tq"(t0, t1, t2)"
- assert(head ≈ tq"t0" && tail ≈ List(tq"t1", tq"t2"))
+ assert(head ≈ tq"t0")
+ assert(tail ≈ List(tq"t1", tq"t2"))
+ }
+
+ property("tuple type (4)") = test {
+ val tq"(..$init, $last)" = tq"(t0, t1, t2)"
+ assert(init ≈ List(tq"t0", tq"t1"))
+ assert(last ≈ tq"t2")
}
property("refined type") = test {
val tq"T { ..$stats }" = tq"T { def foo; val x: Int; type Y = String }"
- assert(stats ≈ (q"def foo" :: q"val x: Int" :: q"type Y = String" :: Nil))
+ assert(stats ≈ List(q"def foo", q"val x: Int", q"type Y = String"))
}
- property("function type") = test {
+ property("function type (1)") = test {
val tq"..$argtpes => $restpe" = tq"(A, B) => C"
- assert(argtpes ≈ (tq"A" :: tq"B" :: Nil))
+ assert(argtpes ≈ List(tq"A", tq"B"))
assert(restpe ≈ tq"C")
}
-} \ No newline at end of file
+
+ property("function type (2)") = test {
+ val tq"(..$argtpes, $arglast) => $restpe" = tq"(A, B, C) => D"
+ assert(argtpes ≈ List(tq"A", tq"B"))
+ assert(arglast ≈ tq"C")
+ assert(restpe ≈ tq"D")
+ }
+
+ property("match empty type tree") = test {
+ val tq"" = TypeTree()
+ // matches because type tree isn't syntactic without original
+ val tq"" = tq"${typeOf[Int]}"
+ }
+}
diff --git a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
index 2f501435e3..3afb47952c 100644
--- a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
@@ -75,4 +75,11 @@ object TypecheckedProps extends QuasiquoteProperties("typechecked") {
assert(f.original ≈ pq"Test.this.Cell")
assert(args ≈ List(pq"v"))
}
-} \ No newline at end of file
+
+ property("extract inferred val type") = test {
+ val typechecked = typecheck(q"val x = 42")
+ val q"val x = 42" = typechecked
+ val q"val x: ${tq""} = 42" = typechecked
+ val q"val x: ${t: Type} = 42" = typechecked
+ }
+}
diff --git a/test/junit/scala/collection/SetMapConsistencyTest.scala b/test/junit/scala/collection/SetMapConsistencyTest.scala
index c62b074483..0d6f43db06 100644
--- a/test/junit/scala/collection/SetMapConsistencyTest.scala
+++ b/test/junit/scala/collection/SetMapConsistencyTest.scala
@@ -476,4 +476,35 @@ class SetMapConsistencyTest {
}
assert(test)
}
+
+ @Test
+ def testSI8213() {
+ val am = new scala.collection.mutable.AnyRefMap[String, Int]
+ for (i <- 0 until 1024) am += i.toString -> i
+ am.getOrElseUpdate("1024", { am.clear; -1 })
+ assert(am == scala.collection.mutable.AnyRefMap("1024" -> -1))
+ val lm = new scala.collection.mutable.LongMap[Int]
+ for (i <- 0 until 1024) lm += i.toLong -> i
+ lm.getOrElseUpdate(1024, { lm.clear; -1 })
+ assert(lm == scala.collection.mutable.LongMap(1024L -> -1))
+ }
+
+ // Mutating when an iterator is in the wild shouldn't produce random junk in the iterator
+ // Todo: test all sets/maps this way
+ @Test
+ def testSI8154() {
+ def f() = {
+ val xs = scala.collection.mutable.AnyRefMap[String, Int]("a" -> 1)
+ val it = xs.iterator
+ it.hasNext
+ xs.clear()
+
+ if (it.hasNext) Some(it.next)
+ else None
+ }
+ assert(f() match {
+ case Some((a,b)) if (a==null || b==null) => false
+ case _ => true
+ })
+ }
}
diff --git a/test/junit/scala/reflect/internal/util/SourceFileTest.scala b/test/junit/scala/reflect/internal/util/SourceFileTest.scala
new file mode 100644
index 0000000000..903e705ba2
--- /dev/null
+++ b/test/junit/scala/reflect/internal/util/SourceFileTest.scala
@@ -0,0 +1,55 @@
+package scala.reflect.internal.util
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(classOf[JUnit4])
+class SourceFileTest {
+ def lineContentOf(code: String, offset: Int) =
+ Position.offset(new BatchSourceFile("", code), offset).lineContent
+
+ @Test
+ def si8205_overflow(): Unit = {
+ val file = new BatchSourceFile("", "code no newline")
+ // the bug in lineToString counted until MaxValue, and the AIOOBE came from here
+ assertFalse(file.isEndOfLine(Int.MaxValue))
+ }
+
+ @Test
+ def si8205_lineToString(): Unit = {
+ assertEquals("", lineContentOf("", 0))
+ assertEquals("abc", lineContentOf("abc", 0))
+ assertEquals("abc", lineContentOf("abc", 3))
+ assertEquals("code no newline", lineContentOf("code no newline", 1))
+ assertEquals("", lineContentOf("\n", 0))
+ assertEquals("abc", lineContentOf("abc\ndef", 0))
+ assertEquals("abc", lineContentOf("abc\ndef", 3))
+ assertEquals("def", lineContentOf("abc\ndef", 4))
+ assertEquals("def", lineContentOf("abc\ndef", 6))
+ assertEquals("def", lineContentOf("abc\ndef\n", 7))
+ }
+
+ @Test
+ def CRisEOL(): Unit = {
+ assertEquals("", lineContentOf("\r", 0))
+ assertEquals("abc", lineContentOf("abc\rdef", 0))
+ assertEquals("abc", lineContentOf("abc\rdef", 3))
+ assertEquals("def", lineContentOf("abc\rdef", 4))
+ assertEquals("def", lineContentOf("abc\rdef", 6))
+ assertEquals("def", lineContentOf("abc\rdef\r", 7))
+ }
+
+ @Test
+ def CRNLisEOL(): Unit = {
+ assertEquals("", lineContentOf("\r\n", 0))
+ assertEquals("abc", lineContentOf("abc\r\ndef", 0))
+ assertEquals("abc", lineContentOf("abc\r\ndef", 3))
+ assertEquals("abc", lineContentOf("abc\r\ndef", 4))
+ assertEquals("def", lineContentOf("abc\r\ndef", 5))
+ assertEquals("def", lineContentOf("abc\r\ndef", 7))
+ assertEquals("def", lineContentOf("abc\r\ndef", 8))
+ assertEquals("def", lineContentOf("abc\r\ndef\r\n", 9))
+ }
+}
diff --git a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
index a3699a4eeb..b42e9a07cb 100644
--- a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
+++ b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala
@@ -69,6 +69,7 @@ class SymbolTableForUnitTesting extends SymbolTable {
// Members declared in scala.reflect.internal.Required
def picklerPhase: scala.reflect.internal.Phase = SomePhase
+ def erasurePhase: scala.reflect.internal.Phase = SomePhase
// Members declared in scala.reflect.internal.SymbolTable
def currentRunId: Int = 1
diff --git a/test/osgi/src/BasicReflection.scala b/test/osgi/src/BasicReflection.scala
index 68fedb7c83..d601f04f89 100644
--- a/test/osgi/src/BasicReflection.scala
+++ b/test/osgi/src/BasicReflection.scala
@@ -2,6 +2,8 @@ package tools.test.osgi
package reflection
package basic
+import scala.language.higherKinds
+
import org.junit.Assert._
import org.ops4j.pax.exam.CoreOptions._
diff --git a/test/osgi/src/ScalaOsgiHelper.scala b/test/osgi/src/ScalaOsgiHelper.scala
index 7b14cf20e8..084afe8643 100644
--- a/test/osgi/src/ScalaOsgiHelper.scala
+++ b/test/osgi/src/ScalaOsgiHelper.scala
@@ -1,5 +1,5 @@
package tools.test.osgi
-
+
import org.ops4j.pax.exam.CoreOptions._
import org.ops4j.pax.exam
import java.io.File
@@ -12,7 +12,7 @@ trait ScalaOsgiHelper {
}
private def filteredBundleFiles(names: String*): Array[exam.Option] =
- for(bundle <- allBundleFiles; if names exists (bundle.getName contains))
+ for(bundle <- allBundleFiles; if names exists (bundle.getName contains _))
yield makeBundle(bundle)
private def makeBundle(file: File): exam.Option =
@@ -34,5 +34,5 @@ trait ScalaOsgiHelper {
val bundles = filteredBundleFiles("scala-library")
bundles ++ Array[exam.Option](felix(), equinox(), junitBundles())
}
-
+
}
diff --git a/test/pending/run/idempotency-partial-functions.scala b/test/pending/run/idempotency-partial-functions.scala
index e673da5a29..b26c442599 100644
--- a/test/pending/run/idempotency-partial-functions.scala
+++ b/test/pending/run/idempotency-partial-functions.scala
@@ -22,7 +22,7 @@ object Test extends App {
val tb = cm.mkToolBox()
val tpartials = tb.typecheck(partials.tree)
println(tpartials)
- val rtpartials = tb.resetAllAttrs(tpartials)
+ val rtpartials = tb.untypecheck(tpartials)
println(tb.eval(rtpartials))
}
Test.main(null) \ No newline at end of file
diff --git a/test/scaladoc/resources/SI-4014_0.scala b/test/scaladoc/resources/SI-4014_0.scala
new file mode 100644
index 0000000000..c398fcc1e0
--- /dev/null
+++ b/test/scaladoc/resources/SI-4014_0.scala
@@ -0,0 +1,4 @@
+/** A template without authors.
+ *
+ */
+trait Foo \ No newline at end of file
diff --git a/test/scaladoc/resources/SI-4014_1.scala b/test/scaladoc/resources/SI-4014_1.scala
new file mode 100644
index 0000000000..34386b515e
--- /dev/null
+++ b/test/scaladoc/resources/SI-4014_1.scala
@@ -0,0 +1,5 @@
+/** A template with one author.
+ *
+ * @author The Only Author
+ */
+trait Foo \ No newline at end of file
diff --git a/test/scaladoc/resources/SI-4014_2.scala b/test/scaladoc/resources/SI-4014_2.scala
new file mode 100644
index 0000000000..514f7a1e4c
--- /dev/null
+++ b/test/scaladoc/resources/SI-4014_2.scala
@@ -0,0 +1,6 @@
+/** A template with more than one author.
+ *
+ * @author The First Author
+ * @author The Second Author
+ */
+trait Foo \ No newline at end of file
diff --git a/test/scaladoc/run/t7124.check b/test/scaladoc/run/t7124.check
new file mode 100644
index 0000000000..96b627a322
--- /dev/null
+++ b/test/scaladoc/run/t7124.check
@@ -0,0 +1,3 @@
+List()
+List(Paragraph(Text(macro)))
+Done.
diff --git a/test/scaladoc/run/t7124.scala b/test/scaladoc/run/t7124.scala
new file mode 100644
index 0000000000..e8272000d2
--- /dev/null
+++ b/test/scaladoc/run/t7124.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ import scala.language.experimental.macros
+ class Test {
+ def print(): Unit = macro ???
+ }
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(root: Package) = {
+ import access._
+ val p = root._class("Test")._method("print")
+
+ println(p.annotations) // no annotations
+ println(p.flags) // a 'macro' flag
+ }
+}
diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index 03348b81d2..56328ea875 100644
--- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -47,6 +47,7 @@ object Test extends Properties("HtmlFactory") {
settings.scaladocQuietRun = true
settings.nowarn.value = true
settings.classpath.value = getClasspath
+ settings.docAuthor.value = true
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
new DocFactory(reporter, settings)
@@ -563,12 +564,13 @@ object Test extends Properties("HtmlFactory") {
property("Comment inheritance: Correct explicit inheritance for override") =
checkText("explicit-inheritance-override.scala")(
(Some("InheritDocDerived"),
- """def function[T](arg1: T, arg2: String): Double
+ """def function[T](arg1: T, arg2: String): Double
Starting line
Starting line
The base comment. And another sentence...
The base comment. And another sentence...
Ending line
+ Author: StartAuthor a Scala developer EndAuthor
T StartT the type of the first argument EndT
arg1 Start1 The T term comment End1
arg2 Start2 The string comment End2
@@ -589,12 +591,13 @@ object Test extends Properties("HtmlFactory") {
property("Comment inheritance: Correct explicit inheritance for usecase") =
checkText("explicit-inheritance-usecase.scala")(
(Some("UseCaseInheritDoc"),
- """def function[T](arg1: T, arg2: String): Double
+ """def function[T](arg1: T, arg2: String): Double
[use case] Starting line
[use case] Starting line
The base comment. And another sentence...
The base comment. And another sentence...
Ending line
+ Author: StartAuthor a Scala developer EndAuthor
T StartT the type of the first argument EndT
arg1 Start1 The T term comment End1
arg2 Start2 The string comment End2
@@ -663,6 +666,45 @@ object Test extends Properties("HtmlFactory") {
}
}
+ property("SI-4014: Scaladoc omits @author: no authors") = {
+ val noAuthors = createTemplates("SI-4014_0.scala")("Foo.html")
+
+ noAuthors match {
+ case node: scala.xml.Node => {
+ val s = node.toString
+ ! s.contains("Author")
+ }
+ case _ => false
+ }
+ }
+
+ property("SI-4014: Scaladoc omits @author: one author") = {
+ val oneAuthor = createTemplates("SI-4014_1.scala")("Foo.html")
+
+ oneAuthor match {
+ case node: scala.xml.Node => {
+ val s = node.toString
+ s.contains("<h6>Author:</h6>")
+ s.contains("<p>The Only Author\n</p>")
+ }
+ case _ => false
+ }
+ }
+
+ property("SI-4014: Scaladoc omits @author: two authors") = {
+ val twoAuthors = createTemplates("SI-4014_2.scala")("Foo.html")
+
+ twoAuthors match {
+ case node: scala.xml.Node => {
+ val s = node.toString
+ s.contains("<h6>Authors:</h6>")
+ s.contains("<p>The First Author\n</p>")
+ s.contains("<p>The Second Author\n</p>")
+ }
+ case _ => false
+ }
+ }
+
{
val files = createTemplates("basic.scala")
//println(files)