@@ -625,6 +625,7 @@ impl<'a> AnalyzeContext<'a> {
625625 parent. add_named_entity ( to_string. clone ( ) , diagnostics) ;
626626 implicit. push ( Arc :: downgrade ( & to_string) ) ;
627627 }
628+
628629 parent. add_named_entity (
629630 Arc :: new ( type_ent. clone_with_kind ( NamedEntityKind :: Type ( Type :: Array {
630631 implicit : Vec :: new ( ) ,
@@ -693,6 +694,18 @@ impl<'a> AnalyzeContext<'a> {
693694 parent. add_named_entity ( to_string. clone ( ) , diagnostics) ;
694695 implicit. push ( Arc :: downgrade ( & to_string) ) ;
695696 }
697+
698+ {
699+ let minimum = Arc :: new ( self . create_min_or_maximum ( "MINMUM" , type_ent. clone ( ) ) ) ;
700+ parent. add_named_entity ( minimum. clone ( ) , diagnostics) ;
701+ implicit. push ( Arc :: downgrade ( & minimum) ) ;
702+ }
703+
704+ {
705+ let maximum = Arc :: new ( self . create_min_or_maximum ( "MAXIMUM" , type_ent. clone ( ) ) ) ;
706+ parent. add_named_entity ( maximum. clone ( ) , diagnostics) ;
707+ implicit. push ( Arc :: downgrade ( & maximum) ) ;
708+ }
696709 parent. add_named_entity (
697710 Arc :: new (
698711 type_ent. clone_with_kind ( NamedEntityKind :: Type ( Type :: Integer ( implicit) ) ) ,
@@ -856,6 +869,40 @@ impl<'a> AnalyzeContext<'a> {
856869 )
857870 }
858871
872+ /// Create implicit MAXIMUM/MINIMUM
873+ // function MINIMUM (L, R: T) return T;
874+ // function MAXIMUM (L, R: T) return T;
875+ pub fn create_min_or_maximum ( & self , name : & str , type_ent : TypeEnt ) -> NamedEntity {
876+ let mut params = ParameterList :: default ( ) ;
877+ params. add_param ( Arc :: new ( NamedEntity :: new (
878+ self . symbol_utf8 ( "L" ) ,
879+ NamedEntityKind :: Object ( Object {
880+ class : ObjectClass :: Constant ,
881+ mode : Some ( Mode :: In ) ,
882+ subtype : Subtype :: new ( type_ent. to_owned ( ) ) ,
883+ has_default : false ,
884+ } ) ,
885+ type_ent. decl_pos ( ) ,
886+ ) ) ) ;
887+
888+ params. add_param ( Arc :: new ( NamedEntity :: new (
889+ self . symbol_utf8 ( "R" ) ,
890+ NamedEntityKind :: Object ( Object {
891+ class : ObjectClass :: Constant ,
892+ mode : Some ( Mode :: In ) ,
893+ subtype : Subtype :: new ( type_ent. to_owned ( ) ) ,
894+ has_default : false ,
895+ } ) ,
896+ type_ent. decl_pos ( ) ,
897+ ) ) ) ;
898+
899+ NamedEntity :: implicit (
900+ self . symbol_utf8 ( name) ,
901+ NamedEntityKind :: Subprogram ( Signature :: new ( params, Some ( type_ent. clone ( ) ) ) ) ,
902+ type_ent. decl_pos ( ) ,
903+ )
904+ }
905+
859906 pub fn resolve_signature (
860907 & self ,
861908 region : & Region < ' _ > ,
0 commit comments