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

Fixed constraint default property value retrieval #423

Merged
merged 2 commits into from
Aug 28, 2023

Conversation

f3l1x98
Copy link
Contributor

@f3l1x98 f3l1x98 commented Aug 21, 2023

Fixed an issue that prevented the retrieval of default property values of constraint definitions

Copy link
Member

@georg-schwarz georg-schwarz left a comment

Choose a reason for hiding this comment

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

Nice catch!

Comment on lines +136 to +141
if (isConstraintDefinition(currentNode)) {
metaInf = getOrFailMetaInformation(currentNode.type);
} else {
assert(isReference(currentNode.type));
metaInf = getOrFailMetaInformation(currentNode.type);
}
Copy link
Member

Choose a reason for hiding this comment

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

Can u do sth like

if (isBlockDefinition(currentNode)) {
  assert(isReference(currentNode.type);
}
const metaInf = getOrFailMetaInformatin(currentNode.type);

Would be a little easier to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That unfortunately does not work, because it would require a declaration of the following type: getOrFailMetaInformation(type: Reference<BuiltinBlocktypeDefinition> | ConstraintTypeLiteral)

The reason being that Typescript is unable to detect multiple declarations and decide which one to use.

@georg-schwarz georg-schwarz merged commit 1766715 into dev Aug 28, 2023
2 checks passed
@georg-schwarz georg-schwarz deleted the bugfix/constraints-get-default-property-value branch August 28, 2023 06:58
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants