Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix types relationships#352

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
manuq wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromcast-cleanup
Draft

Fix types relationships#352

manuq wants to merge1 commit intomainfromcast-cleanup

Conversation

@manuq
Copy link
Contributor

The types relationship (previously named cast_relationships) tell which type can be used in the context of another type. For example, integers and floats are exchangeable. And in particular, all other types can be used in boolean context:if not Color.BLACK: is allowed in GDScript as Color.BLACK is falsey. Same for the empty string, zero number, etc.

This fixes a bug where an integer or float value block was allowed to be snapped into a string slot.

This removes outdated custom casting code that has been abandoned.

#351

The types relationship (previously named cast_relationships) tell whichtype can be used in the context of another type. For example, integersand floats are exchangeable. And in particular, all other types can beused in boolean context: `if not Color.BLACK:` is allowed in GDScript asColor.BLACK is falsey. Same for the empty string, zero number, etc.This fixes a bug where an integer or float value block was allowed to besnapped into a string slot.This removes outdated custom casting code that has been abandoned.#351
@manuq
Copy link
ContributorAuthor

@DoomTas3r could you review? For some reason I can't add you to the reviewers list.

Copy link
Contributor

@DoomTas3rDoomTas3r left a comment

Choose a reason for hiding this comment

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

Works as intended by preventing casting as strings from other types.

dist[v]=alt
prev[v]=CastGraphEdge.new(u,edge.cast_format)
queue.update_priority(v,alt)
consttypes_relationships= {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this looks much cleaner, although I found casting to a boolean works in if statements or converting through a boolean block, but not for directly setting a boolean variable (Parser Error: Value of type "String" cannot be assigned to a variable of type "bool".) but that situation is unlikely due to it's unique shape. I also think that boolean to integer could be added in the future, similar to#267 (true => 1, false => 0).

Copy link
ContributorAuthor

@manuqmanuqJan 6, 2025
edited
Loading

Choose a reason for hiding this comment

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

I think this looks much cleaner, although I found casting to a boolean works in if statements or converting through a boolean block, but not for directly setting a boolean variable (Parser Error: Value of type "String" cannot be assigned to a variable of type "bool".) but that situation is unlikely due to it's unique shape. I also think that boolean to integer could be added in the future, similar to#267 (true => 1, false => 0).

Oh right, good catch. The assignment is a problem. The issue was there before. For example:
Captura desde 2025-01-06 11-59-05

Which gives:Parser Error: Value of type "Vector2" cannot be assigned to a variable of type "bool".

This PR makes it a bit worse, allowing for more value blocks to be snapped in boolean setters.

@manuqmanuq marked this pull request as draftJune 10, 2025 01:40
@manuq
Copy link
ContributorAuthor

Marking this as draft because of#352 (comment)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@wjtwjtAwaiting requested review from wjt

@dylanmccalldylanmccallAwaiting requested review from dylanmccall

@starnightstarnightAwaiting requested review from starnight

@dbnicholsondbnicholsonAwaiting requested review from dbnicholson

1 more reviewer

@DoomTas3rDoomTas3rDoomTas3r approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@manuq@DoomTas3r

[8]ページ先頭

©2009-2025 Movatter.jp