Skip to content

Crash report on missing closing parenthesis #19087

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

Closed
JD557 opened this issue Nov 26, 2023 · 0 comments
Closed

Crash report on missing closing parenthesis #19087

JD557 opened this issue Nov 26, 2023 · 0 comments

Comments

@JD557
Copy link
Contributor

JD557 commented Nov 26, 2023

Compiler version

3.3.1

Minimized code

I forgot to close some parenthesis and got a compiler crash instead of a compilation error.

Tested in Scala-cli

case class State(x: Int)

def foo[T](state: State)(body: => T): Option[T]
  Option.when(state.x == 0) body

var bar = 0
val state = State(0)

def app: Function1[Int, Unit] =
  new Function1[Int, Unit]:
    def apply(x: Int): Unit =
      foo(state):
        foo(state.copy(x = 5): // Missing ")"
          println("a")
      bar = 2

Output (click arrow to expand)

[error] .\paren.sc:4:33
[error] expression expected but end of statement found
[error]   Option.when(state.x == 0) body
[error]                                 ^
[error] .\paren.sc:15:11
[error] expression expected but = found
[error]       bar = 2
[error]           ^
exception occurred while parser D:\Projects\cli-tests\.scala-build\cli-tests_103be31561-147eb5c58d\src_generated\main\paren.scala

  exception occurred while compiling List(D:\Projects\cli-tests\.scala-build\cli-tests_103be31561-147eb5c58d\src_generated\main\paren.scala)

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose

     while compiling: <no file>
        during phase: <no phase>
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.10
    compiler version: version 3.3.1
            settings: -bootclasspath C:\Coursier\Cache\https\repo1.maven.org\maven2\org\scala-lang\scala3-library_3\3.3.1\scala3-library_3-3.3.1.jar;C:\Coursier\Cache\https\repo1.maven.org\maven2\org\scala-lang\scala-library\2.13.10\scala-library-2.13.10.jar -classpath D:\Projects\cli-tests\.scala-build\.bloop\cli-tests_103be31561-147eb5c58d\bloop-internal-classes\main-eiQ3lMiATK-9XMWTRe3v2Q==;D:\Projects\cli-tests\.scala-build\cli-tests_103be31561-147eb5c58d\classes\classes-empty-cli-tests_103be31561-147eb5c58d -d D:\Projects\cli-tests\.scala-build\.bloop\cli-tests_103be31561-147eb5c58d\bloop-internal-classes\main-eiQ3lMiATK-9XMWTRe3v2Q== -java-output-version 17 -sourceroot D:\Projects\cli-tests

                tree: EmptyTree
       tree position: :<unknown>
           tree type: <notype>
              symbol: val <none>
           call site: package <root> in module class <root>

  == Source file context for tree position ==


Error compiling project (Scala 3.3.1, JVM (17))
Error: Unexpected error when compiling cli-tests_103be31561-147eb5c58d: 'assertion failed: position error, parent span does not contain child span
parent      =  extends Function1[Int, Unit] {
  def apply(x: Int): Unit =
    foo(state)(foo(state.copy(x = 5)(println("a")) bar null))
} # -1,
parent span = <283..424>,
child       = def apply(x: Int): Unit =
  foo(state)(foo(state.copy(x = 5)(println("a")) bar null)) # -1,
child span  = [313..317..476]'
Compilation failed
@JD557 JD557 added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 26, 2023
@szymon-rd szymon-rd added area:parser and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 27, 2023
mbovel added a commit to mbovel/dotty that referenced this issue Feb 19, 2024
mbovel added a commit to mbovel/dotty that referenced this issue Feb 19, 2024
@mbovel mbovel closed this as completed in 69170d3 Feb 19, 2024
WojciechMazur pushed a commit that referenced this issue Jul 1, 2024
WojciechMazur pushed a commit that referenced this issue Jul 2, 2024
WojciechMazur added a commit that referenced this issue Jul 2, 2024
Backports #19726 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants