bug: code completion for record members typed using package name

Worker

Member³
Another record-and-code-assistant related weirdism:

If a record type is defined in a package then code completion for variables of that type only works if the variable is declared as "type", and not if it is declared as "package.type".

Code:
CREATE OR REPLACE PACKAGE BODY pkg AS

TYPE rec_type IS RECORD (
  a NUMBER,
  b NUMBER);

PROCEDURE proc IS
  var_1  rec_type;
  var_2  pkg.rec_type;
BEGIN
  var_1. -- use code completion here, works OK
  var_2. -- use code completion here, does not work
END;

END pkg;

 
Isn't it expected?!? Code completion will work as usual if rec_type is declared in the package specification.
 
The pkg prefix is a bit unexpected here. Normally you would only use this type specification if the declaration was in a different package. If the type declaration is in the same package, you would still expect it in the package specification.
 
The pkg prefix is definitely optional in that case, although it's possible to construct a case where it's not optional. Consider:

Code:
CREATE OR REPLACE PACKAGE BODY pkg AS

TYPE rec_type IS RECORD (
  a NUMBER,
  b NUMBER);

PROCEDURE proc IS

  TYPE rec_type IS RECORD (
    x VARCHAR2(100),
    y VARCHAR2(100) );

  var_1  rec_type;
  var_2  pkg.rec_type;

BEGIN
  var_1. -- use code completion here, works OK
  var_2. -- use code completion here, does not work

END;

END pkg;

Without the package name prefix, var_2 would get the wrong rec_type. To get the rec_type defined on the package level, the package name prefix is necessary.
 
Back
Top