Skip to content

Incorrect handling of nullable types defined in typedefs #1052

@mtomasz-chromium

Description

@mtomasz-chromium

The following code will compile, but it should not.

/**
 * @param {!FooBar} foo
 */
function say(foo) {
};

/**
 * @typedef {?{
 *   name: string
 * }}
 */
var FooBar;

This bug is very bad, as it makes us believe that FooBar is non-nullable, but it's not true. In Chromium we use this syntax a lot for defining new types in externs files, and we have possibly a lot of bugs which are not caught by the Closure Compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions