E4041

E4041#

Partial type annotation is not allowed in toplevel declaration.

Erroneous Example#

let a : Option[_] = Some(3)

The example above tries to create a top-level instance of the Option[_] type. However, partial type annotation is not allowed in toplevel declaration, giving the aforementioned error on line 1.

Suggestion#

Make sure to provide a complete type annotation:

let a : Option[Int] = Some(3)