Getting errors "self constructor arguments cannot reference unconstructed this" only if class is the same name as the class file

In a nutshell, if I define a constructor in a class named after the same name as the file itself, it returns the next scope.

Sample code example. Take the file name as ParseWebsiteData.scala for both.

This returns an error.

class ParseWebsiteData(url:String) {

}

This, however, works great.

class Foo(url:String) {

}

The only thing I see as a problem is the parser errors since 2013, but this is the latest version of the Eclipses Scala IDE installation, so I strongly think that this is not the case, but it turns out Wrong. Unfortunately: (

As still a problem, what are the ways (s) to avoid this, how will I code in the future?

+4
1

, , Scala Eclipse, "project- > clean", !

+4

Source: https://habr.com/ru/post/1608368/


All Articles