Log In    |    Knowledge Base    |    4D Home
Tech Tip: Function result type conflict Compiler Error
Published On: June 19, 2023

When performing a syntax check, a potential listed error is the "Function result type conflict" error. The error will list the problematic Method with the line of the method where the result variable is declared. Investigating the method may lead to some confusion as everything may seem correct in terms of assigning the proper type of values. The problem is most likely caused by the defined type in the Compiler methods.

The compiler methods are created from the "Generate Typing" function of the Compiler window and is used to build a symbol table used for associating the variable types in compiled mode, which helps with the improved performance compared to interpretted mode, where 4D has to determine the type during the execution. There are multiple compiler methods to group different classifications of variables which are Variables, Interprocess Variables, Arrays, Interprocess Arrays, and Methods. The methods all start with "Compiler_" and have a default name that can be changed in the Database Settings under the Compiler Section.

The Compiler method that is related to this issue is the one for the Method parameters and results. The method name is defaulted to "Compiler_Methods". The parameters and resulting variables are define in a format similar to:

C_{TYPE} ({method}; $0)
C_{TYPE} ({method}; $1)
C_{TYPE} ({method}; $2)

The type conflict issue occurs when the type defined in the Compiler method does not match the type defined in the method. Since the compiler does not refer to the compiler method and only the project method this can cause some confusion. Simple ways to address this is to delete the compiler methods and recreate them after a major code update or to manually go in and update the declareations.