Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala: Parse by name types in function arguments #4178

Merged
merged 6 commits into from Oct 29, 2021

Conversation

mmcqd
Copy link
Member

@mmcqd mmcqd commented Oct 28, 2021

We can now parse types like (=> Int) => Int

Test plan: make test (see added test)

PR checklist:

  • Documentation is up-to-date
  • Changelog is up-to-date
  • Change has no security implications (otherwise, ping security team)

@linear
Copy link

linear bot commented Oct 28, 2021

PA-158 [Scala] Parsing error

Describe the bug

src/main/scala/Main.scala:10:27: Syntax error
Raised at file "src/parsing/Parse_target.ml", line 174, characters 23-26
Called from file "src/cli/Main.ml", line 1114, characters 17-60
Called from file "src/pfff/h_program-lang/Error_code.ml", line 399, characters 4-8

Uncaught exception:

  Parse_info.Parsing_error(_)

Raised at file "src/parsing/Parse_target.ml", line 174, characters 23-26
Called from file "src/cli/Main.ml", line 1114, characters 17-60

Code:

import org.slf4j.{Logger, LoggerFactory, MDC}
import zio.FiberRef
import scala.jdk.CollectionConverters._

object Logging {
  trait Service {
  }
}

class Slf4jLogger(logger: (=> AnyRef) => Logger, mdcContext: FiberRef[Map[String, String]]) extends Logging.Service {
  val sync = 123

}
object Main extends App {
  println("Hq")
}

To Reproduce
Analyze attached code fragment

Expected behavior
file successfully parsed

What is the priority of the bug to you?

  • P0: blocking your adoption of Semgrep or workflow
  • P1: important to fix or quite annoying
  • P2: regular bug that should get fixed

Environment
docker

View original issue in GitHub


@mjambon mjambon merged commit 18af145 into develop Oct 29, 2021
@mjambon mjambon deleted the matthew/pa-158-scala-parsing-error branch October 29, 2021 03:05
Copy link
Collaborator

@aryx aryx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woohoo!

@aryx
Copy link
Collaborator

aryx commented Oct 29, 2021

Do you know how much it improves our parsing stats for Scala?

@mmcqd
Copy link
Member Author

mmcqd commented Nov 1, 2021

Do you know how much it improves our parsing stats for Scala?

We went from 89.6 to 90.0, so not massive, but measurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants