com-lihaoyi / fastparse

Writing Fast Parsers Fast in Scala
https://com-lihaoyi.github.io/fastparse
MIT License
1.09k stars 164 forks source link

Warning about whitespace equality inside rep macro #279

Closed cornerman closed 1 year ago

cornerman commented 1 year ago

The method rep produces warnings about whitespace equality.

Version: 3.0.0 Scala: 2.13.10

Reproduction:

import fastparse.ScriptWhitespace._
import fastparse._

val someParsingRun = otherParsingRun.rep

This will produce the following warning:

comparing values of types fastparse.ScriptWhitespace.whitespace.type and fastparse.NoWhitespace.noWhitespaceImplicit.type using `ne` will always yield true
lihaoyi commented 1 year ago

Seems like the method is working as intended. Not sure why the compiler is so noisy. Could you just @nowarn it for now? We can probably put a @nowarn inside the rep method later

dmregan commented 3 months ago

Is there anyway in Scala 2.12 to suppress these warnings? I asked this question on stack flow (https://stackoverflow.com/questions/78373135/whitespace-warnings-with-fastparse) and it was suggested to add a compiler option to turn off macros warnings but this doesn't work.

scalacOptions ++= Seq(          
  "-encoding", "utf8",  
  "-Ywarn-macros:none",
)

I can't move to Scala 2.13 because I'm building for Databricks which is currently stuck on 2.12.

David

He-Pin commented 3 months ago

@dmregan IIRC, this has been fixed in the main but requires a new release. Is it possible to cut a new release?

dmregan commented 1 month ago

@dmregan IIRC, this has been fixed in the main but requires a new release. Is it possible to cut a new release?

He-Pin, was the question 'Is it possible to cut a new release?' aimed at me?

lihaoyi commented 1 month ago

Should be in the 3.1.1 release