@@ -308,6 +308,10 @@ impl<'a> Summary<'a> {
308308 TypeDefKind :: List ( ty) => {
309309 self . visit_type ( * ty, world) ;
310310 }
311+ TypeDefKind :: Map ( k, v) => {
312+ self . visit_type ( * k, world) ;
313+ self . visit_type ( * v, world) ;
314+ }
311315 TypeDefKind :: Type ( ty) => {
312316 // When visiting a type alias, we must use the state
313317 // already stored for any `use`d resources rather than
@@ -1127,6 +1131,10 @@ impl<'a> Summary<'a> {
11271131 TypeDefKind :: List ( ty) => {
11281132 self . sort ( * ty, sorted, visited) ;
11291133 }
1134+ TypeDefKind :: Map ( k, v) => {
1135+ self . sort ( * k, sorted, visited) ;
1136+ self . sort ( * v, sorted, visited) ;
1137+ }
11301138 TypeDefKind :: Type ( ty) => {
11311139 self . sort ( * ty, sorted, visited) ;
11321140 }
@@ -1759,6 +1767,7 @@ class {camel}(Protocol):
17591767 }
17601768 TypeDefKind :: Tuple ( _)
17611769 | TypeDefKind :: List ( _)
1770+ | TypeDefKind :: Map ( _, _)
17621771 | TypeDefKind :: Option ( _)
17631772 | TypeDefKind :: Result ( _)
17641773 | TypeDefKind :: Handle ( _) => ( None , Vec :: new ( ) ) ,
@@ -2089,7 +2098,7 @@ def {snake}_future(default: Callable[[], {camel}]) -> tuple[FutureWriter[{camel}
20892098 }
20902099
20912100 let python_imports =
2092- "from typing import TypeVar, Generic, Union, Optional, Protocol, Tuple, List, Any, Self, Callable
2101+ "from typing import TypeVar, Generic, Union, Optional, Protocol, Tuple, List, Mapping, Any, Self, Callable
20932102from types import TracebackType
20942103from enum import Flag, Enum, auto
20952104from dataclasses import dataclass
@@ -2356,6 +2365,10 @@ from componentize_py_types import Result, Ok, Err, Some
23562365 TypeDefKind :: Option ( ty) | TypeDefKind :: List ( ty) | TypeDefKind :: Type ( ty) => {
23572366 self . has_imported_and_exported_resource ( * ty)
23582367 }
2368+ TypeDefKind :: Map ( k, v) => {
2369+ self . has_imported_and_exported_resource ( * k)
2370+ || self . has_imported_and_exported_resource ( * v)
2371+ }
23592372 TypeDefKind :: Resource => {
23602373 let empty = & ResourceInfo :: default ( ) ;
23612374 let info = self . resource_info . get ( & id) . unwrap_or ( empty) ;
@@ -2465,6 +2478,13 @@ impl<'a> TypeNames<'a> {
24652478 format ! ( "List[{}]" , self . type_name( * ty, seen, resource) )
24662479 }
24672480 }
2481+ TypeDefKind :: Map ( k, v) => {
2482+ format ! (
2483+ "Mapping[{}, {}]" ,
2484+ self . type_name( * k, seen, resource) ,
2485+ self . type_name( * v, seen, resource)
2486+ )
2487+ }
24682488 TypeDefKind :: Tuple ( tuple) => {
24692489 let types = tuple
24702490 . types
@@ -2565,6 +2585,9 @@ impl<'a> TypeNames<'a> {
25652585 TypeDefKind :: List ( ty) => {
25662586 format ! ( "list_{}" , self . mangle_name( * ty) )
25672587 }
2588+ TypeDefKind :: Map ( k, v) => {
2589+ format ! ( "map_{}_{}" , self . mangle_name( * k) , self . mangle_name( * v) )
2590+ }
25682591 TypeDefKind :: Tuple ( tuple) => {
25692592 let types = tuple
25702593 . types
0 commit comments