@@ -4045,10 +4045,14 @@ impl Context {
40454045 Immutable ,
40464046 Visibility :: BUILTIN_PRIVATE ,
40474047 ) ;
4048- let mut g_generator = Self :: builtin_mono_class ( GENERIC_GENERATOR , 2 ) ;
4049- g_generator. register_superclass ( mono ( SUBROUTINE ) , & subr) ;
4050- let t_yield = fn1_met ( mono ( GENERIC_GENERATOR ) , Obj , Never ) . quantify ( ) ;
4051- g_generator. register_builtin_erg_impl (
4048+ let generator_t = poly ( GENERATOR , vec ! [ ty_tp( T . clone( ) ) ] ) ;
4049+ let mut generator = Self :: builtin_poly_class ( GENERATOR , vec ! [ PS :: t_nd( TY_T ) ] , 2 ) ;
4050+ generator. register_superclass ( mono ( SUBROUTINE ) , & subr) ;
4051+ generator
4052+ . register_trait ( self , poly ( ITERATOR , vec ! [ ty_tp( T . clone( ) ) ] ) )
4053+ . unwrap ( ) ;
4054+ let t_yield = fn1_met ( generator_t. clone ( ) , T . clone ( ) , Never ) . quantify ( ) ;
4055+ generator. register_builtin_erg_impl (
40524056 FUNC_YIELD ,
40534057 t_yield,
40544058 Immutable ,
@@ -4674,13 +4678,7 @@ impl Context {
46744678 self . register_builtin_type ( dict_mut_t, dict_mut, vis. clone ( ) , Const , Some ( DICT ) ) ;
46754679 self . register_builtin_type ( set_mut_t, set_mut_, vis. clone ( ) , Const , Some ( SET ) ) ;
46764680 self . register_builtin_type ( mono ( SUBROUTINE ) , subr, vis. clone ( ) , Const , Some ( SUBROUTINE ) ) ;
4677- self . register_builtin_type (
4678- mono ( GENERIC_GENERATOR ) ,
4679- g_generator,
4680- vis. clone ( ) ,
4681- Const ,
4682- Some ( GENERATOR ) ,
4683- ) ;
4681+ self . register_builtin_type ( generator_t, generator, vis. clone ( ) , Const , Some ( GENERATOR ) ) ;
46844682 self . register_builtin_type ( dimension_t, dimension, vis. clone ( ) , Const , Some ( DIMENSION ) ) ;
46854683 self . register_builtin_type (
46864684 mono ( BASE_EXCEPTION ) ,
0 commit comments