Skip to content

Commit

Permalink
Try to workaround "a pure expression does nothing" warning
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Oct 17, 2020
1 parent 3266d77 commit 2290601
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ object Instance {
qual.foreach(checkQual)
val vd = util.freshValDef(tpe, qual.pos, functionSym)
inputs ::= new Input(tpe, qual, vd)
util.refVal(selection, vd)
// try to workaround https://github.com/scala/bug/issues/12112 by calling Predef.identity(...)
q"scala.Predef.identity[$tpe](${vd.name}: $tpe)"
}
def sub(name: String, tpe: Type, qual: Tree, replace: Tree): Converted[c.type] = {
val tag = c.WeakTypeTag[T](tpe)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package pkgtest

import sbt._, Keys._

// https://github.com/scala/bug/issues/12112
object PureExpressionPlugin extends AutoPlugin {
lazy val testPureExpression = taskKey[Unit]("")
override def projectSettings: Seq[Setting[_]] = {
testPureExpression := {
updateFull.value
(Compile / compile).value
(Test / test).value
}
}
}
1 change: 1 addition & 0 deletions sbt/src/sbt-test/project/setting-macro/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Compile / scalacOptions += "-Xfatal-warnings"

0 comments on commit 2290601

Please sign in to comment.