Additional tests for {mode delphi} anonymous functions and function references. Current compiler fails on four of the tests.
## Summary Adding additional tanonfunc and tfuncref tests for {mode delphi}. We tried upgrading to trunk and the new anonymous and function ref capabilities. The result was compile errors in our code which we compile with {mode delphi}. We went through the existing tests and for the ones that were not objfpc specific we created new tests that are the same but can be compiled with {mode delphi} and with correct delphi syntax. Doing so we found a couple that failed in the same fashion we were seeing in our code. We also added one more test to cover all failure modes we saw in our code.[DelphiModeAnonFuncRefTests.zip](/uploads/844b02bd22130827fc403932d0e2a6dd/DelphiModeAnonFuncRefTests.zip) ## System Information <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:** Macos, Linux, Windows <!-- Windows, Linux (if possible, also name the distro), FreeBSD, Android, ... --> - **Processor architecture:** x86_64, Aarch64 <!-- x86, x86-64, ARM, AARCH64, AVR, RISC-V, PowerPC, ... --> - **Compiler version:** trunk <!-- trunk ... (if possible, give also the git hash) --> - **Device:** <!-- macos x86_64, macos aarch64, linux x86_64 --> ## Steps to reproduce run tanonfunc61.pp, tanonfunc62.pp, tanonfunc63.pp, and tanonfunc70.pp ## Example Project see attached tests ## What is the current bug behavior? Compile fails with one of these two messages: Error: Wrong number of parameters specified for call to "\<Procedure Variable\>" Error: Illegal type conversion: "untyped" to "^Pointer" ## What is the expected (correct) behavior? no errors ## Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise. You can also use syntax highlighting for Pascal with: ```pascal the code``` For more information see https://docs.gitlab.com/ee/user/markdown.html --> ## Possible fixes Compile problem is when a function reference is called inside of an anonymous function with {mode delphi}. The original anonymous/funcref code that we had from Blaise did not fail with these tests. But we are seeing the failures for trunk FPC with Svens additions for anonymous functions and function references. We will not be able to drop our old Blaise code and sync up with trunk unless it is fixed. Thanks.
issue