12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758(*
Do not use it yet!
converts code like
val x : int * int * int [@@noinjected]
into
val x :
(asdf, qwerty) injected ->
(asdf, qwerty) injected -> (asdf, qwerty) injected -> goal
The main issue is to select right mangling of types
*)openBaseopenPpxlibopenPpxlib.Ast_builder.DefaultopenPrintfletname="noinjected"exceptionAttrFoundofattributeletfind_good_attributeattrs=tryList.iterattrs~f:(fun({attr_name}asattr)->ifString.equalattr_name.txtnamethenraise(AttrFoundattr));NonewithAttrFoundattr->Someattrletobj=object(self)inheritAst_traverse.mapassupermethod!signature_itemss=matchss.psig_descwith|Psig_valuevd->beginmatchfind_good_attributevd.pval_attributeswith|None->ss|Someattr->Attribute.explicitly_drop#value_descriptionvd;letnew_typ=matchvd.pval_type.ptyp_descwith|Ptyp_tuplets->letloc=vd.pval_locinList.fold_rightts~init:[%type:goal]~f:(funt->ptyp_arrow~locNolabel[%type:(asdf,qwerty)injected])|_->failwith"not yet implemented"in{sswithpsig_desc=Psig_value{vdwithpval_type=new_typ}}end|_->ssendlet()=(* Format.printf "Registering `%s`\n%!" name; *)Ppxlib.Driver.register_transformation~intf:obj#signature"noinjected"