@@ -23,6 +23,7 @@ use crate::{
2323} ;
2424
2525use super :: abi_str:: AbiStrContext ;
26+ use sway_features:: ExperimentalFeatures ;
2627
2728#[ derive( Clone , Debug ) ]
2829pub enum AbiNameDiagnosticSpan {
@@ -48,6 +49,7 @@ pub struct AbiContext<'a> {
4849 pub metadata_declaration_cache : HashMap < TypeCacheKey , program_abi:: TypeMetadataDeclaration > ,
4950 pub concrete_declaration_cache : HashMap < TypeCacheKey , program_abi:: TypeConcreteDeclaration > ,
5051 pub type_cache_enabled : bool ,
52+ pub experimental : ExperimentalFeatures ,
5153}
5254
5355impl AbiContext < ' _ > {
@@ -57,6 +59,7 @@ impl AbiContext<'_> {
5759 abi_with_callpaths : self . abi_with_callpaths ,
5860 abi_with_fully_specified_types : false ,
5961 abi_root_type_without_generic_type_parameters : true ,
62+ abi_type_aliases : self . experimental . abi_type_aliases ,
6063 }
6164 }
6265}
@@ -163,6 +166,7 @@ impl TypeId {
163166 abi_with_callpaths : true ,
164167 abi_with_fully_specified_types : true ,
165168 abi_root_type_without_generic_type_parameters : false ,
169+ abi_type_aliases : ctx. experimental . abi_type_aliases ,
166170 } ;
167171 let type_str = self . get_abi_type_str ( handler, & display_ctx, engines, resolved_type_id) ?;
168172
@@ -908,7 +912,11 @@ impl TypeId {
908912 resolved_type_id : TypeId ,
909913 metadata_types_to_add : & mut Vec < program_abi:: TypeMetadataDeclaration > ,
910914 ) -> Result < Option < Vec < MetadataTypeId > > , ErrorEmitted > {
911- match self . is_generic_parameter ( engines, resolved_type_id) {
915+ match self . is_generic_parameter (
916+ engines,
917+ resolved_type_id,
918+ ctx. experimental . abi_type_aliases ,
919+ ) {
912920 true => Ok ( None ) ,
913921 false => resolved_type_id
914922 . get_type_parameters ( engines)
@@ -1247,7 +1255,11 @@ impl TypeId {
12471255 }
12481256 }
12491257 TypeInfo :: Custom { type_arguments, .. } => {
1250- if !self . is_generic_parameter ( engines, resolved_type_id) {
1258+ if !self . is_generic_parameter (
1259+ engines,
1260+ resolved_type_id,
1261+ ctx. experimental . abi_type_aliases ,
1262+ ) {
12511263 for ( v, p) in type_arguments. clone ( ) . unwrap_or_default ( ) . iter ( ) . zip (
12521264 resolved_type_id
12531265 . get_type_parameters ( engines)
0 commit comments