unused value of type Props with @react macro
steinybot opened this issue · 0 comments
steinybot commented
Something like this:
@react
class MyComponent extends Component {
override type Props = String
override type State = String
override def initialState: String = props
override def render(): ReactElement = state
}
Will fail to compile with:
[error] /Users/jason/src/bug-reports/src/main/scala/Main.scala:8:2: unused value of type MyComponent.Props (add `: Unit` to discard silently)
[error] @react
[error] ^
[error] one error found
When using:
scalacOptions ++= Seq(
"-Wnonunit-statement",
"-Xfatal-warnings"
)
My guess is that it is from this:
_root_.slinky.core.annotations.react.bump({
null.asInstanceOf[Props];
null.asInstanceOf[State];
null.asInstanceOf[Snapshot];
()
});
What is this for? Can we get rid of it? Or at the very least add the : Unit
ascription.
Reproduction: https://github.com/steinybot/bug-reports/tree/slinky/unused-value-props