@@ -34,9 +34,8 @@ let findTypeViaLoc ~full ~debug (loc : Location.t) =
3434 | Some {locType = Typed (_ , typExpr , _ )} -> Some typExpr
3535 | _ -> None
3636
37- let rec pathFromTypeExpr (t : Types.type_expr ) =
38- match t.desc with
39- | Tconstr (Pident {name = "function$" } , [t ], _ ) -> pathFromTypeExpr t
37+ let pathFromTypeExpr (t : Types.type_expr ) =
38+ match (Ast_uncurried. remove_function_dollar t).desc with
4039 | Tconstr (path, _typeArgs, _)
4140 | Tlink {desc = Tconstr (path, _typeArgs, _)}
4241 | Tsubst {desc = Tconstr (path, _typeArgs, _)}
@@ -238,13 +237,11 @@ let rec extractObjectType ~env ~package (t : Types.type_expr) =
238237 | _ -> None )
239238 | _ -> None
240239
241- let rec extractFunctionType ~env ~package typ =
240+ let extractFunctionType ~env ~package typ =
242241 let rec loop ~env acc (t : Types.type_expr ) =
243- match t .desc with
242+ match ( Ast_uncurried. remove_function_dollar t) .desc with
244243 | Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) -> loop ~env acc t1
245244 | Tarrow (label , tArg , tRet , _ , _ ) -> loop ~env ((label, tArg) :: acc) tRet
246- | Tconstr (Pident {name = "function$" } , [t ], _ ) ->
247- extractFunctionType ~env ~package t
248245 | Tconstr (path , typeArgs , _ ) -> (
249246 match References. digConstructor ~env ~package path with
250247 | Some
@@ -277,14 +274,12 @@ let maybeSetTypeArgCtx ?typeArgContextFromTypeManifest ~typeParams ~typeArgs env
277274 typeArgContext
278275
279276(* TODO(env-stuff) Maybe this could be removed entirely if we can guarantee that we don't have to look up functions from in here. *)
280- let rec extractFunctionType2 ?typeArgContext ~env ~package typ =
277+ let extractFunctionType2 ?typeArgContext ~env ~package typ =
281278 let rec loop ?typeArgContext ~env acc (t : Types.type_expr ) =
282- match t .desc with
279+ match ( Ast_uncurried. remove_function_dollar t) .desc with
283280 | Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) -> loop ?typeArgContext ~env acc t1
284281 | Tarrow (label , tArg , tRet , _ , _ ) ->
285282 loop ?typeArgContext ~env ((label, tArg) :: acc) tRet
286- | Tconstr (Pident {name = "function$" } , [t ], _ ) ->
287- extractFunctionType2 ?typeArgContext ~env ~package t
288283 | Tconstr (path , typeArgs , _ ) -> (
289284 match References. digConstructor ~env ~package path with
290285 | Some
@@ -317,7 +312,7 @@ let rec extractType ?(printOpeningDebug = true)
317312 Printf. printf " [extract_type]--> %s"
318313 (debugLogTypeArgContext typeArgContext));
319314 let instantiateType = instantiateType2 in
320- match t .desc with
315+ match ( Ast_uncurried. remove_function_dollar t) .desc with
321316 | Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) ->
322317 extractType ?typeArgContext ~print OpeningDebug:false ~env ~package t1
323318 | Tconstr (Path. Pident {name = "option" } , [payloadTypeExpr ], _ ) ->
@@ -334,13 +329,6 @@ let rec extractType ?(printOpeningDebug = true)
334329 Some (Tstring env, typeArgContext)
335330 | Tconstr (Path. Pident {name = "exn" } , [] , _ ) ->
336331 Some (Texn env, typeArgContext)
337- | Tconstr (Pident {name = "function$" } , [t ], _ ) -> (
338- match extractFunctionType2 ?typeArgContext t ~env ~package with
339- | args , tRet , typeArgContext when args <> [] ->
340- Some
341- ( Tfunction {env; args; typ = t; uncurried = true ; returnType = tRet},
342- typeArgContext )
343- | _args , _tRet , _typeArgContext -> None )
344332 | Tarrow _ -> (
345333 match extractFunctionType2 ?typeArgContext t ~env ~package with
346334 | args , tRet , typeArgContext when args <> [] ->
@@ -906,11 +894,8 @@ let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested =
906894let getArgs ~env (t : Types.type_expr ) ~full =
907895 let rec getArgsLoop ~env (t : Types.type_expr ) ~full ~currentArgumentPosition
908896 =
909- match t.desc with
910- | Tlink t1
911- | Tsubst t1
912- | Tpoly (t1, [] )
913- | Tconstr (Pident {name = "function$" } , [t1 ], _ ) ->
897+ match (Ast_uncurried. remove_function_dollar t).desc with
898+ | Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) ->
914899 getArgsLoop ~full ~env ~current ArgumentPosition t1
915900 | Tarrow (Labelled l , tArg , tRet , _ , _ ) ->
916901 (SharedTypes.Completable. Labelled l, tArg)
0 commit comments