Skip to content
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

Make safe init checker skip global objects #18906

Merged
merged 5 commits into from
Nov 27, 2023

Conversation

q-ata
Copy link
Contributor

@q-ata q-ata commented Nov 13, 2023

Decouple the checking of classes and global objects. The Ysafe-init-global flag can be used for checking global objects instead.

@Kordyjan Kordyjan requested a review from olhotak November 13, 2023 14:20
Copy link
Contributor

@olhotak olhotak left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM.

g(new B()) // error
val n: Int = 10
class B() { def foo() = n + 1 }
g(new e.B())
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there still an error here? Should there be?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
g(new e.B())
g(new B())

tests/init/neg/i15883.scala Show resolved Hide resolved
@olhotak olhotak enabled auto-merge November 20, 2023 18:22
@olhotak olhotak disabled auto-merge November 20, 2023 21:22
@liufengyun
Copy link
Contributor

A rebase is need to update the check fiiles due to #18930.

@olhotak olhotak enabled auto-merge November 27, 2023 16:32
@olhotak olhotak merged commit 41e7d95 into scala:main Nov 27, 2023
17 checks passed
@olhotak olhotak deleted the optimize-check-init branch November 27, 2023 21:56
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
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