TD-23561: Compile error "Undefined function: ..." is confusingly wrong

Report bugs and possible workarounds.
Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Posts: 1160
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

TD-23561: Compile error "Undefined function: ..." is confusingly wrong

Post by Dave Rabelink » 24 May 2017, 09:51

Tested on TD70 UPDATE1 (7.0.1)

When you call a class function but in the call you:
  • Pass in wrong number of arguments
  • Pass in a wrong datatype for the function parameter
and then compiling the application, the IDE will throw a confusingly wrong error message:
Error: Undefined function: xxx
(where xxx is the function name of the call)

In both cases, the error should reflect what the issue is.
The function IS defined, but the caller is using it wrong. So the errors should be as in TD 6.3 and earlier versions:
Error: Function call has wrong number of arguments.
Error: Function argument 1 does not match declared data type. Check for possible name conflict.
The compiler should decide what error to show and state the actual state: if there is no function with that name it should throw "Undefined function". If there is a function having that name it should throw one of the errors as in TD63.

I know TD70 allows function overloading and the parameters in the call should match the overloaded function having the exact number of params and their types. But the error shown now is clearly incorrect as the function DOES exist and should throw what is really the case here.

See testcases. There is a TD63 and TD70 version (same code) but they throw different error messages where in TD70 it is confusingly wrong.
This is registered by OpenText as:

Ticket # 3041379: Compile error "Undefined function: ..." is confusingly wrong
TD-23561 : Irrelevant error message "Undefined function" was encountered when passing wrong parameter's datatype to a class function call
You do not have the required permissions to view the files attached to this post.
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Michael Ehehalt
Posts: 42
Joined: 13 Mar 2017, 09:17
Location: Frankfurt, Germany

Compile error "Undefined function: ..." is confusingly wrong

Post by Michael Ehehalt » 24 May 2017, 11:44

Hi Dave,

same in TD 7.0.0. I think this is a resulting error from the embed function overloading in the language - like you described.

I checked the error messages in C# (for example) for this situations (method overloading too). In the case the function exist with different parameter count you get the error:
"No overload for method 'xxx' takes n arguments"
Where xxx is the function name and n the amount of parameters. Are the parameter count the same but the types are not correct:
"Argument n: cannot convert from 'type 1' to 'type 2'"
In contrast, the error message in the TD for this situation is not very helpful ...



Return to “Bug Reports”

Who is online

Users browsing this forum: [Ccbot] and 0 guests