Icon View Incident Report

Serious Serious
Reported By: Robert Gesswein
Reported On: 8/27/2021
For: Version 3.01 Build 4
# 4851 Not Including the WebCore Unit Reference in a Source Unit Can Cause Odd Compiler Errors

I'm not sure if this is a bug or documentation error.

When creating a TDialog descendant from the main form (only) of my application there are a series of compiler messages if I create the dialog via TMyDialog.Create(nil) with a nil owner parameter.

In particular:
-- Passing nil does not compile, but only if done on the main form.
-- Creating and passing a nil owner on other forms work as expected.
-- Passing an owner of "Self" generates a run time error when the dialog is shown.
-- Passing "Application" as the owner works properly.

procedure TFrmMain.showSignInDialog();
begin
  signInDlg := TDlgSignIn.NewSignIn(); // THIS LINE IS OKAY
  signInDlg := TDlgSignIn.Create(Application); // THIS LINE IS OKAY
  signInDlg := TDlgSignIn.Create(nil); // THIS LINE CAUSES COMPILER ERROR
  { ERROR IS:
    [Error]: Expected a type reference, instead found TComponent (REPEATED 5 TIMES)
    [Error] Main.wbs (39,27): Cannot find a function, procedure, or method declaration that matches the Create reference
    [Error] Main.wbs (39,16): Invalid expression type found, expected variant or class instance
    [Error] Main.wbs (39,16): Invalid expression type found, expected variant or class instance
  }
end;



Comments Comments
The issue was that the WebCore unit was removed (that's where the TComponent type is declared) from the uses clause in the interface section of the Main unit. If it is added back in, then the errors go away.

There still was an issue in the compiler, however, which was that the compiler was pulling in a type declaration (and using it with the "nil" parameter reference to resolve the Create constructor call) that the compiler doesn't actually have access to. Constant expressions are the only place where this occurs, but I needed to add a check for this to make sure that the compiler always resolves such references and doesn't issue that bogus error message.


Resolution Resolution
Fixed Problem on 9/8/2021 in version 3.02 build 1


Products Affected Products Affected
Elevate Web Builder
Elevate Web Builder Trial

Image