Icon View Incident Report

Serious Serious
Reported By: Michael Dreher
Reported On: 3/20/2018
For: Version 2.06 Build 11
# 4634 Passing Function References as Parameters Can Result in Invalid Compiler Errors

I am getting a compiler error "function xyz does not exist", but I don't know what's wrong with the code.

type
 TFloatFunc1 = function(f : double) : double;

 TVector = class public
   function Equals(const v : TVector) : boolean;
   function Map(f : TFloatFunc1) : TVector;
 end;

function DoubleTheValue(f : double) : double;
begin
 Result := f*f;
end;

procedure RunTest;
var b : boolean;
begin           
 b := TVector.Create.Map(DoubleTheValue).Equals(TVector.Create);
   // [Error] Main.wbs (42,27): The referenced variable, parameter, or function DoubleTheValue does not exist
end;



Comments Comments and Workarounds
This issue was caused by the compiler incorrectly walking up the call chain to determine if the function reference was a parameter.

The workaround was to assign the function reference to a variable before passing it to the method.


Resolution Resolution
Fixed Problem on 3/22/2018 in version 2.06 build 12


Products Affected Products Affected
Elevate Web Builder
Elevate Web Builder Trial

Image