Skip to content

Incompatible type in overriding after upgrading to Scala 2.13 #463

Closed
@contra-bit

Description

@contra-bit

Good day dear developers,

I would be very greafull if you could help me fix this type error. Our reseach group is developing a parser for SysML and OCL, which generates C Code, with ACSL annotation. This is important, because the SysMLParsers are based on the OclParsers. (Extending the Lexer and the Parers). The Tokens for SysML do not extend our OclTokens.

buy
This Diagram shows the relationships of the differnet parsers, lexers and traits, which are relevant to this bug.

Our SysML parsers extends a lot of the functionality of the OclParser, this is why it uses the same token function. I think the problem is, that we use scala.util.parsing.combinator.token.Tokens.Token. in our OclLTokens and scala.util.combinatoir.parsing.lexical.Lexical in the OclLexer
Booth Lexers provide Tokens.Token.

The error is caused in the definition for the token function.

object SysMLLexer extends OclLexer {

  override def token = super.token

  def lineBreak = ('\r' ~ '\n' | '\n' | '\r')
}

Overriding the token Parser with super.token in the SysMLLexer was no problem in Scala 2.12, now the types are illegal.

I have created a minimal example of our setup. The minimal example maintains the same inheritance and traits as our original project, but removes all depencies and only has one token, one delimiter one lexer and one parser function. It has two branches (scala 2,13 and scala 2.12 , which aside of the scala version are identical.

Running sbt run will only succed in the Scala 2.12 Branch

Please tell me if this is a bug of Scala 2.13 or help me change the minimal example so that it can compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions