Fatal: bug: uncaught EInvalidCast: Invalid type cast
Original Reporter info from Mantis: henrique @henriquewerlang
-
Reporter name: henrique
Original Reporter info from Mantis: henrique @henriquewerlang
- Reporter name: henrique
Description:
In the project I'm working on, after I apply the fix I made in bu #37842 (closed), 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
#1 SYSUTILS_$$_RUNERRORTOEXCEPT$LONGINT$POINTER$POINTER at :0
#2 SYSTEM_$$_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER at :0
#3 SYSTEM_$$_HANDLEERRORADDRFRAMEIND$LONGINT$POINTER$POINTER at :0
#4 ?? at :0
#5 CHECKSPECIALIZED(0x7b5d7b8, 0x7b6fdb8, 0x19df74) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:29736
#6 TPASRESOLVER__CHECKCLASSISCLASS(0x86013d0, 0xa7662e8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:29811
#7 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
#8 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
#9 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
#10 TPASRESOLVER__CHECKTYPECAST(0xa7662e8, 0xae15e28, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:26728
#11 TPASRESOLVER__RESOLVEFUNCPARAMSEXPRNAME(0xae15cc8, 0xadfa030, 0xae15e28, RRAREAD, 0xadf9f3c 'TList', <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:11003
#12 TPASRESOLVER__RESOLVENAMEEXPR(0xae15cc8, 0xadf9f3c 'TList', RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10170
#13 TPAS2JSRESOLVER__RESOLVENAMEEXPR(0xae15cc8, 0xadf9f3c 'TList', RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\fppas2js.pp:3963
#14 TPASRESOLVER__RESOLVEEXPR(0xae15cc8, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10087
#15 TPASRESOLVER__RESOLVEINLINESPECIALIZEEXPR(0xae15d78, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:11531
#16 TPASRESOLVER__RESOLVEFUNCPARAMSEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10750
#17 TPAS2JSRESOLVER__RESOLVEFUNCPARAMSEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\fppas2js.pp:3982
#18 TPASRESOLVER__RESOLVEPARAMSEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10681
#19 TPASRESOLVER__RESOLVEEXPR(0xae15e28, RRAREAD, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:10100
#20 TPASRESOLVER__RESOLVEIMPLASSIGN(0xae15ab8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:9935
#21 TPASRESOLVER__RESOLVEIMPLELEMENT(0xae15ab8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:9513
#22 TPASRESOLVER__RESOLVEIMPLBLOCK(0xad8cdd8, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:9500
#23 TPASRESOLVER__FINISHPROCEDURE(0xac93c28, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:6826
#24 TPASRESOLVER__FINISHSCOPE(STPROCEDURE, 0xac93c28, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pasresolver.pp:21562
#25 TPASPARSER__ADDPROCORFUNCTION(0xac92638, 0xac93c28, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:2984
#26 TPASPARSER__PARSEDECLARATIONS(0xac92638, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3577
#27 TPASPARSER__PARSEIMPLEMENTATION(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3356
#28 TPASPARSER__PARSEDECLARATIONS(0x57bd820, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3518
#29 TPASPARSER__PARSECONTINUE(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\fcl-passrc\src\pparser.pp:3170
#30 TPAS2JSCOMPILERFILE__READCONTINUE(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:1493
#31 TPAS2JSCOMPILER__PROCESSQUEUE(<error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:2094
#32 TPAS2JSCOMPILER__COMPILE(44104.378045810183, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:2026
#33 TPAS2JSCOMPILER__RUN(0x0, 0xace73c 'C:\Projetos\ATSLog Novo\C'..., 0xabeb70, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jscompiler.pp:4545
#34 TLIBRARYPAS2JSCOMPILER__LIBRARYRUN(0x403d10 '', 0x272235c 'C:\Projetos\ATSLog Novo\C'..., 0x270c6e8, true, <error reading variable>) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jslibcompiler.pp:262
#35 RUNPAS2JSCOMPILER(0xa9e6e0, 0x403d10 '', 0x272235c 'C:\Projetos\ATSLog Novo\C'..., 0x270c6e8, true) at C:\FPCNovo\fpcsrc\packages\pastojs\src\pas2jslibcompiler.pp:338
#36 _dbk_fcall_wrapper at :0
#37 _dbk_fcall_wrapper at :0
Mantis conversion info:
- Mantis ID: 37845
- OS: Windows
- OS Build: 10
- Platform: Pas2Js
- Fixed in revision: 47039, 47051