Skip to content

REPL completions hide compile error (e.g. Classfile/TASTy is broken error) #18614

Open
@bishabosha

Description

@bishabosha

Running completions in the REPL seems to ignore any errors produced by the compiler

Compiler version

3.3.0 (to replicate, though im sure the latest version swallows other kinds of errors)

run the repl with JDK 21 (If you use 3.3.1 im sure there is another error that can be swallowed this way)

Minimized code

in the repl, try running completions on this line

scala> import java.lang.reflect.ClassFileFormatVersion.<TAB>

then from now on java.lang.reflect.ClassFileFormatVersion is broken, and no error was printed about the broken class file.

e.g. now mysteriously ClassFileFormatVersion has no members:

scala> java.lang.reflect.ClassFileFormatVersion.RELEASE_21
-- [E008] Not Found Error: -----------------------------------------------------
1 |java.lang.reflect.ClassFileFormatVersion.RELEASE_21
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |value RELEASE_21 is not a member of object java.lang.reflect.ClassFileFormatVersion
1 error found

Expectation

I expected to see the same error as if I had not done a completion:

scala> java.lang.reflect.ClassFileFormatVersion.RELEASE_21
error while loading ClassFileFormatVersion,
class file /modules/java.base/java/lang/reflect/ClassFileFormatVersion.class is broken, reading aborted with class java.lang.RuntimeException
bad constant pool index: 0 at pos: 2629
-- [E008] Not Found Error: -----------------------------------------------------
1 |java.lang.reflect.ClassFileFormatVersion.RELEASE_21
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |value RELEASE_21 is not a member of object java.lang.reflect.ClassFileFormatVersion
2 errors found

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions