Short = -Short -> is an Integer in a Scala compiler

Hello,

new_total and loan.total are Shorts

new_total = (-loan.total)


/home/vagrant/dev/sowase/sowase.loans/src/main/scala/sowase/loans/EmsLoansProcessing.scala:193: type mismatch;
[error]  found   : Int
[error]  required: Short
[error]       new_total = (-loan.total)

So:

new_total = (-loan.total).toShort

is ok and necessary, 

but in the IDEA this .toShort is gray with comment "casting (-loan.total) toShort is redundant".
  
Regards
 
Daniel





























0
2 comments

Fixed in master: https://github.com/JetBrains/intellij-scala/commit/e9fbc86e816b8d4652fa8dc601372a24f32282c0
Fix will be available in nightly build or in Scala plugin 2.1.0 release.

Best regards,
Alexander Podkhalyuzin.

0
Avatar
Permanently deleted user

Thanks.

Daniel Roziecki

0

Please sign in to leave a comment.