ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Non compilable in Delphi 2010 #283

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Code:

Unit dwsUtils.pas:

// GetObjects
//
function TSimpleNameObjectHash<T>.GetObjects(const name : String) : T;
var
   h : Cardinal;
   i : Integer;
begin
   if FCount=0 then Exit(nil); // line 2066

Output:

[DCC Error] dwsUtils.pas(2066): E2010 Incompatible types: 'T' and 'Pointer'
[DCC Error] dwsUtils.pas(2074): E2010 Incompatible types: 'T' and 'Pointer'
[DCC Error] dwsUtils.pas(2270): E2010 Incompatible types: 'TValue' and 'Pointer'
[DCC Fatal Error] dwsErrors.pas(27): F2063 Could not compile used unit 
'dwsUtils.pas'

Original issue reported on code.google.com by kazantse...@mail.ru on 29 Jun 2012 at 8:23

GoogleCodeExporter commented 8 years ago
Workaround: T(TObject(NIL))

Original comment by kazantse...@mail.ru on 30 Jun 2012 at 2:46

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r1535.

Original comment by zar...@gmail.com on 2 Jul 2012 at 6:14

GoogleCodeExporter commented 8 years ago
also other lines require workaroud:

[DCC Error] dwsUtils.pas(2075): E2010 Incompatible types: 'T' and 'Pointer'
[DCC Error] dwsUtils.pas(2271): E2010 Incompatible types: 'TValue' and 'Pointer'

Original comment by kazantse...@mail.ru on 2 Jul 2012 at 6:38

GoogleCodeExporter commented 8 years ago
Does introducing a constant like

   const cNil = T(TObject(NIL));

at the class level and reusing it work in D2010?

Original comment by zar...@gmail.com on 2 Jul 2012 at 7:11

GoogleCodeExporter commented 8 years ago

Original comment by zar...@gmail.com on 2 Jul 2012 at 7:11

GoogleCodeExporter commented 8 years ago
No, it lead to internal error:
[DCC Fatal Error] dwsUtils.pas(476): F2084 Internal Error: 
AV21F6D02B-R00000000-0

Original comment by kazantse...@mail.ru on 2 Jul 2012 at 7:59

GoogleCodeExporter commented 8 years ago
Committed further workarounds, all okay now?

Original comment by zar...@gmail.com on 2 Jul 2012 at 8:32

GoogleCodeExporter commented 8 years ago
Yes. All okay.

Original comment by kazantse...@mail.ru on 2 Jul 2012 at 8:37