Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Scalastyle doesn't support 2.13's singleton types #141

Open
MateuszKubuszok opened this issue Jan 29, 2021 · 1 comment
Open

Scalastyle doesn't support 2.13's singleton types #141

MateuszKubuszok opened this issue Jan 29, 2021 · 1 comment

Comments

@MateuszKubuszok
Copy link

MateuszKubuszok commented Jan 29, 2021

In Scala 2.13 singleton types are supported. They are useful e.g. in combination with Refined Types:

@newtype final case class Email(emailString: String Refined MatchesRegex[Email.Pattern])
object Email {
  type Pattern = "(.+)@(.+)"
  ...
}

however even in 1.5 Scalastyle doesn't handle such input:

[error] /path/to/my/file.scala: Expected identifier, but got Token(STRING_LITERAL,"(.+)@(.+)",1054,"(.+)@(.+)")

Would it be possible to add such support?

@mwz
Copy link
Member

mwz commented Feb 15, 2021

Hey, this parsing error originates from scala-ide/scalariform, which I'm afraid hasn't been maintained for a long time (since mid 2019). While it's definitely possible to implement this (and probably quite easy too), we'd need to contribute and release those changes from a separate fork.

It's probably not worth investing much effort into this given that scalariform is essentially a dead project along with scalastyle, but if you're keen to make the changes necessary to make this work I'd be happy to review and update/release a new version of scalastyle.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants