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

Initialization check for methods with non-hot parameters #13999

Closed
wants to merge 7 commits into from

Conversation

natsukagami
Copy link
Contributor

Description

  • Add a @nonHotParameters annotation
  • Change thisV mostly to Value
  • Handle @nonHotParameter calls for Ref case

If the method is `effectivelyFinal`, we don't have to resolve the
method from the class (and hence tracking the `klass` within a
`Hot` value is not needed).

This limits the kinds of methods that can be annotated, but we will
we removing annotations soon.
This reverts commit 151735e.
For this pull request, it is better that we provide a hard-coded `isNonHotParams`
method (which for now should be just "case class `apply` methods")
and leave the annotation for when there is a later demand.
This makes the condition for a method to take non-hot parameters
to be the `apply` method of a case class.
A test case is also included.
@@ -0,0 +1,8 @@
case class Case(b: Base)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests the Hot case in the call method but not Ref. How do I add such a case?

@natsukagami
Copy link
Contributor Author

sbt scala3-compiler-bootstrapped/compile output with -Ysafe-init with this PR on: output.log

@natsukagami
Copy link
Contributor Author

With previous commit applied: output.log
Number of warnings went down to 46! (from 57 without the PR: output-2.log)

@liufengyun
Copy link
Contributor

This is now superseded by #14283.

@liufengyun liufengyun closed this Jan 17, 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.

3 participants