Skip to content

Avoid false warning when synthesising deferred givens #23087

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented May 2, 2025

Fixes #23049

@dwijnand dwijnand marked this pull request as ready for review May 2, 2025 15:24
@dwijnand dwijnand requested a review from sjrd May 2, 2025 15:25
@dwijnand dwijnand assigned dwijnand and sjrd and unassigned dwijnand May 2, 2025
@@ -577,7 +577,7 @@ class DependencyRecorder {
clazz
}

private var _responsibleForImports: Symbol = uninitialized
private[dotc] var _responsibleForImports: Symbol | Null = uninitialized
Copy link
Member

Choose a reason for hiding this comment

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

If we're actually going to test whether it was initialized with an == null, then we should explicitly initialize it to null. uninitialized is supposed to be used only for things that will get assigned before every being read.

Suggested change
private[dotc] var _responsibleForImports: Symbol | Null = uninitialized
private[dotc] var _responsibleForImports: Symbol | Null = null

@sjrd sjrd assigned dwijnand and unassigned sjrd May 2, 2025
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.

False "No class, trait or object is defined in the compilation unit." warning when using deferred given
2 participants