View Issue Details

IDProjectCategoryView StatusLast Update
0037845pas2jstranspilerpublic2020-10-05 19:05
Reporterhenrique Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPas2JsOSWindows 
Summary0037845: Fatal: bug: uncaught EInvalidCast: Invalid type cast
DescriptionIn the project I'm working on, after I apply the fix I made in bu 0037842, the error "EInvalidCast: Invalid type cast" occurs in the CheckClassIsClass function, more precisely within the checkspecialized internal function, in line 29735, in the following snippet:

        // e.g. TList<Src<...>> and TList<Dest<...>>
        SrcParamScope:=SrcParam.CustomData as TPasGenericScope;
        DestParamScope:=DestParam.CustomData as TPasGenericScope;

The conversion to type TPasGenericScope, is giving error because within the "CustomData" has a class of type TResolvedReference, in both variables.

O call stack at this moment is:

#0 fpc_raiseexception at :0
0000001 SYSUTILS_$$_RUNERRORTOEXCEPT$LONGINT$POINTER$POINTER at :0
0000002 SYSTEM_$$_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER at :0
0000003 SYSTEM_$$_HANDLEERRORADDRFRAMEIND$LONGINT$POINTER$POINTER at :0
0000004 ?? at :0
0000005 CHECKSPECIALIZED(0x7b5d7b8, 0x7b6fdb8, 0x19df74) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:29736
0000006 TPASRESOLVER__CHECKCLASSISCLASS(0x86013d0, 0xa7662e8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:29811
0000007 TPASRESOLVER__CHECKSRCISADSTTYPE({BASETYPE = BTCONTEXT, SUBTYPE = BTNONE, IDENTEL = 0x871bf18, LOTYPEEL = 0x86013d0, HITYPEEL = 0x86013d0, EXPREL = 0x0, FLAGS = [RRFREADABLE..RRFWRITABLE]}, {BASETYPE = BTCONTEXT, SUBTYPE = BTNONE, IDENTEL = 0xa7662e8, LOTYPEEL = 0xa7662e8, HITYPEEL = 0xa7662e8, EXPREL = 0x0, FLAGS = []}, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:29703
0000008 TPASRESOLVER__CHECKTYPECASTRES({BASETYPE = BTCONTEXT, SUBTYPE = BTNONE, IDENTEL = 0x871bf18, LOTYPEEL = 0x86013d0, HITYPEEL = 0x86013d0, EXPREL = 0x0, FLAGS = [RRFREADABLE..RRFWRITABLE]}, {BASETYPE = BTCONTEXT, SUBTYPE = BTNONE, IDENTEL = 0xa7662e8, LOTYPEEL = 0xa7662e8, HITYPEEL = 0xa7662e8, EXPREL = 0x0, FLAGS = []}, 0xae160e8, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:26886
0000009 TPAS2JSRESOLVER__CHECKTYPECASTRES({BASETYPE = BTCONTEXT, SUBTYPE = BTNONE, IDENTEL = 0x871bf18, LOTYPEEL = 0x86013d0, HITYPEEL = 0x86013d0, EXPREL = 0x0, FLAGS = [RRFREADABLE..RRFWRITABLE]}, {BASETYPE = BTCONTEXT, SUBTYPE = BTNONE, IDENTEL = 0xa7662e8, LOTYPEEL = 0xa7662e8, HITYPEEL = 0xa7662e8, EXPREL = 0x0, FLAGS = []}, 0xae160e8, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\fppas2js.pp:6254
0000010 TPASRESOLVER__CHECKTYPECAST(0xa7662e8, 0xae15e28, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:26728
0000011 TPASRESOLVER__RESOLVEFUNCPARAMSEXPRNAME(0xae15cc8, 0xadfa030, 0xae15e28, RRAREAD, 0xadf9f3c 'TList', <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:11003
0000012 TPASRESOLVER__RESOLVENAMEEXPR(0xae15cc8, 0xadf9f3c 'TList', RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10170
0000013 TPAS2JSRESOLVER__RESOLVENAMEEXPR(0xae15cc8, 0xadf9f3c 'TList', RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\fppas2js.pp:3963
0000014 TPASRESOLVER__RESOLVEEXPR(0xae15cc8, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10087
0000015 TPASRESOLVER__RESOLVEINLINESPECIALIZEEXPR(0xae15d78, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:11531
0000016 TPASRESOLVER__RESOLVEFUNCPARAMSEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10750
0000017 TPAS2JSRESOLVER__RESOLVEFUNCPARAMSEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\fppas2js.pp:3982
0000018 TPASRESOLVER__RESOLVEPARAMSEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10681
0000019 TPASRESOLVER__RESOLVEEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10100
0000020 TPASRESOLVER__RESOLVEIMPLASSIGN(0xae15ab8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:9935
0000021 TPASRESOLVER__RESOLVEIMPLELEMENT(0xae15ab8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:9513
0000022 TPASRESOLVER__RESOLVEIMPLBLOCK(0xad8cdd8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:9500
0000023 TPASRESOLVER__FINISHPROCEDURE(0xac93c28, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:6826
0000024 TPASRESOLVER__FINISHSCOPE(STPROCEDURE, 0xac93c28, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:21562
0000025 TPASPARSER__ADDPROCORFUNCTION(0xac92638, 0xac93c28, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:2984
0000026 TPASPARSER__PARSEDECLARATIONS(0xac92638, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3577
0000027 TPASPARSER__PARSEIMPLEMENTATION(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3356
0000028 TPASPARSER__PARSEDECLARATIONS(0x57bd820, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3518
0000029 TPASPARSER__PARSECONTINUE(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3170
0000030 TPAS2JSCOMPILERFILE__READCONTINUE(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:1493
0000031 TPAS2JSCOMPILER__PROCESSQUEUE(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:2094
0000032 TPAS2JSCOMPILER__COMPILE(44104.378045810183, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:2026
0000033 TPAS2JSCOMPILER__RUN(0x0, 0xace73c 'C:\Projetos\ATSLog Novo\C'..., 0xabeb70, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:4545
0000034 TLIBRARYPAS2JSCOMPILER__LIBRARYRUN(0x403d10 '', 0x272235c 'C:\Projetos\ATSLog Novo\C'..., 0x270c6e8, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jslibcompiler.pp:262
0000035 RUNPAS2JSCOMPILER(0xa9e6e0, 0x403d10 '', 0x272235c 'C:\Projetos\ATSLog Novo\C'..., 0x270c6e8, true) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jslibcompiler.pp:338
0000036 _dbk_fcall_wrapper at :0
0000037 _dbk_fcall_wrapper at :0
TagsNo tags attached.
Fixed in Revision47039, 47051
Attached Files

Activities

henrique

2020-10-01 20:06

reporter   ~0126027

Sample project, with the problem.
Error.zip (720 bytes)

Mattias Gaertner

2020-10-01 22:14

manager   ~0126029

First of all: Thanks for the high quality bug reports.

I'm curious, why do you use inline specializations instead of an alias?
type TDataClassList = TList<TDataClass>;

henrique

2020-10-01 22:19

reporter   ~0126030

You welcome!

I use alias when I'm going to need that statement again. If I don't always use the inline.

This project I sent, was based on the larger project that is being implemented, and there it is that way.

I hope I've been clear, I'm not native to English, so I use a translator to help me!

henrique

2020-10-05 14:20

reporter   ~0126096

The "invalid cast type cast" error keeps happening, with the example I went through.

henrique

2020-10-05 14:44

reporter   ~0126097

The committed said, solved the problem of access violation of the 0037842

henrique

2020-10-05 19:05

reporter   ~0126101

Everything working now!

Issue History

Date Modified Username Field Change
2020-09-30 14:05 henrique New Issue
2020-09-30 14:10 Michael Van Canneyt Assigned To => Mattias Gaertner
2020-09-30 14:10 Michael Van Canneyt Status new => assigned
2020-10-01 20:06 henrique Note Added: 0126027
2020-10-01 20:06 henrique File Added: Error.zip
2020-10-01 22:14 Mattias Gaertner Note Added: 0126029
2020-10-01 22:19 henrique Note Added: 0126030
2020-10-03 19:26 Mattias Gaertner Status assigned => resolved
2020-10-03 19:26 Mattias Gaertner Resolution open => fixed
2020-10-03 19:26 Mattias Gaertner Fixed in Revision => 47039.
2020-10-05 14:20 henrique Status resolved => feedback
2020-10-05 14:20 henrique Resolution fixed => open
2020-10-05 14:20 henrique Note Added: 0126096
2020-10-05 14:44 henrique Note Added: 0126097
2020-10-05 14:44 henrique Status feedback => assigned
2020-10-05 16:48 Mattias Gaertner Status assigned => resolved
2020-10-05 16:48 Mattias Gaertner Resolution open => fixed
2020-10-05 16:48 Mattias Gaertner Fixed in Revision 47039. => 47039, 47051
2020-10-05 19:05 henrique Note Added: 0126101