DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B1004: name denotes the wrong kind of entity

Catalog status: active. Default severity: error. Stable name: wrong-kind-of-entity. Family: Names and declarations.

The name is declared, but it is not what this place requires: a type where a value is expected, a package where a type is expected, use of something that is not a package, and so on.

Example (Vada)

   X : Integer := Integer;   --  a type, not a value
   use Integer;              --  `use` needs a package; for a type write `use type Integer;`

Example (Varc)

    var x: Integer = Integer;   // a type, not a value
    use Integer;                // `use` needs a package; for a type write `use type Integer;`

In a generic, B1004 also reports a formal declaration a generic cannot have (a formal object of mode out, a formal type written with a type definition that is not a formal one), where the generic is declared; and, where an instance is made, an actual of another class than its formal's (Float for type T is (<>)), or a formal array or access type's actual that is not of the formal's definition.

What to do

Use a name of the right kind; the label says what was found.

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See names and declarations, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.