j-mie6 / parsley

A fast and modern parser combinator library for Scala
https://j-mie6.github.io/parsley/
BSD 3-Clause "New" or "Revised" License
173 stars 15 forks source link

Explicit types #208

Closed som-snytt closed 1 year ago

som-snytt commented 1 year ago

I was looking at how inferred types change under -Xsource:3 and picked this sample project.

This PR is just documentation of the types, and it probably doesn't matter because everything is qualified private.

Indeed, I've never seen so much qualified private before.

Under -Xsource:3, you'd probably just silence the migration warning.

j-mie6 commented 1 year ago

Did you notice anything interesting?

som-snytt commented 1 year ago

Not really. All the narrower types are probably benign, although Iterable[Nothing] is less useful.

There was a scalac bug when inferring the result of override final val. I fixed that quickly and they accepted the PR quickly!

som-snytt commented 1 year ago

Explicit types are too noisy unless you're supporting different Scala versions. (Dotty needs them in the standard library, where the explicit type is the "old" type inferred by Scala 2.) -Xsource:3 -Wconf:cat=scala3migration:s would silence the noise.

j-mie6 commented 1 year ago

I am using -Xsource:3 though (via sbt-typelevel), I get no warnings?

som-snytt commented 1 year ago

The behavior is tweaked for 2.13.12 which is due a in a couple of months. It will warn/error if inferred override type is different with/without the flag. Thanks for using it! I guess Seth Tisue notices it in the community build, where I guess he doesn't add flags but just upgrades the compiler version.