-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Opaque types are not usable in the REPL under Java 9+ #11884
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
Comments
I can't reproduce this, I tried homebrew distribution and coursier Perhaps there is some other |
Aha! It works for me when running RC1 REPL under Java 8 and fails on Java 9+ ➜ java -version
openjdk version "9"
OpenJDK Runtime Environment (build 9+181)
OpenJDK 64-Bit Server VM (build 9+181, mixed mode)
➜ scala3-repl
scala> object Module:
| opaque type Foo = Int
| object Foo:
| def fromInt(i: Int): Foo = i
|
// defined object Module
scala> def bar(f: Module.Foo) = println(f)
1 |def bar(f: Module.Foo) = println(f)
| ^^^^^^^^^^
| type Foo is not a member of object Module
scala>
➜ setjdk 1.8
➜ java -version
openjdk version "1.8.0_272"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_272-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.272-b10, mixed mode)
➜ scala3-repl
scala> object Module:
| opaque type Foo = Int
| object Foo:
| def fromInt(i: Int): Foo = i
|
// defined object Module
scala> def bar(f: Module.Foo) = println(f)
def bar(f: Module.Foo): Unit
scala> |
Thanks, yes changing to JDK 14 breaks it for me |
Is this not a duplicate of #11146? Because |
yes I would say so, thank you for spotting |
Wow, great find. I almost never use the word |
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.0.0-RC1
Minimized code
Expectation
The top-level definition bug is tracked here: #9879
Not sure what's going on with (1) inability to reference an opaque type defined in an object and (2) lack of opaque type enforcement in the last Module definition. Feels like something about the REPL encoding scheme is at odds with the opaque type implementation scheme.
The text was updated successfully, but these errors were encountered: