Skip to content

Capture success on failure if type is annotated or infered to P[Unit] #261

@fabianhjr

Description

@fabianhjr
scalac: v2.13.8
fastparse: v2.3.3

Observing this behaviour from repl:

@ import fastparse._ 
import fastparse._

@ import NoWhitespace._ 
import NoWhitespace._

@ def fail[T: P] = Fail.! 
defined function fail

@ val wat = "Shouldn't success" 
wat: String = "Shouldn't success"

@ parse(wat, fail(_)) 
res4: Parsed[String] = Parsed.Failure(Position 1:1, found "Shouldn't ")

@ def fail[T: P]: P[Unit] = Fail.! 
defined function fail

@ parse(wat, fail(_)) 
res6: Parsed[Unit] = Success(value = (), index = 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions