question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parser error for infix methods with type parameter.

See original GitHub issue

From @durban on February 4, 2016 12:15

The code below produces this message:

[warn] Scalariform parser error for .../GenericOperator.scala: Expected token SEMI but got Token(LBRACKET,[,83,[)

The error seems to be caused by the C() ?[Int] 7 expression; without the [Int], there is no error.

object GenericOperator {

  case class C() {
    def ?[A](a: A): A = a
  }

  C() ?[Int] 7
}

Copied from original issue: daniel-trinh/scalariform#111

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:6

github_iconTop GitHub Comments

8reactions
christydennisoncommented, Mar 1, 2017

Any update on this?

4reactions
AlexisBRENONcommented, Aug 25, 2020

Hello,

I got a similar error message (as reported in #217) with scalastyle:

Expected token SEMI but got Token(ARROW,=>,639,=>)

On the following block:

fields
      .map { field =>
        // [...]
        val matchResult = be(expected(field.getName)).apply(field.get(left)
        matchResult.copy(
          // [...]
          midSentenceNegatedFailureMessageArgs = matchResult.midSentenceNegatedFailureMessageArgs :+ field.getName,
        )
      }

I fixed it by removing the trailing comma at the end of the copy call.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chaining infix operators with statically resolved type parameter
I'm trying to create an infix operator to make System.Text.StringBuilder slightly easier to use. ... but fails with parameters of different types:
Read more >
Calling a function without parameters in infix notation - Question
Parsing precedes type checking. a b c is always parsed as a.b(c) , regardless of what types are involved. Note also that the...
Read more >
Troubleshooting F# | F# for fun and profit
This error typically occurs when passing too many arguments to a function. It can also occur when you do operator overloading, but the...
Read more >
Infix Notation : Kotlin - Suneet Agrawal
But infix functions always require both the receiver and the parameter to be specified. When you are calling a method on the current...
Read more >
SML/NJ Error Messages
The parser used by SML/NJ is produced by ML-Yacc, and it uses a lexer ... fun f = 3; stdIn:1.5 Error: can't find...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found