@@ -142,7 +142,15 @@ impl TypedIntrinsicFunctionKind {
142142 return err ( warnings, errors) ;
143143 }
144144 let targ = type_arguments[ 0 ] . clone ( ) ;
145- let initial_type_id = insert_type ( to_typeinfo ( targ. type_id , & targ. span ) . unwrap ( ) ) ;
145+ let initial_type_info = check ! (
146+ CompileResult :: from(
147+ to_typeinfo( targ. type_id, & targ. span) . map_err( CompileError :: from)
148+ ) ,
149+ TypeInfo :: ErrorRecovery ,
150+ warnings,
151+ errors
152+ ) ;
153+ let initial_type_id = insert_type ( initial_type_info) ;
146154 let type_id = check ! (
147155 ctx. resolve_type_with_self(
148156 initial_type_id,
@@ -177,7 +185,15 @@ impl TypedIntrinsicFunctionKind {
177185 return err ( warnings, errors) ;
178186 }
179187 let targ = type_arguments[ 0 ] . clone ( ) ;
180- let initial_type_id = insert_type ( to_typeinfo ( targ. type_id , & targ. span ) . unwrap ( ) ) ;
188+ let initial_type_info = check ! (
189+ CompileResult :: from(
190+ to_typeinfo( targ. type_id, & targ. span) . map_err( CompileError :: from)
191+ ) ,
192+ TypeInfo :: ErrorRecovery ,
193+ warnings,
194+ errors
195+ ) ;
196+ let initial_type_id = insert_type ( initial_type_info) ;
181197 let type_id = check ! (
182198 ctx. resolve_type_with_self(
183199 initial_type_id,
@@ -232,7 +248,14 @@ impl TypedIntrinsicFunctionKind {
232248 ) ;
233249
234250 // Check for supported argument types
235- let arg_ty = to_typeinfo ( lhs. return_type , & lhs. span ) . unwrap ( ) ;
251+ let arg_ty = check ! (
252+ CompileResult :: from(
253+ to_typeinfo( lhs. return_type, & lhs. span) . map_err( CompileError :: from)
254+ ) ,
255+ TypeInfo :: ErrorRecovery ,
256+ warnings,
257+ errors
258+ ) ;
236259 let is_valid_arg_ty = matches ! ( arg_ty, TypeInfo :: UnsignedInteger ( _) )
237260 || matches ! ( arg_ty, TypeInfo :: Boolean ) ;
238261 if !is_valid_arg_ty {
@@ -307,8 +330,16 @@ impl TypedIntrinsicFunctionKind {
307330 ) ;
308331
309332 // Make sure that the index argument is a `u64`
333+ let index_type_info = check ! (
334+ CompileResult :: from(
335+ to_typeinfo( index. return_type, & index. span) . map_err( CompileError :: from)
336+ ) ,
337+ TypeInfo :: ErrorRecovery ,
338+ warnings,
339+ errors
340+ ) ;
310341 if !matches ! (
311- to_typeinfo ( index . return_type , & index . span ) . unwrap ( ) ,
342+ index_type_info ,
312343 TypeInfo :: UnsignedInteger ( IntegerBits :: SixtyFour )
313344 ) {
314345 errors. push ( CompileError :: IntrinsicUnsupportedArgType {
@@ -319,8 +350,17 @@ impl TypedIntrinsicFunctionKind {
319350 }
320351
321352 // Make sure that the tx field ID is a `u64`
353+ let tx_field_type_info = check ! (
354+ CompileResult :: from(
355+ to_typeinfo( tx_field_id. return_type, & tx_field_id. span)
356+ . map_err( CompileError :: from)
357+ ) ,
358+ TypeInfo :: ErrorRecovery ,
359+ warnings,
360+ errors
361+ ) ;
322362 if !matches ! (
323- to_typeinfo ( tx_field_id . return_type , & tx_field_id . span ) . unwrap ( ) ,
363+ tx_field_type_info ,
324364 TypeInfo :: UnsignedInteger ( IntegerBits :: SixtyFour )
325365 ) {
326366 errors. push ( CompileError :: IntrinsicUnsupportedArgType {
@@ -331,7 +371,15 @@ impl TypedIntrinsicFunctionKind {
331371 }
332372
333373 let targ = type_arguments[ 0 ] . clone ( ) ;
334- let initial_type_id = insert_type ( to_typeinfo ( targ. type_id , & targ. span ) . unwrap ( ) ) ;
374+ let initial_type_info = check ! (
375+ CompileResult :: from(
376+ to_typeinfo( targ. type_id, & targ. span) . map_err( CompileError :: from)
377+ ) ,
378+ TypeInfo :: ErrorRecovery ,
379+ warnings,
380+ errors
381+ ) ;
382+ let initial_type_id = insert_type ( initial_type_info) ;
335383 let type_id = check ! (
336384 ctx. resolve_type_with_self(
337385 initial_type_id,
@@ -376,8 +424,15 @@ impl TypedIntrinsicFunctionKind {
376424 warnings,
377425 errors
378426 ) ;
379- let copy_ty = to_typeinfo ( exp. return_type , & span) . unwrap ( ) . is_copy_type ( ) ;
380- if copy_ty {
427+ let copy_type_info = check ! (
428+ CompileResult :: from(
429+ to_typeinfo( exp. return_type, & span) . map_err( CompileError :: from)
430+ ) ,
431+ TypeInfo :: ErrorRecovery ,
432+ warnings,
433+ errors
434+ ) ;
435+ if copy_type_info. is_copy_type ( ) {
381436 errors. push ( CompileError :: IntrinsicUnsupportedArgType {
382437 name : kind. to_string ( ) ,
383438 span,
@@ -415,7 +470,14 @@ impl TypedIntrinsicFunctionKind {
415470 warnings,
416471 errors
417472 ) ;
418- let key_ty = to_typeinfo ( exp. return_type , & span) . unwrap ( ) ;
473+ let key_ty = check ! (
474+ CompileResult :: from(
475+ to_typeinfo( exp. return_type, & span) . map_err( CompileError :: from)
476+ ) ,
477+ TypeInfo :: ErrorRecovery ,
478+ warnings,
479+ errors
480+ ) ;
419481 if key_ty != TypeInfo :: B256 {
420482 errors. push ( CompileError :: IntrinsicUnsupportedArgType {
421483 name : kind. to_string ( ) ,
@@ -461,7 +523,14 @@ impl TypedIntrinsicFunctionKind {
461523 warnings,
462524 errors
463525 ) ;
464- let key_ty = to_typeinfo ( key_exp. return_type , & span) . unwrap ( ) ;
526+ let key_ty = check ! (
527+ CompileResult :: from(
528+ to_typeinfo( key_exp. return_type, & span) . map_err( CompileError :: from)
529+ ) ,
530+ TypeInfo :: ErrorRecovery ,
531+ warnings,
532+ errors
533+ ) ;
465534 if key_ty != TypeInfo :: B256 {
466535 errors. push ( CompileError :: IntrinsicUnsupportedArgType {
467536 name : kind. to_string ( ) ,
@@ -485,8 +554,15 @@ impl TypedIntrinsicFunctionKind {
485554 let mut ctx = ctx
486555 . with_help_text ( "" )
487556 . with_type_annotation ( insert_type ( TypeInfo :: Unknown ) ) ;
488- let initial_type_id =
489- insert_type ( to_typeinfo ( targ. type_id , & targ. span ) . unwrap ( ) ) ;
557+ let initial_type_info = check ! (
558+ CompileResult :: from(
559+ to_typeinfo( targ. type_id, & targ. span) . map_err( CompileError :: from)
560+ ) ,
561+ TypeInfo :: ErrorRecovery ,
562+ warnings,
563+ errors
564+ ) ;
565+ let initial_type_id = insert_type ( initial_type_info) ;
490566 let type_id = check ! (
491567 ctx. resolve_type_with_self(
492568 initial_type_id,
@@ -572,7 +648,14 @@ impl TypedIntrinsicFunctionKind {
572648 ) ;
573649
574650 // Check for supported argument types
575- let arg_ty = to_typeinfo ( lhs. return_type , & lhs. span ) . unwrap ( ) ;
651+ let arg_ty = check ! (
652+ CompileResult :: from(
653+ to_typeinfo( lhs. return_type, & lhs. span) . map_err( CompileError :: from)
654+ ) ,
655+ TypeInfo :: ErrorRecovery ,
656+ warnings,
657+ errors
658+ ) ;
576659 let is_valid_arg_ty = matches ! ( arg_ty, TypeInfo :: UnsignedInteger ( _) ) ;
577660 if !is_valid_arg_ty {
578661 errors. push ( CompileError :: IntrinsicUnsupportedArgType {
0 commit comments