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

Handle array types when checking JSpecify assignment compatibility #740

Closed
msridhar opened this issue Feb 23, 2023 · 1 comment · Fixed by #806
Closed

Handle array types when checking JSpecify assignment compatibility #740

msridhar opened this issue Feb 23, 2023 · 1 comment · Fixed by #806
Labels
jspecify Related to support for jspecify standard (see jspecify.dev)

Comments

@msridhar
Copy link
Collaborator

msridhar commented Feb 23, 2023

#715 added initial checking for JSpecify subtype compatibility at assignments, but I don't think it handled passing array types as type parameters. Example:

Foo<Foo<@Nullable String>[]> x = new Foo<Foo<String>[]>();

We should get an error for the above, but right now I don't think we do.

In fixing this problem, we should probably switch to using a TypeVisitor to do the checking, rather than using our own recursive routine. That way we could more cleanly handle all types of nesting.

/cc @NikitaAware

@msridhar msridhar added the jspecify Related to support for jspecify standard (see jspecify.dev) label Feb 23, 2023
@NikitaAware
Copy link
Contributor

Thanks. I will try to update accordingly

msridhar added a commit that referenced this issue Aug 30, 2023
…lassType in Generic Type invariance check (#806)

- Description: Only ClassTypes are supported for checking the invariance
of the nullability annotations for Generic types and hence TypeVisitors
and a TreeVisitor are added to handle different scenarios like for
example:
  ` Foo<Foo<@nullable String>[]> x = new Foo<Foo<String>[]>(); `

  - Issue Number: 740

- All the tests in NullAwayJSpecifyGenericTests.java have passed for
these changes.

Fixes #740

---------

Co-authored-by: Manu Sridharan <msridhar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jspecify Related to support for jspecify standard (see jspecify.dev)
Projects
None yet
2 participants