@@ -34,9 +34,8 @@ let findTypeViaLoc ~full ~debug (loc : Location.t) =
34
34
| Some {locType = Typed (_ , typExpr , _ )} -> Some typExpr
35
35
| _ -> None
36
36
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
40
39
| Tconstr (path, _typeArgs, _)
41
40
| Tlink {desc = Tconstr (path, _typeArgs, _)}
42
41
| Tsubst {desc = Tconstr (path, _typeArgs, _)}
@@ -238,13 +237,11 @@ let rec extractObjectType ~env ~package (t : Types.type_expr) =
238
237
| _ -> None )
239
238
| _ -> None
240
239
241
- let rec extractFunctionType ~env ~package typ =
240
+ let extractFunctionType ~env ~package typ =
242
241
let rec loop ~env acc (t : Types.type_expr ) =
243
- match t .desc with
242
+ match ( Ast_uncurried. remove_function_dollar t) .desc with
244
243
| Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) -> loop ~env acc t1
245
244
| Tarrow (label , tArg , tRet , _ , _ ) -> loop ~env ((label, tArg) :: acc) tRet
246
- | Tconstr (Pident {name = "function$" } , [t ], _ ) ->
247
- extractFunctionType ~env ~package t
248
245
| Tconstr (path , typeArgs , _ ) -> (
249
246
match References. digConstructor ~env ~package path with
250
247
| Some
@@ -277,14 +274,12 @@ let maybeSetTypeArgCtx ?typeArgContextFromTypeManifest ~typeParams ~typeArgs env
277
274
typeArgContext
278
275
279
276
(* 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 =
281
278
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
283
280
| Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) -> loop ?typeArgContext ~env acc t1
284
281
| Tarrow (label , tArg , tRet , _ , _ ) ->
285
282
loop ?typeArgContext ~env ((label, tArg) :: acc) tRet
286
- | Tconstr (Pident {name = "function$" } , [t ], _ ) ->
287
- extractFunctionType2 ?typeArgContext ~env ~package t
288
283
| Tconstr (path , typeArgs , _ ) -> (
289
284
match References. digConstructor ~env ~package path with
290
285
| Some
@@ -317,7 +312,7 @@ let rec extractType ?(printOpeningDebug = true)
317
312
Printf. printf " [extract_type]--> %s"
318
313
(debugLogTypeArgContext typeArgContext));
319
314
let instantiateType = instantiateType2 in
320
- match t .desc with
315
+ match ( Ast_uncurried. remove_function_dollar t) .desc with
321
316
| Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) ->
322
317
extractType ?typeArgContext ~print OpeningDebug:false ~env ~package t1
323
318
| Tconstr (Path. Pident {name = "option" } , [payloadTypeExpr ], _ ) ->
@@ -334,13 +329,6 @@ let rec extractType ?(printOpeningDebug = true)
334
329
Some (Tstring env, typeArgContext)
335
330
| Tconstr (Path. Pident {name = "exn" } , [] , _ ) ->
336
331
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 )
344
332
| Tarrow _ -> (
345
333
match extractFunctionType2 ?typeArgContext t ~env ~package with
346
334
| args , tRet , typeArgContext when args <> [] ->
@@ -906,11 +894,8 @@ let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested =
906
894
let getArgs ~env (t : Types.type_expr ) ~full =
907
895
let rec getArgsLoop ~env (t : Types.type_expr ) ~full ~currentArgumentPosition
908
896
=
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 , [] ) ->
914
899
getArgsLoop ~full ~env ~current ArgumentPosition t1
915
900
| Tarrow (Labelled l , tArg , tRet , _ , _ ) ->
916
901
(SharedTypes.Completable. Labelled l, tArg)
0 commit comments