From 9cd4c0d05fd05b66d40e40b4bc9ab46da2bf7ccb Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 7 Mar 2021 03:17:42 -0500 Subject: [PATCH] Work around "a pure expression does nothing" warning, take 3 Fixes https://github.com/sbt/sbt/issues/6161 Ref https://github.com/scala/bug/issues/12112 This uses the configurable warning backported to Scala 2.12. --- .../src/main/scala/sbt/internal/util/appmacro/Instance.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-macros/src/main/scala/sbt/internal/util/appmacro/Instance.scala b/core-macros/src/main/scala/sbt/internal/util/appmacro/Instance.scala index f077ed5ab..c9aaa691c 100644 --- a/core-macros/src/main/scala/sbt/internal/util/appmacro/Instance.scala +++ b/core-macros/src/main/scala/sbt/internal/util/appmacro/Instance.scala @@ -201,7 +201,8 @@ object Instance { val tx = util.transformWrappers(tree, (n, tpe, t, replace) => sub(n, tpe, t, replace)) // resetting attributes must be: a) local b) done here and not wider or else there are obscure errors val tr = makeApp(inner(tx)) - c.Expr[i.M[N[T]]](tr) + val noWarn = q"""($tr: @scala.annotation.nowarn("cat=other-pure-statement"))""" + c.Expr[i.M[N[T]]](noWarn) } import Types._