Jump to content

New Type ambiguity in Delphi 11?

Recommended Posts

Today I have loaded a large project written in Delphi 10.4.2, for the first time in Delphi 11 Alexandria. The project had been grown and compiled in Delphi 10.4.2 without problems. So I was very surprised to see 90+ errors in the main unit in Delphi 11. Looking at the errors, they were mostly type-mismatches in method parameters like TShiftState or TMouseButton. First I started to add explicit scope prefixes to the parameters. But that seemed to be lengthy work, so I suddenly had an idea: I moved System.UITypes from the start of the uses clause to the end of the uses clause. That action resolved the problem and all errors disappeared!


So why this worked in Delphi 10.4.2, and works in Delphi 11 only after moving System.UITypes to the end of the uses clause?

Edited by PeterPanettone

Share this post

Link to post

Considering TShiftState is declared in System.Classes in both 10.4.2 and 11, that is strange.

Also, TMouseButton is declared in System.UITypes in both versions.

Share this post

Link to post

Should not be a problem, maybe I am just lucky and the uses in my project was "correct" already in 10.4.2 for me only change was the breaking changes in the interfaces that were incorrect prior to Delphi 11.

Share this post

Link to post
21 minutes ago, PeterPanettone said:

compiled in Delphi 10.4.2 without problems

Maybe that is an optimistic expression. As the main unit became larger and larger in Delphi 10.4.2 (16,500 lines), strange effects appeared: For example, when adding a new control to the main form (in Delphi 10.4.2), the control's field name was added in the wrong place by Delphi, so I had to move the control's field name manually to the correct place.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now