Skip to content

Fix safe-init error in Trees.scala #14931

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
Apr 13, 2022

Conversation

Xavientois
Copy link
Contributor

Fixes the following safe-init error that occurs during bootstrapping:

[error] -- Error: /***********/dotty/compiler/src/dotty/tools/dotc/ast/Trees.scala:815:22
[error] 815 |    assert(isEmpty || tpt != genericEmptyTree[T])
[error]     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Call method ValDef.this.tpt.!=(dotty.tools.dotc.ast.Trees.genericEmptyTree[T]) on a value with an unknown initialization. Calling trace:
[error]     |-> @sharable val theEmptyValDef = new EmptyValDef[Type]()  [ Trees.scala:970 ]
[error]     |                                  ^^^^^^^^^^^^^^^^^^^^^^^
[error]     |-> class EmptyValDef[T >: Untyped] extends ValDef[T](  [ Trees.scala:961 ]
[error]     |   ^
[error]     |-> case class ValDef[-T >: Untyped] private[ast] (name: TermName, tpt: Tree[T], private var preRhs: LazyTree[T @uncheckedVariance])(implicit @constructorOnly src: SourceFile) [ Trees.scala:812 ]
[error]     |   ^
[error]     |-> assert(isEmpty || tpt != genericEmptyTree[T])   [ Trees.scala:815 ]
[error]     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |-> if !assertion then scala.runtime.Scala3RunTime.assertFailed()   [ Predef.scala:10 ]

Fixes the following safe-init error that occurs during bootstrapping:
```
[error] -- Error: /***********/dotty/compiler/src/dotty/tools/dotc/ast/Trees.scala:815:22
[error] 815 |    assert(isEmpty || tpt != genericEmptyTree[T])
[error]     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Call method ValDef.this.tpt.!=(dotty.tools.dotc.ast.Trees.genericEmptyTree[T]) on a value with an unknown initialization. Calling trace:
[error]     |-> @sharable val theEmptyValDef = new EmptyValDef[Type]()  [ Trees.scala:970 ]
[error]     |                                  ^^^^^^^^^^^^^^^^^^^^^^^
[error]     |-> class EmptyValDef[T >: Untyped] extends ValDef[T](  [ Trees.scala:961 ]
[error]     |   ^
[error]     |-> case class ValDef[-T >: Untyped] private[ast] (name: TermName, tpt: Tree[T], private var preRhs: LazyTree[T @uncheckedVariance])(implicit @constructorOnly src: SourceFile) [ Trees.scala:812 ]
[error]     |   ^
[error]     |-> assert(isEmpty || tpt != genericEmptyTree[T])   [ Trees.scala:815 ]
[error]     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |-> if !assertion then scala.runtime.Scala3RunTime.assertFailed()   [ Predef.scala:10 ]
```
@Xavientois Xavientois requested a review from liufengyun April 13, 2022 16:30
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@Xavientois Xavientois enabled auto-merge April 13, 2022 17:18
@Xavientois Xavientois merged commit f4822ac into scala:main Apr 13, 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.

2 participants