diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/quasiquotes-syntax-error-position.check | 2 | ||||
-rw-r--r-- | test/files/neg/t7980.check (renamed from test/files/neg/si7980.check) | 2 | ||||
-rw-r--r-- | test/files/neg/t7980.scala (renamed from test/files/neg/si7980.scala) | 0 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala | 100 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala | 2 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/ErrorProps.scala | 58 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/LiftableProps.scala | 20 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/PatternConstructionProps.scala | 16 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/TermConstructionProps.scala | 56 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/TypeConstructionProps.scala | 2 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/UnliftableProps.scala | 4 |
11 files changed, 131 insertions, 131 deletions
diff --git a/test/files/neg/quasiquotes-syntax-error-position.check b/test/files/neg/quasiquotes-syntax-error-position.check index 14fef16e01..fd55bd25b5 100644 --- a/test/files/neg/quasiquotes-syntax-error-position.check +++ b/test/files/neg/quasiquotes-syntax-error-position.check @@ -7,7 +7,7 @@ quasiquotes-syntax-error-position.scala:6: error: illegal start of simple expres quasiquotes-syntax-error-position.scala:7: error: '}' expected but end of quote found. q"class $t { def foo = $a" ^ -quasiquotes-syntax-error-position.scala:8: error: '.' expected but splicee found. +quasiquotes-syntax-error-position.scala:8: error: '.' expected but unquotee found. q"import $t $t" ^ quasiquotes-syntax-error-position.scala:9: error: '{' expected but end of quote found. diff --git a/test/files/neg/si7980.check b/test/files/neg/t7980.check index b085cabf1d..031c23dbeb 100644 --- a/test/files/neg/si7980.check +++ b/test/files/neg/t7980.check @@ -1,4 +1,4 @@ -si7980.scala:7: error: Can't splice Nothing, bottom type values often indicate programmer mistake +t7980.scala:7: error: Can't unquote Nothing, bottom type values often indicate programmer mistake println(q"class ${Name(X)} { }") ^ one error found diff --git a/test/files/neg/si7980.scala b/test/files/neg/t7980.scala index b21907de54..b21907de54 100644 --- a/test/files/neg/si7980.scala +++ b/test/files/neg/t7980.scala diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala index 7e846bfb24..fdb0d83277 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala @@ -50,24 +50,24 @@ trait ClassConstruction { self: QuasiquoteProperties => assertEqAst(q"class Foo extends ..$parents", "class Foo") } - property("splice term name into class") = forAll { (rname: TypeName) => + property("unquote term name into class") = forAll { (rname: TypeName) => // add prefix to avoid failure in case rname is keyword val name = TypeName("prefix$" + rname) eqAst(q"class $name", "class " + name.toString) } - property("splice method into class") = forAll { (name: TypeName, method: DefDef) => + property("unquote method into class") = forAll { (name: TypeName, method: DefDef) => q"class $name { $method }" ≈ classWith(name, body = List(method)) } - property("splice members into class") = forAll { (name: TypeName, defs: List[DefDef], extra: DefDef) => + property("unquote members into class") = forAll { (name: TypeName, defs: List[DefDef], extra: DefDef) => q"""class $name { ..$defs $extra }""" ≈ classWith(name, body = defs :+ extra) } - property("splice type name into class parents") = forAll { (name: TypeName, parent: TypeName) => + property("unquote type name into class parents") = forAll { (name: TypeName, parent: TypeName) => q"class $name extends $parent" ≈ classWith(name, parents = List(Ident(parent))) } @@ -84,27 +84,27 @@ trait ClassConstruction { self: QuasiquoteProperties => } trait TraitConstruction { self: QuasiquoteProperties => - property("splice name into trait def") = test { + property("unquote name into trait def") = test { val Foo = TypeName("Foo") assert(q"trait $Foo" ≈ q"trait Foo") } - property("splice type params into trait def") = test { + property("unquote type params into trait def") = test { val tparams = q"type A" :: q"type B" :: Nil assert(q"trait Foo[..$tparams]" ≈ q"trait Foo[A, B]") } - property("splice defs into trait body") = test { + property("unquote defs into trait body") = test { val body = q"def foo" :: q"val bar: Baz" :: Nil assert(q"trait Foo { ..$body }" ≈ q"trait Foo { def foo; val bar: Baz }") } - property("splice parents into trait") = test { + property("unquote parents into trait") = test { val parents = tq"A" :: tq"B" :: Nil assert(q"trait Foo extends ..$parents" ≈ q"trait Foo extends A with B") } - property("splice early valdef into trait") = test { + property("unquote early valdef into trait") = test { val x = q"val x: Int = 1" assertEqAst(q"trait T extends { $x } with Any", "trait T extends { val x: Int = 1} with Any") } @@ -113,7 +113,7 @@ trait TraitConstruction { self: QuasiquoteProperties => assertEqAst(q"trait T extends { val x: Int = 1 } with Any", "trait T extends { val x: Int = 1 } with Any") } - property("splice defs into early block") = test { + property("unquote defs into early block") = test { val defs = q"val x: Int = 0" :: q"type Foo = Bar" :: Nil assert(q"trait T extends { ..$defs } with Bippy" ≈ q"trait T extends { val x: Int = 0; type Foo = Bar} with Bippy") @@ -126,37 +126,37 @@ trait TraitConstruction { self: QuasiquoteProperties => } trait TypeDefConstruction { self: QuasiquoteProperties => - property("splice type name into typedef") = forAll { (name1: TypeName, name2: TypeName) => + property("unquote type name into typedef") = forAll { (name1: TypeName, name2: TypeName) => q"type $name1 = $name2" ≈ TypeDef(Modifiers(), name1, List(), Ident(name2)) } - property("splice type names into type bounds") = forAll { (T1: TypeName, T2: TypeName, T3: TypeName) => + property("unquote type names into type bounds") = forAll { (T1: TypeName, T2: TypeName, T3: TypeName) => q"type $T1 >: $T2 <: $T3" ≈ TypeDef( Modifiers(DEFERRED), T1, List(), TypeBoundsTree(Ident(T2), Ident(T3))) } - property("splice trees names into type bounds") = forAll { (T: TypeName, t1: Tree, t2: Tree) => + property("unquote trees names into type bounds") = forAll { (T: TypeName, t1: Tree, t2: Tree) => q"type $T >: $t1 <: $t2" ≈ TypeDef( Modifiers(DEFERRED), T, List(), TypeBoundsTree(t1, t2)) } - property("splice tparams into typedef (1)") = forAll { (T: TypeName, targs: List[TypeDef], t: Tree) => + property("unquote tparams into typedef (1)") = forAll { (T: TypeName, targs: List[TypeDef], t: Tree) => q"type $T[..$targs] = $t" ≈ TypeDef(Modifiers(), T, targs, t) } - property("splice tparams into typedef (2)") = forAll { (T: TypeName, targs1: List[TypeDef], targs2: List[TypeDef], t: Tree) => + property("unquote tparams into typedef (2)") = forAll { (T: TypeName, targs1: List[TypeDef], targs2: List[TypeDef], t: Tree) => q"type $T[..$targs1, ..$targs2] = $t" ≈ TypeDef(Modifiers(), T, targs1 ++ targs2, t) } - property("splice tparams into typedef (3)") = forAll { (T: TypeName, targ: TypeDef, targs: List[TypeDef], t: Tree) => + property("unquote tparams into typedef (3)") = forAll { (T: TypeName, targ: TypeDef, targs: List[TypeDef], t: Tree) => q"type $T[$targ, ..$targs] = $t" ≈ TypeDef(Modifiers(), T, targ :: targs, t) } - property("splice typename into typedef with default bounds") = forAll { (T1: TypeName, T2: TypeName, t: Tree) => + property("unquote typename into typedef with default bounds") = forAll { (T1: TypeName, T2: TypeName, t: Tree) => q"type $T1[$T2 >: Any <: Nothing] = $t" ≈ TypeDef( Modifiers(), T1, @@ -169,7 +169,7 @@ trait TypeDefConstruction { self: QuasiquoteProperties => t) } - property("splice type names into compound type tree") = forAll { (T: TypeName, A: TypeName, B: TypeName) => + property("unquote type names into compound type tree") = forAll { (T: TypeName, A: TypeName, B: TypeName) => q"type $T = $A with $B" ≈ TypeDef( Modifiers(), T, List(), @@ -177,7 +177,7 @@ trait TypeDefConstruction { self: QuasiquoteProperties => Template(List(Ident(A), Ident(B)), ValDef(Modifiers(PRIVATE), termNames.WILDCARD, TypeTree(), EmptyTree), List()))) } - property("splice trees into existential type tree") = forAll { + property("unquote trees into existential type tree") = forAll { (T1: TypeName, T2: TypeName, X: TypeName, Lo: TypeName, Hi: TypeName) => q"type $T1 = $T2[$X] forSome { type $X >: $Lo <: $Hi }" ≈ @@ -189,11 +189,11 @@ trait TypeDefConstruction { self: QuasiquoteProperties => TypeDef(Modifiers(DEFERRED), X, List(), TypeBoundsTree(Ident(Lo), Ident(Hi)))))) } - property("splice tree into singleton type tree") = forAll { (name: TypeName, t: Tree) => + property("unquote tree into singleton type tree") = forAll { (name: TypeName, t: Tree) => q"type $name = $t.type" ≈ q"type $name = ${SingletonTypeTree(t)}" } - property("splice into applied type tree") = forAll { (T1: TypeName, T2: TypeName, args: List[Tree]) => + property("unquote into applied type tree") = forAll { (T1: TypeName, T2: TypeName, args: List[Tree]) => q"type $T1 = $T2[..$args]" ≈ TypeDef(Modifiers(), T1, List(), if(args.nonEmpty) AppliedTypeTree(Ident(T2), args) else Ident(T2)) @@ -201,11 +201,11 @@ trait TypeDefConstruction { self: QuasiquoteProperties => } trait ValDefConstruction { self: QuasiquoteProperties => - property("splice into val") = forAll { (name: TermName, tpt: Tree, rhs: Tree) => + property("unquote into val") = forAll { (name: TermName, tpt: Tree, rhs: Tree) => q"val $name: $tpt = $rhs" ≈ ValDef(Modifiers(), name, tpt, rhs) } - property("splice into var") = forAll { (name: TermName, tpt: Tree, rhs: Tree) => + property("unquote into var") = forAll { (name: TermName, tpt: Tree, rhs: Tree) => q"var $name: $tpt = $rhs" ≈ ValDef(Modifiers(MUTABLE), name, tpt, rhs) } @@ -216,28 +216,28 @@ trait ValDefConstruction { self: QuasiquoteProperties => } trait PatDefConstruction { self: QuasiquoteProperties => - property("splice pattern into pat def") = test { + property("unquote pattern into pat def") = test { val pat = pq"(a, b)" assertEqAst(q"val $pat = (1, 2)", "val (a, b) = (1, 2)") val tpt = tq"(Int, Int)" assertEqAst(q"val $pat: $tpt = (1, 2)", "val (a, b): (Int, Int) = (1, 2)") } - property("splice pattern into pat def within other pattern (1)") = test { + property("unquote pattern into pat def within other pattern (1)") = test { val pat = pq"(a, b)" assertEqAst(q"val Foo($pat) = Foo((1, 2))", "val Foo((a, b)) = Foo((1, 2))") val tpt = tq"Foo" assertEqAst(q"val Foo($pat): $tpt = Foo((1, 2))", "val Foo((a, b)): Foo = Foo((1, 2))") } - property("splice patterns into pat def within other pattern (2)") = test { + property("unquote patterns into pat def within other pattern (2)") = test { val pat1 = pq"(a, b)"; val pat2 = pq"(c, d)" assertEqAst(q"val ($pat1, $pat2) = ((1, 2), (3, 4))", "val ((a, b), (c, d)) = ((1, 2), (3, 4))") val tpt = tq"((Int, Int), (Int, Int))" assertEqAst(q"val ($pat1, $pat2): $tpt = ((1, 2), (3, 4))", "val ((a, b), (c, d)): ((Int, Int), (Int, Int)) = ((1, 2), (3, 4))") } - property("splice pattern without free vars into pat def") = test { + property("unquote pattern without free vars into pat def") = test { val pat = pq"((1, 2), 3)" assertEqAst(q"val $pat = ((1, 2), 3)", "{ val ((1, 2), 3) = ((1, 2), 3) }") val tpt = tq"((Int, Int), Int)" @@ -245,19 +245,19 @@ trait PatDefConstruction { self: QuasiquoteProperties => } // won't result into pattern match due to SI-8211 - property("splice typed pat into pat def") = test { + property("unquote typed pat into pat def") = test { val pat = pq"x: Int" assertEqAst(q"val $pat = 2", "{ val x: Int = 2 }") } } trait MethodConstruction { self: QuasiquoteProperties => - property("splice paramss into defdef") = test { + property("unquote paramss into defdef") = test { val paramss = List(q"val x: Int") :: List(q"val y: Int = 1") :: Nil assert(q"def foo(...$paramss)" ≈ parse("def foo(x: Int)(y: Int = 1)")) } - property("splice tparams into defdef") = test { + property("unquote tparams into defdef") = test { val tparams = q"type A" :: q"type B <: Bippy" :: Nil assert(q"def foo[..$tparams]" ≈ parse("def foo[A, B <: Bippy]")) } @@ -270,84 +270,84 @@ trait MethodConstruction { self: QuasiquoteProperties => assert(tree1.mods.annotations ≈ tree2.mods.annotations, s"${tree1.mods.annotations} =/= ${tree2.mods.annotations}") - property("splice type name into annotation") = test { + property("unquote type name into annotation") = test { val name = TypeName("annot") assertSameAnnots(q"@$name def foo", List(q"new $name")) } - property("splice ident into annotation") = test { + property("unquote ident into annotation") = test { val name = TypeName("annot") val ident = Ident(name) assertSameAnnots(q"@$ident def foo", List(q"new $name")) } - property("splice idents into annotation") = test { + property("unquote idents into annotation") = test { val idents = List(Ident(TypeName("annot1")), Ident(TypeName("annot2"))) assertSameAnnots(q"@..$idents def foo", idents.map { ident => Apply(Select(New(ident), termNames.CONSTRUCTOR), List()) }) } - property("splice constructor calls into annotation") = test { + property("unquote constructor calls into annotation") = test { val ctorcalls = List(q"new a1", q"new a2") assertSameAnnots(q"@..$ctorcalls def foo", ctorcalls) } - property("splice multiple annotations (1)") = test { + property("unquote multiple annotations (1)") = test { 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 { + property("unquote multiple annotations (2)") = test { 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 { + property("unquote annotations with arguments (1)") = test { val a = q"new a(x)" assertSameAnnots(q"@$a def foo", q"@a(x) def foo") } - property("splice annotations with arguments (2)") = test { + property("unquote annotations with arguments (2)") = test { val a = TypeName("a") assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo") } - property("splice annotations with arguments (3") = test { + property("unquote annotations with arguments (3") = test { val a = Ident(TypeName("a")) assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo") } - property("splice improper tree into annot") = test { + property("unquote improper tree into annot") = test { val t = tq"Foo[Baz]" assertThrows[IllegalArgumentException] { q"@$t def foo" } } - property("can't splice annotations with arguments specificed twice") = test { + property("can't unquote annotations with arguments specificed twice") = test { val a = q"new a(x)" assertThrows[IllegalArgumentException] { q"@$a(y) def foo" } } - property("splice annotation with targs") = test { + property("unquote annotation with targs") = test { val a = q"new Foo[A, B]" assertEqAst(q"@$a def foo", "@Foo[A,B] def foo") } - property("splice annotation with multiple argument lists") = test { + property("unquote annotation with multiple argument lists") = test { val a = q"new Foo(a)(b)" assertEqAst(q"@$a def foo", "@Foo(a)(b) def foo") } } trait PackageConstruction { self: QuasiquoteProperties => - property("splice select into package name") = test { + property("unquote select into package name") = test { val name = q"foo.bar" assertEqAst(q"package $name { }", "package foo.bar { }") } @@ -357,12 +357,12 @@ trait PackageConstruction { self: QuasiquoteProperties => assertEqAst(q"package $name { }", "package bippy { }") } - property("splice members into package body") = test { + property("unquote members into package body") = test { val members = q"class C" :: q"object O" :: Nil assertEqAst(q"package foo { ..$members }", "package foo { class C; object O }") } - property("splice illegal members into package body") = test { + property("unquote illegal members into package body") = test { val f = q"def f" assertThrows[IllegalArgumentException] { q"package foo { $f }" } val v = q"val v = 0" @@ -371,24 +371,24 @@ trait PackageConstruction { self: QuasiquoteProperties => assertThrows[IllegalArgumentException] { q"package foo { $expr }" } } - property("splice name into package object") = test { + property("unquote name into package object") = test { val foo = TermName("foo") assertEqAst(q"package object $foo", "package object foo") } - property("splice parents into package object") = test { + property("unquote parents into package object") = test { val parents = tq"a" :: tq"b" :: Nil assertEqAst(q"package object foo extends ..$parents", "package object foo extends a with b") } - property("splice members into package object") = test { + property("unquote members into package object") = test { val members = q"def foo" :: q"val x = 1" :: Nil assertEqAst(q"package object foo { ..$members }", "package object foo { def foo; val x = 1 }") } - property("splice early def into package object") = test { + property("unquote early def into package object") = test { val edefs = q"val x = 1" :: q"type I = Int" :: Nil assertEqAst(q"package object foo extends { ..$edefs } with Any", "package object foo extends { val x = 1; type I = Int } with Any") diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala index 512b81c0e6..996ac65b36 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala @@ -259,7 +259,7 @@ trait ImportDeconstruction { self: QuasiquoteProperties => val pq"_" = right } - property("splice names into import selector") = forAll { + property("unquote names into import selector") = forAll { (expr: Tree, plain: TermName, oldname: TermName, newname: TermName, discard: TermName) => val Import(expr1, List( diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala index 1ba9bba381..d61119d98f 100644 --- a/test/files/scalacheck/quasiquotes/ErrorProps.scala +++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala @@ -1,21 +1,21 @@ import org.scalacheck._, Prop._, Gen._, Arbitrary._ object ErrorProps extends QuasiquoteProperties("errors") { - property("can't extract two .. cardinalities in a row") = fails( + property("can't extract two .. rankinalities in a row") = fails( "Can't extract with .. here", """ val xs = List(q"x1", q"x2") val q"f(..$xs1, ..$xs2)" = xs """) - property("can't splice with given cardinality") = fails( - "Can't splice List[reflect.runtime.universe.Ident], consider using ..", + property("can't unquote with given rank") = fails( + "Can't unquote List[reflect.runtime.universe.Ident], consider using ..", """ val xs = List(q"x", q"x") q"$xs" """) - property("splice typename into typedef with default bounds") = fails( + property("unquote typename into typedef with default bounds") = fails( "reflect.runtime.universe.Name expected but reflect.runtime.universe.TypeDef found", """ val T1 = TypeName("T1") @@ -25,8 +25,8 @@ object ErrorProps extends QuasiquoteProperties("errors") { TypeDef(Modifiers(), T1, List(T2), t) """) - property("can't splice annotations with ... cardinality") = fails( - "Can't splice with ... here", + property("can't unquote annotations with ... rank") = fails( + "Can't unquote with ... here", """ val annots = List(List(q"Foo")) q"@...$annots def foo" @@ -39,15 +39,15 @@ object ErrorProps extends QuasiquoteProperties("errors") { StringContext(s).q() """) - property("don't know how to splice inside of strings") = fails( - "Don't know how to splice here", + property("don't know how to unquote inside of strings") = fails( + "Don't know how to unquote here", """ val x: Tree = EmptyTree StringContext("\"", "\"").q(x) """) property("non-liftable type ..") = fails( - "Can't splice List[StringBuilder] with .., consider omitting the dots or providing an implicit instance of Liftable[StringBuilder]", + "Can't unquote List[StringBuilder] with .., consider omitting the dots or providing an implicit instance of Liftable[StringBuilder]", """ import java.lang.StringBuilder val bazs = List(new StringBuilder) @@ -55,38 +55,38 @@ object ErrorProps extends QuasiquoteProperties("errors") { """) property("non-liftable type ...") = fails( - "Can't splice List[List[StringBuilder]] with .., consider using ... or providing an implicit instance of Liftable[StringBuilder]", + "Can't unquote List[List[StringBuilder]] with .., consider using ... or providing an implicit instance of Liftable[StringBuilder]", """ import java.lang.StringBuilder val bazs = List(List(new StringBuilder)) q"f(..$bazs)" """) - property("use .. card or provide liftable") = fails( - "Can't splice List[StringBuilder], consider using .. or providing an implicit instance of Liftable[List[StringBuilder]]", + property("use .. rank or provide liftable") = fails( + "Can't unquote List[StringBuilder], consider using .. or providing an implicit instance of Liftable[List[StringBuilder]]", """ import java.lang.StringBuilder val lst: List[StringBuilder] = Nil q"f($lst)" """) - property("use ... card or provide liftable") = fails( - "Can't splice List[List[reflect.runtime.universe.Ident]], consider using ...", + property("use ... rank or provide liftable") = fails( + "Can't unquote List[List[reflect.runtime.universe.Ident]], consider using ...", """ val xs = List(List(q"x", q"x")) q"$xs" """) property("not liftable or natively supported") = fails( - "Can't splice StringBuilder, consider providing an implicit instance of Liftable[StringBuilder]", + "Can't unquote StringBuilder, consider providing an implicit instance of Liftable[StringBuilder]", """ import java.lang.StringBuilder val sb = new StringBuilder q"f($sb)" """) - property("can't splice with ... card here") = fails( - "Can't splice with ... here", + property("can't unquote with ... rank here") = fails( + "Can't unquote with ... here", """ val lst: List[List[Tree]] = Nil; val t = EmptyTree q"f(...$lst, $t)" @@ -106,29 +106,29 @@ object ErrorProps extends QuasiquoteProperties("errors") { q"$t def foo" """) - property("cant splice flags together with mods") = fails( - "Can't splice flags together with modifiers, consider merging flags into modifiers", + property("cant unquote flags together with mods") = fails( + "Can't unquote flags together with modifiers, consider merging flags into modifiers", """ val f = Flag.IMPLICIT; val m = NoMods q"$f $m def foo" """) - property("can't splice mods with annots") = fails( - "Can't splice modifiers together with annotations, consider merging annotations into modifiers", + property("can't unquote mods with annots") = fails( + "Can't unquote modifiers together with annotations, consider merging annotations into modifiers", """ val m = NoMods q"@annot $m def foo" """) - property("can't splice modifiers with inline flags") = fails( - "Can't splice modifiers together with flags, consider merging flags into modifiers", + property("can't unquote modifiers with inline flags") = fails( + "Can't unquote modifiers together with flags, consider merging flags into modifiers", """ val m = NoMods q"$m implicit def foo" """) - property("can't splice multiple mods") = fails( - "Can't splice multiple modifiers, consider merging them into a single modifiers instance", + property("can't unquote multiple mods") = fails( + "Can't unquote multiple modifiers, consider merging them into a single modifiers instance", """ val m1 = NoMods; val m2 = NoMods q"$m1 $m2 def foo" @@ -146,15 +146,15 @@ object ErrorProps extends QuasiquoteProperties("errors") { val q"$m1 $m2 def foo" = EmptyTree """) - property("can't splice values of Null") = fails( - "Can't splice Null, bottom type values often indicate programmer mistake", + property("can't unquote values of Null") = fails( + "Can't unquote Null, bottom type values often indicate programmer mistake", """ val n = null q"$n" """) - property("can't splice values of Nothing") = fails( - "Can't splice Nothing, bottom type values often indicate programmer mistake", + property("can't unquote values of Nothing") = fails( + "Can't unquote Nothing, bottom type values often indicate programmer mistake", """ def n = ??? q"$n" diff --git a/test/files/scalacheck/quasiquotes/LiftableProps.scala b/test/files/scalacheck/quasiquotes/LiftableProps.scala index 20cfcbe139..5d0eeb53c6 100644 --- a/test/files/scalacheck/quasiquotes/LiftableProps.scala +++ b/test/files/scalacheck/quasiquotes/LiftableProps.scala @@ -2,62 +2,62 @@ import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ object LiftableProps extends QuasiquoteProperties("liftable") { - property("splice byte") = test { + property("unquote byte") = test { val c: Byte = 0 assert(q"$c" ≈ Literal(Constant(c))) assert(q"${0: Byte}" ≈ Literal(Constant(c))) } - property("splice short") = test { + property("unquote short") = test { val c: Short = 0 assert(q"$c" ≈ Literal(Constant(c))) assert(q"${0: Short}" ≈ Literal(Constant(c))) } - property("splice char") = test { + property("unquote char") = test { val c: Char = 'c' assert(q"$c" ≈ Literal(Constant(c))) assert(q"${'c'}" ≈ Literal(Constant(c))) } - property("splice int") = test { + property("unquote int") = test { val c: Int = 0 assert(q"$c" ≈ Literal(Constant(c))) assert(q"${0: Int}" ≈ Literal(Constant(c))) } - property("splice long") = test { + property("unquote long") = test { val c: Long = 0 assert(q"$c" ≈ Literal(Constant(c))) assert(q"${0: Long}" ≈ Literal(Constant(c))) } - property("splice float") = test { + property("unquote float") = test { val c: Float = 0.0f assert(q"$c" ≈ Literal(Constant(c))) assert(q"${0.0f: Float}" ≈ Literal(Constant(c))) } - property("splice double") = test { + property("unquote double") = test { val c: Double = 0.0 assert(q"$c" ≈ Literal(Constant(c))) assert(q"${0.0: Double}" ≈ Literal(Constant(c))) } - property("splice boolean") = test { + property("unquote boolean") = test { val c: Boolean = false assert(q"$c" ≈ Literal(Constant(c))) assert(q"${true}" ≈ Literal(Constant(true))) assert(q"${false}" ≈ Literal(Constant(false))) } - property("splice string") = test { + property("unquote string") = test { val c: String = "s" assert(q"$c" ≈ Literal(Constant(c))) assert(q"${"s"}" ≈ Literal(Constant(c))) } - property("splice unit") = test { + property("unquote unit") = test { val c: Unit = () assert(q"$c" ≈ Literal(Constant(c))) assert(q"${()}" ≈ Literal(Constant(c))) diff --git a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala index fffaf1b363..7ed95fa984 100644 --- a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala @@ -2,35 +2,35 @@ import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ object PatternConstructionProps extends QuasiquoteProperties("pattern construction") { - property("splice bind") = forAll { (bind: Bind) => + property("unquote bind") = forAll { (bind: Bind) => pq"$bind" ≈ bind } - property("splice name into bind") = forAll { (name: TermName) => + property("unquote name into bind") = forAll { (name: TermName) => pq"$name" ≈ Bind(name, Ident(termNames.WILDCARD)) } - property("splice name and tree into bind") = forAll { (name: TermName, tree: Tree) => + property("unquote name and tree into bind") = forAll { (name: TermName, tree: Tree) => pq"$name @ $tree" ≈ Bind(name, tree) } - property("splice type name into typed") = forAll { (name: TypeName) => + property("unquote type name into typed") = forAll { (name: TypeName) => pq"_ : $name" ≈ Typed(Ident(termNames.WILDCARD), Ident(name)) } - property("splice tree into typed") = forAll { (typ: Tree) => + property("unquote tree into typed") = forAll { (typ: Tree) => pq"_ : $typ" ≈ Typed(Ident(termNames.WILDCARD), typ) } - property("splice into apply") = forAll { (pat: Tree, subpat: Tree) => + property("unquote into apply") = forAll { (pat: Tree, subpat: Tree) => pq"$pat($subpat)" ≈ Apply(pat, List(subpat)) } - property("splice into casedef") = forAll { (pat: Tree, cond: Tree, body: Tree) => + property("unquote into casedef") = forAll { (pat: Tree, cond: Tree, body: Tree) => cq"$pat if $cond => $body" ≈ CaseDef(pat, cond, body) } - property("splice into alternative") = forAll { (first: Tree, rest: List[Tree]) => + property("unquote into alternative") = forAll { (first: Tree, rest: List[Tree]) => pq"$first | ..$rest" ≈ Alternative(first :: rest) } } diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index 4dbf746cfe..10ce1604b1 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -2,41 +2,41 @@ import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._ object TermConstructionProps extends QuasiquoteProperties("term construction") { - property("splice single tree return tree itself") = forAll { (t: Tree) => + property("unquote single tree return tree itself") = forAll { (t: Tree) => q"$t" ≈ t } - property("splice trees into if expression") = forAll { (t1: Tree, t2: Tree, t3: Tree) => + property("unquote trees into if expression") = forAll { (t1: Tree, t2: Tree, t3: Tree) => q"if($t1) $t2 else $t3" ≈ If(t1, t2, t3) } - property("splice trees into ascriptiopn") = forAll { (t1: Tree, t2: Tree) => + property("unquote trees into ascriptiopn") = forAll { (t1: Tree, t2: Tree) => q"$t1 : $t2" ≈ Typed(t1, t2) } - property("splice trees into apply") = forAll { (t1: Tree, t2: Tree, t3: Tree) => + property("unquote trees into apply") = forAll { (t1: Tree, t2: Tree, t3: Tree) => q"$t1($t2, $t3)" ≈ Apply(t1, List(t2, t3)) } - property("splice trees with .. cardinality into apply") = forAll { (ts: List[Tree]) => + property("unquote trees with .. rank into apply") = forAll { (ts: List[Tree]) => q"f(..$ts)" ≈ Apply(q"f", ts) } - property("splice iterable into apply") = forAll { (trees: List[Tree]) => + property("unquote iterable into apply") = forAll { (trees: List[Tree]) => val itrees: Iterable[Tree] = trees q"f(..$itrees)" ≈ Apply(q"f", trees) } - property("splice trees with ... cardinality into apply") = forAll { (ts1: List[Tree], ts2: List[Tree]) => + property("unquote trees with ... rank into apply") = forAll { (ts1: List[Tree], ts2: List[Tree]) => val argss = List(ts1, ts2) q"f(...$argss)" ≈ Apply(Apply(q"f", ts1), ts2) } - property("splice term name into assign") = forAll { (name: TermName, t: Tree) => + property("unquote term name into assign") = forAll { (name: TermName, t: Tree) => q"$name = $t" ≈ Assign(Ident(name), t) } - property("splice trees into block") = forAll { (t1: Tree, t2: Tree, t3: Tree) => + property("unquote trees into block") = forAll { (t1: Tree, t2: Tree, t3: Tree) => blockInvariant(q"""{ $t1 $t2 @@ -45,25 +45,25 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { } - property("splice tree into new") = forAll { (tree: Tree) => + property("unquote tree into new") = forAll { (tree: Tree) => q"new $tree" ≈ Apply(Select(New(tree), termNames.CONSTRUCTOR), List()) } - property("splice tree into return") = forAll { (tree: Tree) => + property("unquote tree into return") = forAll { (tree: Tree) => q"return $tree" ≈ Return(tree) } - property("splice a list of arguments") = forAll { (fun: Tree, args: List[Tree]) => + property("unquote a list of arguments") = forAll { (fun: Tree, args: List[Tree]) => q"$fun(..$args)" ≈ Apply(fun, args) } - property("splice list and non-list fun arguments") = forAll { (fun: Tree, arg1: Tree, arg2: Tree, args: List[Tree]) => + property("unquote list and non-list fun arguments") = forAll { (fun: Tree, arg1: Tree, arg2: Tree, args: List[Tree]) => q"$fun(..$args, $arg1, $arg2)" ≈ Apply(fun, args ++ List(arg1) ++ List(arg2)) && q"$fun($arg1, ..$args, $arg2)" ≈ Apply(fun, List(arg1) ++ args ++ List(arg2)) && q"$fun($arg1, $arg2, ..$args)" ≈ Apply(fun, List(arg1) ++ List(arg2) ++ args) } - property("splice into new") = forAll { (name: TypeName, body: List[Tree]) => + property("unquote into new") = forAll { (name: TypeName, body: List[Tree]) => q"new $name { ..$body }" ≈ q"""{ final class $$anon extends $name { @@ -73,29 +73,29 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { }""" } - property("splice type name into this") = forAll { (T: TypeName) => + property("unquote type name into this") = forAll { (T: TypeName) => q"$T.this" ≈ This(T) } - property("splice tree into throw") = forAll { (t: Tree) => + property("unquote tree into throw") = forAll { (t: Tree) => q"throw $t" ≈ Throw(t) } - property("splice trees into type apply") = forAll { (fun: TreeIsTerm, types: List[Tree]) => + property("unquote trees into type apply") = forAll { (fun: TreeIsTerm, types: List[Tree]) => q"$fun[..$types]" ≈ (if (types.nonEmpty) TypeApply(fun, types) else fun) } - property("splice trees into while loop") = forAll { (cond: Tree, body: Tree) => + property("unquote 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 } - property("splice trees into do while loop") = forAll { (cond: Tree, body: Tree) => + property("unquote trees into do while loop") = forAll { (cond: Tree, body: Tree) => val LabelDef(_, List(), Block(List(body1), If(cond1, Apply(_, List()), Literal(Constant(()))))) = q"do $body while($cond)" body1 ≈ body && cond1 ≈ cond } - property("splice trees into alternative") = forAll { (c: Tree, A: Tree, B: Tree) => + property("unquote trees into alternative") = forAll { (c: Tree, A: Tree, B: Tree) => q"$c match { case $A | $B => }" ≈ Match(c, List( CaseDef(Alternative(List(A, B)), EmptyTree, Literal(Constant(()))))) @@ -109,24 +109,24 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { case init :+ last => Block(init, last) }) - property("splice list of trees into block (1)") = forAll { (trees: List[Tree]) => + property("unquote list of trees into block (1)") = forAll { (trees: List[Tree]) => blockInvariant(q"{ ..$trees }", trees) } - property("splice list of trees into block (2)") = forAll { (trees1: List[Tree], trees2: List[Tree]) => + property("unquote list of trees into block (2)") = forAll { (trees1: List[Tree], trees2: List[Tree]) => blockInvariant(q"{ ..$trees1 ; ..$trees2 }", trees1 ++ trees2) } - property("splice list of trees into block (3)") = forAll { (trees: List[Tree], tree: Tree) => + property("unquote list of trees into block (3)") = forAll { (trees: List[Tree], tree: Tree) => blockInvariant(q"{ ..$trees; $tree }", trees :+ tree) } - property("splice term into brackets") = test { + property("unquote term into brackets") = test { val a = q"a" assert(q"($a)" ≈ a) } - property("splice terms into tuple") = test { + property("unquote terms into tuple") = test { val a1 = q"a1" val a2 = q"a2" val as = List(a1, a2) @@ -134,12 +134,12 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { assert(q"(a0, ..$as)" ≈ q"scala.Tuple3(a0, $a1, $a2)") } - property("splice empty list into tuple") = test { + property("unquote empty list into tuple") = test { val empty = List[Tree]() assert(q"(..$empty)" ≈ q"()") } - property("splice single element list into tuple") = test { + property("unquote single element list into tuple") = test { val xs = q"x" :: Nil assert(q"(..$xs)" ≈ xs.head) } @@ -196,7 +196,7 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { assert(q"f(${if (true) q"a" else q"b"})" ≈ q"f(a)") } - property("splice iterable of non-parametric type") = test { + property("unquote iterable of non-parametric type") = test { object O extends Iterable[Tree] { def iterator = List(q"foo").iterator } q"f(..$O)" } diff --git a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala index 07875af326..27ad4c50e9 100644 --- a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala @@ -6,7 +6,7 @@ object TypeConstructionProps extends QuasiquoteProperties("type construction") tq"x" ≈ Ident(TypeName("x")) } - property("splice type names into AppliedTypeTree") = forAll { (name1: TypeName, name2: TypeName) => + property("unquote type names into AppliedTypeTree") = forAll { (name1: TypeName, name2: TypeName) => tq"$name1[$name2]" ≈ AppliedTypeTree(Ident(name1), List(Ident(name2))) } diff --git a/test/files/scalacheck/quasiquotes/UnliftableProps.scala b/test/files/scalacheck/quasiquotes/UnliftableProps.scala index 4e996c90d7..1d7629aa29 100644 --- a/test/files/scalacheck/quasiquotes/UnliftableProps.scala +++ b/test/files/scalacheck/quasiquotes/UnliftableProps.scala @@ -99,13 +99,13 @@ object UnliftableProps extends QuasiquoteProperties("unliftable") { assert(l5 == orig2) } - property("don't unlift non-tree splicee (1)") = test { + property("don't unlift non-tree unquotee (1)") = test { val q"${a: TermName}.${b: TermName}" = q"a.b" assert(a == TermName("a")) assert(b == TermName("b")) } - property("don't unlift non-tree splicee (2)") = test { + property("don't unlift non-tree unquotee (2)") = test { val q"${mods: Modifiers} def foo" = q"def foo" assert(mods == Modifiers(DEFERRED)) } |