Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wrong top statement declaration in scala IntelliJ

I have the following warning, could you explain what does it mean, and how I can correct the code to get rid of the warning?

enter image description here

like image 894
Scana Avatar asked May 13 '16 09:05

Scana


1 Answers

You forgot the return type in your method definition. Therefore the body is not well parsed.

For example:

def scaleMap(file: File, key: String): Map[String Int] = { ... }

If you don't know the correct return type immediately, you can just ignore the return part of the method definition. The return type will then be inferred by the compiler.

def scaleMap(file: File, key: String) = { ... }
like image 165
Julien Lafont Avatar answered Nov 01 '22 10:11

Julien Lafont