Skip to content

fix(validation): fix false-positive unresolved generic symbol validation for formal parameters#1066

Merged
ghaith merged 5 commits intomasterfrom
formal-generics
Feb 2, 2024
Merged

fix(validation): fix false-positive unresolved generic symbol validation for formal parameters#1066
ghaith merged 5 commits intomasterfrom
formal-generics

Conversation

@mhasel
Copy link
Copy Markdown
Member

@mhasel mhasel commented Jan 9, 2024

When validating generic type-natures, we did not account for Identifier statements in formal parameter calls FOO(x := 0);, which will have a datatype that might look like the following example:

name: "__FOO__T",
    initial_value: None,
    information: Generic {
        name: "__FOO__T",
        generic_symbol: "T",
        nature: Num,
    },
    ...

and therefore be falsely validated as unresolved generic symbols. This PR adds an exception for Identifier statements during the type-nature validation.

@mhasel mhasel marked this pull request as ready for review January 11, 2024 09:43
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7e2e61a) 95.82% compared to head (13daff2) 95.83%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1066      +/-   ##
==========================================
+ Coverage   95.82%   95.83%   +0.01%     
==========================================
  Files         153      153              
  Lines       42806    42808       +2     
==========================================
+ Hits        41018    41026       +8     
+ Misses       1788     1782       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mhasel mhasel requested review from ghaith and volsa January 11, 2024 10:14
Comment on lines +11 to +15
error: Invalid type nature for generic argument. __STRING_19 is no Num.
┌─ <internal>:21:35
21 │ myLocalNumber := FOO(x := 'INVALID TYPE NATURE'); // invalid type nature
│ ^^^^^^^^^^^^^^^^^^^^^ Invalid type nature for generic argument. __STRING_19 is no Num.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Weird, I don't get this message when running the example locally

volsa
volsa previously approved these changes Jan 16, 2024
Copy link
Copy Markdown
Member

@volsa volsa left a comment

Choose a reason for hiding this comment

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

Looks good 👍

volsa
volsa previously approved these changes Jan 26, 2024
ghaith
ghaith previously approved these changes Jan 30, 2024
@ghaith ghaith merged commit 6111391 into master Feb 2, 2024
@ghaith ghaith deleted the formal-generics branch February 2, 2024 09:36
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