Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file reserr.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284moduleW=Ortac_core.Warningstypeinit_state_error=|Not_a_function_callofstring|No_specificationofstring|No_appropriate_specificationsofstring*stringlist|No_translatable_specificationofstring|Not_returning_sutofstring|Qualified_nameofstring|Mismatch_number_of_argumentsofstringtypeW.kind+=|Constant_valueofstring|Returning_sutofstring|No_sut_argumentofstring|Multiple_sut_argumentsofstring|No_sut_typeofstring|No_init_functionofstring|Syntax_error_in_typeofstring|Syntax_error_in_init_sutofstring|Sut_type_not_supportedofstring|Type_parameter_not_instantiatedofstring|Type_not_supported_for_sut_parameterofstring|Incompatible_typeof(string*string)|Sut_type_not_specifiedofstring|No_modelsofstring|No_specofstring|Impossible_term_substitutionof[`Never|`New|`Old|`NotModel|`OutOfScope]|Ignored_modifies|Ensures_not_found_for_next_stateof(string*string)|Type_not_supportedofstring|Impossible_init_state_generationofinit_state_error|Functional_argumentofstring|Returned_tupleofstring|Ghost_valuesof(string*[`Arg|`Ret])|Incompatible_sutofstring|Incomplete_ret_val_computationofstringletlevelkind=matchkindwith|Constant_value_|Returning_sut_|No_sut_argument_|Multiple_sut_arguments_|Incompatible_type_|No_spec_|Impossible_term_substitution_|Ignored_modifies|Ensures_not_found_for_next_state_|Type_not_supported_|Functional_argument_|Returned_tuple_|Ghost_values_|Incomplete_ret_val_computation_->W.Warning|No_sut_type_|No_init_function_|Syntax_error_in_type_|Sut_type_not_supported_|Type_not_supported_for_sut_parameter_|Syntax_error_in_init_sut_|Type_parameter_not_instantiated_|Sut_type_not_specified_|No_models_|Impossible_init_state_generation_|Incompatible_sut_->W.Error|_->W.levelkindtype'areserr=('a,W.tlist)result*W.tlistletokx=(Result.okx,[])leterrore=(Result.error[e],[])letwarnsws=(Result.ok(),ws)letwarnw=warns[w]let(let*)xf=matchxwith|Okv,warns1->letres,warns2=fvin(res,warns1@warns2)|(Error_,_)asx->xlet(>>=)=(let*)let(and*)(a,aw)(b,bw)=letr=match(a,b)with|Errore0,Errore1->Error(e0@e1)|Errore,_|_,Errore->Errore|Oka,Okb->Ok(a,b)in(r,aw@bw)letfmapfr=let*r=rinok(fr)let(<$>)=fmapletappfr=let*f=fand*r=rinok(fr)let(<*>)=appletpp_kindppfkind=letopenFmtinmatchkindwith(* Warnings *)|Constant_valueid->pfppf"Skipping %s:@ %a"idtext"constants cannot be tested"|Returning_sutid->pfppf"Skipping %s:@ %a"idtext"functions returning a SUT value cannot be tested"|No_sut_argumentid->pfppf"Skipping %s:@ %a"idtext"functions with no SUT argument cannot be tested"|Multiple_sut_argumentsid->pfppf"Skipping %s:@ %a"idtext"functions with multiple SUT arguments cannot be tested"|Incompatible_type(v,t)->pfppf"Skipping %s:@ %a%s"vtext"the type of its SUT-type argument is incompatible with the configured \
SUT type: "t|No_specfct->pfppf"Skipping %s:@ %a"fcttext"functions without specifications cannot be tested"|Impossible_term_substitutionwhy->letmsg=matchwhywith|`NotModel->"occurrences of the SUT in clauses are only supported to access \
its model fields"(* The [`Never] case is used when generating [init_state] *)|`Never->"impossible to define the initial value of the model with a \
recursive expression"(* The following cases should not be reported to the user at the moment
(because they should be caught at some other points) *)|`Old->"occurrences of the SUT in clauses are not supported under old \
operator"|`New->"occurrences of the SUT in clauses are not supported above old \
operator"|`OutOfScope->"occurrences of returned values that are out of scope in the \
next_state function"inpfppf"Skipping clause:@ %a"textmsg|Ignored_modifies->pfppf"Skipping unsupported modifies clause:@ %a"text"expected \"modifies x\" or \"modifies x.model\" where x is the SUT"|Ensures_not_found_for_next_state(f,m)->pfppf"Skipping %s:@ model@ %s %a@;%a%s%a"fmtext"is declared as modified by the function but no suitable ensures \
clause was found."text"Specifications should contain at least one \"ensures x."mtext" = expr\" where x is the SUT and expr can refer to the SUT only under \
an old operator and can't refer to the returned value"|Functional_argumentf->pfppf"Skipping %s:@ %a"ftext"functions are not supported yet as arguments"|Returned_tuplef->pfppf"Skipping %s:@ %a"ftext"functions returning tuples are not supported yet"|Ghost_values(id,k)->pfppf"Skipping %s:@ %a%a%a"idtext"functions with a ghost "text(matchkwith`Arg->"argument"|`Ret->"returned value")text" are not supported"(* This following message is broad and used in seemingly different contexts
but in fact we support all the types that the Gospel type-checker supports,
so that error message should never get reported to the end user *)|Type_not_supportedty->pfppf"Type %s not supported"ty(* Errors *)|No_sut_typety->pfppf"Type %s not declared in the module"ty|No_init_functionf->pfppf"Function %s not declared in the module"f|Syntax_error_in_typet->pfppf"Syntax error in type %s"t|Syntax_error_in_init_suts->pfppf"Syntax error in OCaml expression %s"s|Sut_type_not_supportedty->pfppf"Unsupported SUT type %s:@ %a"tytext"SUT type must be a type constructor, possibly applied to type \
arguments"|Type_parameter_not_instantiatedty->pfppf"Unsupported type parameter %s:@ %a"tytext"SUT type should be fully instantiated"|Type_not_supported_for_sut_parameterty->pfppf"Unsupported type parameter %s:@ %a"tytext"only constructors and tuples are supported in arguments for the SUT \
type"|Sut_type_not_specifiedty->pfppf"Missing specification for the SUT type %s"ty|No_modelsty->pfppf"Missing model(s) for the SUT type %s"ty|Impossible_init_state_generation(Not_a_function_callfct)->pfppf"Unsupported INIT expression %s:@ %a"fcttext"the INIT expression is expected to be a function call (the \
specification of that function is required to initialize the model \
state)"|Impossible_init_state_generation(No_specificationfct)->pfppf"Unsupported INIT function %s:@ %a"fcttext"the function called in the INIT expression must be specified to \
initialize the model state"|Impossible_init_state_generation(No_appropriate_specifications(fct,models))->pfppf"Unsupported INIT function %s:@ %a:@ %a"fcttext"the specification of the function called in the INIT expression does \
not specify the following fields of the model"(Fmt.list~sep:(Fmt.any",@ ")Fmt.string)models|Impossible_init_state_generation(No_translatable_specificationmodel)->pfppf"Unsupported INIT function:@ %a:@ %s"text"the specification of the function called in the INIT expression does \
not provide a translatable specification for the following field of \
the model"model|Impossible_init_state_generation(Not_returning_sutfct)->pfppf"Unsupported INIT expression %s:@ %a"fcttext"the function called in the INIT expression must return a value of SUT \
type"|Impossible_init_state_generation(Qualified_namefct)->pfppf"Unsupported INIT function %s:@ %a"fcttext"qualified names are not yet supported"|Impossible_init_state_generation(Mismatch_number_of_argumentsfct)->pfppf"Error in INIT expression %s:@ %a"fcttext"mismatch in the number of arguments between the INIT expression and \
the function specification"|Incompatible_sutt->pfppf"Incompatible declaration of SUT type:@ %a%s"text"the declaration of the SUT type is incompatible with the configured \
one: "t|Incomplete_ret_val_computationfct->pfppf"Incomplete computation of the returned value in the specification of \
%s. Failure message won't be able to display the expected returned \
value"fct|_->W.pp_kindppfkindletpp_errors=W.pp_parampp_kindlevel|>Fmt.listletppquietpp_okppfr=letopenFmtinmatchrwith|Oka,warns->(pfppf"(* This file is generated by ortac qcheck-stm,@\n\
\ edit how you run the tool instead *)@\n\
%a@."pp_oka;ifnotquietthenmatchwarnswith[]->()|warns->pfstderr"%a@."pp_errorswarns)|Errorerrs,warns->pfstderr"%a@."pp_errors(errs@warns)letsequencer=letrecaux=function|[]->ok[]|((Ok_,_)asx)::xs->let*y=xand*ys=auxxsinok(y::ys)|((Error_,_)asx)::_->xinauxrletrecfilter_errs=function|[]->ok()|((k,_)ase)::es->(matchlevelkwith|W.Warning->let*_=warneinfilter_errses|W.Error->errore)letrecpromote=function|[]->ok[]|((Ok_,_)asx)::xs->let*y=xand*ys=promotexsinok(y::ys)|(Errorerrs,ws)::xs->let*_=warnswsand*_=filter_errserrsinpromotexsletpromote_optr=matchrwith|(Ok_,_)asx->let*y=xinok(Somey)|Errorerrs,ws->let*_=warnswsand*_=filter_errserrsinokNoneletof_option~default=Option.fold~none:(errordefault)~some:okletto_option=functionOkx,_->Somex|_->Noneletmapfl=List.mapfl|>promoteletconcat_mapfl=fmapList.concat(mapfl)