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

Removing useless GraphOccurrence.Global & some encapsulation #11419

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Oct 27, 2024

Pull Request Description

Work on #11365 made me realize that GraphOccurrence.Global isn't really used anywhere. Simplifying the code by removing it and associated methods.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • All code follows the
    Scala,
    Java,
  • Unit tests continue to work

@JaroslavTulach JaroslavTulach added CI: Ready to merge This PR is eligible for automatic merge CI: No changelog needed Do not require a changelog entry for this PR. labels Oct 27, 2024
@JaroslavTulach JaroslavTulach self-assigned this Oct 27, 2024
@JaroslavTulach JaroslavTulach added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Oct 27, 2024
@JaroslavTulach JaroslavTulach changed the title Removing useless GraphOccurrence.Global Removing useless GraphOccurrence.Global & encapsulation Oct 27, 2024
@JaroslavTulach JaroslavTulach changed the title Removing useless GraphOccurrence.Global & encapsulation Removing useless GraphOccurrence.Global & some encapsulation Oct 27, 2024
@enso-bot
Copy link

enso-bot bot commented Oct 28, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-10-27):

Progress: .

Next Day: Bank holiday. Establishment of Czechoslovakia.

@@ -25,9 +25,15 @@ case class InlineContext(
freshNameSupply: Option[FreshNameSupply] = None,
passConfiguration: Option[PassConfiguration] = None,
pkgRepo: Option[PackageRepository] = None
) {
) extends AutoCloseable {
Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't it easier to make the InlineContext closable than wrap it into InlineContextResource?

Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

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

Nice simplifications.

@@ -143,7 +143,6 @@ protected Graph readObject(Input in) throws IOException {

var nextIdCounter = in.readInt();
var g = new Graph(rootScope, nextIdCounter, links);
g.freeze();
Copy link
Member

Choose a reason for hiding this comment

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

Why remove g.freeze() from here? Is it because of failing tests? Is it not needed anymore?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, this is weird.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it because of failing tests?

No, it is not because of a test. Rather:

Is it not needed anymore?

freezeing doesn't work with DebugEvalNode right now.

val nextId = _nextIdCounter
if (nextId < 0) {
throw new IllegalStateException("Cannot emit new IDs. Frozen!")
Copy link
Member

Choose a reason for hiding this comment

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

IMHO it is better to have the explicit boolean frozen field, than encoding the frozen state as nextId == -1.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess, my original idea was to not serialize nextIdCounter in serde, but initialize it to -1 after deserialization - e.g. freeze it. But (as freezing doesn't work - #11022) I had to give up on that idea. Now the code is ready for freezing (by assigning the counter to -1), but there is no freezing happening. Hopefully it will, one day.

@mergify mergify bot merged commit 71acb83 into develop Oct 29, 2024
41 checks passed
@mergify mergify bot deleted the wip/jtulach/NoGlobalOccurence11365 branch October 29, 2024 10:23
Copy link
Collaborator

@hubertp hubertp left a comment

Choose a reason for hiding this comment

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

Similar comments to @Akirathan, otherwise LGTM

mergify bot pushed a commit that referenced this pull request Nov 1, 2024
Another change motivated by work on #11365. Continuation of #11419.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants