In the README.rst documentation, section about oneOrMore, it is said in the table that if type of a is Rule[I, O <: I] then type of oneOrMore(a) is Rule[I, O]. This is not true, however, the type of oneOrMore(a) is Rule[I, I].
To check this, compile the following code:
type A
type B <: A
def R1: Rule[A :: HNil, B :: HNil]
def R2: Rule[A :: HNil, B :: HNil] = rule {zeroOrMore(R1)}
You will get an error:
[error] type mismatch;
[error] found : org.parboiled2.Rule[shapeless.::[A,shapeless.HNil],shapeless.::[A,shapeless.HNil]] with org.parboiled2.Repeated
[error] required: org.parboiled2.Rule[shapeless.::[A,shapeless.HNil],shapeless.::[B,shapeless.HNil]]
[error] def R2: Rule[A :: HNil, B :: HNil] = rule {zeroOrMore(R1)}
In the
README.rst
documentation, section aboutoneOrMore
, it is said in the table that if type ofa
isRule[I, O <: I]
then type ofoneOrMore(a)
isRule[I, O]
. This is not true, however, the type ofoneOrMore(a)
isRule[I, I]
.To check this, compile the following code:
You will get an error: