Skip to content

Fix safe-init error in ParamOwner #14638

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

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

Xavientois
Copy link
Contributor

When bootstrapping the compiler with the -Ysafe-init flag, we would
get the following error:

[error] -- Error: /Users/rrampersad/Documents/school/URA/dotty/compiler/src/dotty/tools/dotc/parsing/Parsers.scala:53:45
[error] 53 |    val Class, Type, TypeParam, Def: Value = Value
[error]    |                                             ^^^^^
[error]    |Calling the external method method Value may cause initialization errors.

This error orginates from the Scala 2 Enumeration class definition. In order to circumvent this issue, we instead define ParamOwner using a Scala 3 enum. This eliminates the error.

Review by @liufengyun

When bootstrapping the compiler with the `-Ysafe-init` flag, we would
get the following error:
```
[error] -- Error: /Users/rrampersad/Documents/school/URA/dotty/compiler/src/dotty/tools/dotc/parsing/Parsers.scala:53:45
[error] 53 |    val Class, Type, TypeParam, Def: Value = Value
[error]    |                                             ^^^^^
[error]    |Calling the external method method Value may cause initialization errors.
```

This error orginates from the Scala 2 `Enumeration` class definition. In order to circumvent this issue, we instead define `ParamOwner` using a Scala 3 enum.  This eliminates the error.

Review by @liufengyun
@bishabosha bishabosha merged commit 4153fea into scala:main Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants