Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file reserr.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310moduleW=Ortac_core.Warningstypeinit_state_error=|Mismatch_number_of_argumentsofstring|No_appropriate_specificationsofstring*stringlist|No_specificationofstring|No_translatable_specificationofstring|Not_a_function_callofstring|Not_returning_sutofstring|Qualified_nameofstringtypeW.kind+=|Constant_valueofstring|Empty_cmd_type|Ensures_not_found_for_next_stateof(string*string)|Functional_argumentofstring|Ghost_valuesof(string*[`Arg|`Ret])|Ignored_modifies|Impossible_init_state_generationofinit_state_error|Impossible_term_substitutionof[`Never|`New|`Old|`NotModel|`OutOfScope]|Incompatible_sutofstring|Incompatible_typeof(string*string)|Incomplete_ret_val_computationofstring|Incomplete_configuration_moduleof[`Init_sut|`Sut]|Multiple_sut_argumentsofstring|No_configuration_fileofstring|No_init_functionofstring|No_modelsofstring|No_specofstring|No_sut_typeofstring|Not_a_structureofstring|Returned_tupleofstring|Returning_sutofstring|Sut_type_not_specifiedofstring|Sut_type_not_supportedofstring|Syntax_error_in_config_moduleofstring|Tuple_arityofstring|Type_not_supportedofstring|Type_not_supported_for_sut_parameterofstring|Type_parameter_not_instantiatedofstringletlevelkind=matchkindwith|Constant_value_|Ensures_not_found_for_next_state_|Functional_argument_|Ghost_values_|Ignored_modifies|Impossible_term_substitution_|Incompatible_type_|Incomplete_ret_val_computation_|Multiple_sut_arguments_|No_spec_|Returned_tuple_|Returning_sut_|Tuple_arity_|Type_not_supported_->W.Warning|Empty_cmd_type|Impossible_init_state_generation_|Incompatible_sut_|Incomplete_configuration_module_|No_configuration_file_|No_init_function_|No_models_|No_sut_type_|Not_a_structure_|Sut_type_not_specified_|Sut_type_not_supported_|Syntax_error_in_config_module_|Type_not_supported_for_sut_parameter_|Type_parameter_not_instantiated_->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"|Empty_cmd_type->pfppf"The generated cmd type is empty"|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"|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"|Ignored_modifies->pfppf"Skipping unsupported modifies clause:@ %a"text"expected \"modifies x\" or \"modifies x.model\" where x is the SUT"|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|Multiple_sut_argumentsid->pfppf"Skipping %s:@ %a"idtext"functions with multiple SUT arguments cannot be tested"|No_specfct->pfppf"Skipping %s:@ %a"fcttext"functions without specifications cannot be tested"|Returned_tuplef->pfppf"Skipping %s:@ %a"ftext"functions returning tuples are not supported yet"|Returning_sutid->pfppf"Skipping %s:@ %a"idtext"functions returning a SUT value 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|Tuple_arityfct->pfppf"Skipping %s:@ %a"fcttext"Can only test tuples with arity < 10"(* 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 *)|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"|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_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_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_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(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"|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_configuration_modulemissing->letwhat=matchmissingwith|`Init_sut->"the init_sut value declaration"|`Sut->"the sut type declaration"inpfppf"Incomplete configuration module: it is missing %s"what|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|No_configuration_filefile->pfppf"Missing configuration file %s"file|No_init_functionf->pfppf"Function %s not declared in the module"f|No_modelsty->pfppf"Missing model(s) for the SUT type %s"ty|No_sut_typety->pfppf"Type %s not declared in the module"ty|Not_a_structuremod_name->pfppf"Unsupported %s module definition:@ %a"mod_nametext"only structures are allowed as module definition here"|Sut_type_not_specifiedty->pfppf"Missing specification for the SUT type %s"ty|Sut_type_not_supportedty->pfppf"Unsupported SUT type %s:@ %a"tytext"SUT type must be a type constructor, possibly applied to type \
arguments"|Syntax_error_in_config_modules->pfppf"Syntax error in OCaml configuration module %s"s|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"|Type_parameter_not_instantiatedty->pfppf"Unsupported type parameter %s:@ %a"tytext"SUT type should be fully instantiated"|_->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_errserrsinokNoneletrecfold_left(f:'a->'b->'areserr)(acc:'a):'blist->'areserr=function|[]->okacc|x::xs->(matchfaccxwith|(Ok_,_)asacc->let*acc=accinfold_leftfaccxs|Errorerrs,ws->let*_=warnswsand*_=filter_errserrsinfold_leftfaccxs)letof_option~default=Option.fold~none:(errordefault)~some:okletto_option=functionOkx,_->Somex|_->Noneletmapfl=List.mapfl|>promoteletconcat_mapfl=fmapList.concat(mapfl)