Skip to content

Improve type checking errors with structs (#761)#804

Merged
lgritz merged 1 commit intoAcademySoftwareFoundation:RB-1.8from
lgritz:lg-structfix
Oct 25, 2017
Merged

Improve type checking errors with structs (#761)#804
lgritz merged 1 commit intoAcademySoftwareFoundation:RB-1.8from
lgritz:lg-structfix

Conversation

@lgritz
Copy link
Copy Markdown
Collaborator

@lgritz lgritz commented Oct 24, 2017

This is a back-port of a fix that went into master a long time ago, and seems to fix some reported bugs in RB-1.8.

Turns out that in addition to making nicer error printing (its original use, per the commit message), it also fixes a bug wherein use of arraylength() on an array of struct resulted in generated code that would make a confusing error message in oslinfo/oslquery.

Sorry for the confusing diffs; the function is changing a bit, in addition to moving from file to file.


Change the implementation of TypeSpec::string(), which returns the text
representation of a TypeSpec, so that it prints the name of the struct
rather than just its numerical designation.

An example of the old behavior, as applied to a type checking error
message:

test.osl:10: error: No matching function call to 'max (struct 1, struct 1)'
    Candidates are:
        int max (int, int)
        float max (float, float)
        ...

And the new behavior:

test.osl:10: error: No matching function call to 'max (struct vector4, struct vector4)'

)

Change the implementation of TypeSpec::string(), which returns the text
representation of a TypeSpec, so that it prints the name of the struct
rather than just its numerical designation.

An example of the old behavior, as applied to a type checking error
message:

    test.osl:10: error: No matching function call to 'max (struct 1, struct 1)'
        Candidates are:
            int max (int, int)
            float max (float, float)
            ...

And the new behavior:

    test.osl:10: error: No matching function call to 'max (struct vector4, struct vector4)'
@lgritz lgritz merged commit 884a98f into AcademySoftwareFoundation:RB-1.8 Oct 25, 2017
@lgritz lgritz deleted the lg-structfix branch October 25, 2017 17:33
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.

1 participant