8000 fix!: Tighten and correct typings on ASTNode by gonfunko · Pull Request #8835 · google/blockly · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix!: Tighten and correct typings on ASTNode #8835

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 4 commits into from
Apr 1, 2025

Conversation

gonfunko
Copy link
Contributor
@gonfunko gonfunko commented Mar 31, 2025

The basics

The details

Resolves

Fixes #8827

Proposed Changes

This PR updates most of the static ASTNode.create*Node() methods to not check for null arguments (which their method signature prohibits) and not (claim to) return null when that only happened in the case of an invalid null argument. I also cleaned up several unsafe casts and non-null assertions and corrected some other typings.

Breaking Changes

  • The type signature of ASTNode.getWsCoordinate() now allows for null return types, which were always possible but not part of the return type before
  • createWorkspaceNode() no longer allows null workspace or coordinate arguments; it would have just returned null had either of those been provided, so callers check for that and do whatever they would have done had the return value been null.

@gonfunko gonfunko requested a review from a team as a code owner March 31, 2025 22:46
Copy link
Collaborator
@rachel-fenichel rachel-fenichel left a comment

Choose a reason for hiding this comment

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

One more piece of cleanup, plus whatever is going on with the conventional commit labeler, and then good to go.

@gonfunko gonfunko added breaking change Used to mark a PR or issue that changes our public APIs. PR: fix Fixes a bug labels Apr 1, 2025
@gonfunko
Copy link
Contributor Author
gonfunko commented Apr 1, 2025

The commit labeler is just busted here because this is targeting v12 and the action fix isn't there yet. I manually assigned the appropriate labels.

@gonfunko gonfunko merged commit 7171350 into google:rc/v12.0.0 Apr 1, 2025
7 checks passed
@gonfunko gonfunko deleted the defensive-ast branch April 1, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0