-3

I have hints after build project in Delphi XE5:

[dcc32 Hint] unit.pas(140): H2443 Inline function 'TJSONPairEnumerator.GetCurrent' has not been expanded because unit 'Data.DBXPlatform' is not specified in USES list

It refers to:

uses
  System.Generics.Collections, Data.DBXJSON, System.IOUtils,
  System.SysUtils, System.Classes;
    ...
    var
    wzorKlucz: string;
    begin
     enum := wzor.GetEnumerator;

     while enum.MoveNext do
      ...
      wzorKlucz := enum.Current.JsonString.Value; //here
      ...

How can I disable hint for this line, or what I have is not correct ?

InnerWorld
  • 585
  • 7
  • 26
  • Have you even read the hint message? It says what you have to do. – Stefan Glienke Nov 12 '15 at 09:28
  • Sorry, probably I misread Data.DBXJSON with Data.DBXPlatform – InnerWorld Nov 12 '15 at 10:53
  • Not only does the hint say what to do, but the hint has a number which leads to documentation `http://docwiki.embarcadero.com/RADStudio/en/H2443_Inline_function_'%25s'_has_not_been_expanded_because_unit_'%25s'_is_not_specified_in_USES_list_(Delphi)` A mistake that many people make is to ignore the content of messages. What you should take away from this is a renewed enthusiasm for reading error messages, trying to understand them, and looking them up in the documentation. – David Heffernan Nov 12 '15 at 11:37

1 Answers1

1

As hint says, Data.DBXPlatform is not in your uses list. Just add it there:

uses
  System.Generics.Collections, Data.DBXJSON, System.IOUtils,
  System.SysUtils, System.Classes, 
  Data.DBXPlatform;

This situation may occur if an inline function refers to a type in a unit that is not explicitly used by the function's unit. For example, this may happen if the function uses inherited to refer to methods inherited from a distant ancestor, and that ancestor's unit is not explicitly specified in the uses list of the function's unit.

If the inline function's code is to be expanded, then the unit that calls the function must explicitly use the unit where the ancestor type is exposed.

H2443 Inline function has not been expanded

Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159