@@ -6217,21 +6217,23 @@ int DaoInferencer_DoInference( DaoInferencer *self )
62176217 break ;
62186218 case DVM_SETVH_BB : case DVM_SETVH_II : case DVM_SETVH_FF : case DVM_SETVH_CC :
62196219 tp = typeVH [opc ] + opb ;
6220- if ( * tp == NULL || (* tp )-> tid == DAO_UDT ){
6221- GC_Assign ( tp , types [opa ] );
6220+ if ( at -> tid <= DAO_ENUM ) at = DaoType_GetBaseType ( at );
6221+ if ( * tp == NULL || (* tp )-> tid == DAO_UDT || (* tp )-> tid == DAO_THT ){
6222+ GC_Assign ( tp , at );
62226223 }
62236224 TT1 = DAO_BOOLEAN + (code - DVM_SETVH_BB );
6224- AssertTypeMatching ( types [ opa ] , * tp , defs );
6225+ AssertTypeMatching ( at , * tp , defs );
62256226 AssertTypeIdMatching ( at , TT1 );
62266227 AssertTypeIdMatching ( tp [0 ], TT1 );
62276228 break ;
62286229 case DVM_SETVS_BB : case DVM_SETVS_II : case DVM_SETVS_FF : case DVM_SETVS_CC :
62296230 var = body -> upValues -> items .pVar [opb ];
6230- if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT ){
6231+ if ( at -> tid <= DAO_ENUM ) at = DaoType_GetBaseType ( at );
6232+ if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT || var -> dtype -> tid == DAO_THT ){
62316233 DaoVariable_SetType ( var , at );
62326234 }
62336235 TT1 = DAO_BOOLEAN + (code - DVM_SETVS_BB );
6234- AssertTypeMatching ( types [ opa ] , var -> dtype , defs );
6236+ AssertTypeMatching ( at , var -> dtype , defs );
62356237 AssertTypeIdMatching ( at , TT1 );
62366238 AssertTypeIdMatching ( var -> dtype , TT1 );
62376239 break ;
@@ -6242,21 +6244,22 @@ int DaoInferencer_DoInference( DaoInferencer *self )
62426244 if ( !(routine -> attribs & DAO_ROUT_INITOR ) ) goto ModifyConstant ;
62436245 at = DaoType_GetInvarType ( at );
62446246 }
6245- if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT ){
6247+ if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT || var -> dtype -> tid == DAO_THT ){
62466248 DaoVariable_SetType ( var , at );
62476249 }
62486250 TT1 = DAO_BOOLEAN + (code - DVM_SETVO_BB );
6249- AssertTypeMatching ( types [ opa ] , var -> dtype , defs );
6251+ AssertTypeMatching ( at , var -> dtype , defs );
62506252 AssertTypeIdMatching ( at , TT1 );
62516253 AssertTypeIdMatching ( var -> dtype , TT1 );
62526254 break ;
62536255 case DVM_SETVK_BB : case DVM_SETVK_II : case DVM_SETVK_FF : case DVM_SETVK_CC :
62546256 var = hostClass -> variables -> items .pVar [opb ];
6255- if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT ){
6257+ if ( at -> tid <= DAO_ENUM ) at = DaoType_GetBaseType ( at );
6258+ if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT || var -> dtype -> tid == DAO_THT ){
62566259 DaoVariable_SetType ( var , at );
62576260 }
62586261 TT1 = DAO_BOOLEAN + (code - DVM_SETVK_BB );
6259- AssertTypeMatching ( types [ opa ] , var -> dtype , defs );
6262+ AssertTypeMatching ( at , var -> dtype , defs );
62606263 AssertTypeIdMatching ( at , TT1 );
62616264 AssertTypeIdMatching ( var -> dtype , TT1 );
62626265 break ;
@@ -6265,11 +6268,12 @@ int DaoInferencer_DoInference( DaoInferencer *self )
62656268 if ( !(opc & 0x4 ) && var -> dtype && var -> dtype -> invar ) goto ModifyConstant ;
62666269 if ( (opc >> 1 ) == 0x3 ) at = DaoType_GetInvarType ( at );
62676270 if ( (opc & 0x4 ) == 0 && at -> konst == 1 ) at = DaoType_GetBaseType ( at );
6268- if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT ){
6271+ if ( at -> tid <= DAO_ENUM ) at = DaoType_GetBaseType ( at );
6272+ if ( var -> dtype == NULL || var -> dtype -> tid == DAO_UDT || var -> dtype -> tid == DAO_THT ){
62696273 DaoVariable_SetType ( var , at );
62706274 }
62716275 TT1 = DAO_BOOLEAN + (code - DVM_SETVG_BB );
6272- AssertTypeMatching ( types [ opa ] , var -> dtype , defs );
6276+ AssertTypeMatching ( at , var -> dtype , defs );
62736277 AssertTypeIdMatching ( at , TT1 );
62746278 AssertTypeIdMatching ( var -> dtype , TT1 );
62756279 break ;
0 commit comments