typetools / typetools/checker-framework

Custom Units Checker qualifiers need to be supertypes of @UnitsBottom

Open
#2,087 0 comments 0 reactions 1 assignee View on GitHub

@jyluo is already working on this.

Since Aug 1, 2018.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

Problem report: https://groups.google.com/d/msg/checker-framework-discuss/M0tPOCT9RGA/aRETL3X3CQAJ

@UnitsBottom is the implicit qualifier for null: @ImplicitFor(typeNames = Void.class, literals = LiteralKind.NULL).

For the built-in qualifiers, assigning null works, e.g. @m Float x = null;

However, for a custom units annotation, the same is not true and an error is raised:

error: [return.type.incompatible] incompatible types in return.
            return null;
                   ^
 found   : @UnknownUnits  null
 required: @frac(Prefix.deci) Float

Note that @UnitsBottom has the following meta-annotation: @SubtypeOf({}) // needs to be done programmatically
So most likely the error is that setting the correct supertypes only considered the built-in units and incorrectly ignores costum units annotations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.