Issue with collections and record types in local routines

Issue #271 invalid
Zigmund Bulinsh created an issue

IDE: Delphi 10.1.2 (Berlin Update 2)

Hi!

I have faced a very strange issue with the local types while in development of a certain task. The problem is if two different parts of the code in the same module have the same local type names but with different structure then code compiled leads to an AV because it uses the other type instead of the scope one. In the attached example on the call to Reproduce2 the AV occurs. To immediately see that it is an issue as I described just rename TNested type in the failing routine to TNested2 and the code runs without any issues. This issues does not happen when using the class based standard generics (if TNestedTypeIssueStd class used instead). I also tried to reproduce it with Interfaces not related to the Spring but failed.

One note: I used the (procedure begin end)(); just to add the anonymous method scope because the issue only happens when code is in anonymous method.

P.S. I am not sure if this is a bug of compiler or an issue in the Spring4D collections. Also for me it was just an intermediate code, before refining and will not stay in the structure which leads to the errors (the type will be unified and moved to the class private type etc). So you can take your decision on either investigating this issue or not.

Kind regards, Zigmund.

Comments (4)

  1. Stefan Glienke repo owner

    No Spring4D issue.

    Remove the third field from TNested in uNestedTypeIssueStd and you see the same issue there.

  2. Log in to comment