Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SI-8387 don't match new as a function application

  • Loading branch information...
commit f10d7541c9c2ddbb3a9cd1a1db800a2fef5a9082 1 parent 2fea950
@densh densh authored
View
13 src/reflect/scala/reflect/internal/ReificationSupport.scala
@@ -241,10 +241,15 @@ trait ReificationSupport { self: SymbolTable =>
case UnApply(treeInfo.Unapplied(Select(fun, nme.unapply)), pats) =>
Some((fun, pats :: Nil))
case treeInfo.Applied(fun, targs, argss) =>
- val callee =
- if (fun.isTerm) SyntacticTypeApplied(fun, targs)
- else SyntacticAppliedType(fun, targs)
- Some((callee, argss))
+ fun match {
+ case Select(_: New, nme.CONSTRUCTOR) =>
+ Some((tree, Nil))
+ case _ =>
+ val callee =
+ if (fun.isTerm) SyntacticTypeApplied(fun, targs)
+ else SyntacticAppliedType(fun, targs)
+ Some((callee, argss))
+ }
}
}
View
7 test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -239,4 +239,11 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
val q"new ..$parents" = q"new Foo with Bar"
assert(parents ≈ List(tq"Foo", tq"Bar"))
}
+
+ property("SI-8387 new is not an application") = test {
+ val `new` = q"new F(x)"
+ val q"$f(...$argss)" = `new`
+ assert(f ≈ `new`)
+ assert(argss.isEmpty)
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.