Adaptation of argument list by inserting () has been deprecated

后端 未结 3 760
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-14 06:04

I\'m just in the process of upgrading from Scala 2.10.x to 2.11.2 and I\'m receiving the following warning with the following code:

  override def validateKe         


        
3条回答
  •  遥遥无期
    2020-12-14 06:36

    My explanation is that since the Right.apply is polymorphic it can take all kind of parameters, doing Right() means passing in a Unit and the compiler simply advise you that maybe that's not what you want, he doesn't know that this is what you actually want.

    If you see your deprecate message it states:

    ... after adaptation: Right((): Unit)

    Which means that the compiler has automatically decided that you are passing in a Unit, since this is kinda like void he doesn't really likes it, specifically passing in a Unit like () explicitly tells the compiler that you do want a Unit there. Anyway seems a new deprecation form scala 2.11, I can't reproduce this on 2.10.4.

提交回复
热议问题