@@ -2279,6 +2279,7 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, options: ResolveOptions) error
22792279 var buf : [1 ]Ast.Node.Index = undefined ;
22802280 const fn_proto = tree .fullFnProto (& buf , node ).? ;
22812281
2282+ // TODO: should we avoid calling innermostContainer if this is a function type?
22822283 const container_type = options .container_type orelse try analyser .innermostContainer (handle , tree .tokenStart (fn_proto .ast .fn_token ));
22832284 const doc_comments = try getDocComments (analyser .arena , tree , node );
22842285 const name = if (fn_proto .name_token ) | t | tree .tokenSlice (t ) else null ;
@@ -3097,8 +3098,6 @@ pub const Type = struct {
30973098 }
30983099 },
30993100 .function = > | info | {
3100- std .hash .autoHash (hasher , info .fn_token );
3101- hasher .update (info .handle .uri );
31023101 info .container_type .hashWithHasher (hasher );
31033102 for (info .parameters ) | param | {
31043103 param .type .hashWithHasher (hasher );
@@ -3178,8 +3177,6 @@ pub const Type = struct {
31783177 },
31793178 .function = > | a_info | {
31803179 const b_info = b .function ;
3181- if (a_info .fn_token != b_info .fn_token ) return false ;
3182- if (! std .mem .eql (u8 , a_info .handle .uri , b_info .handle .uri )) return false ;
31833180 if (! a_info .container_type .eql (b_info .container_type .* )) return false ;
31843181 if (a_info .parameters .len != b_info .parameters .len ) return false ;
31853182 for (a_info .parameters , b_info .parameters ) | a_param , b_param | {
@@ -6962,7 +6959,25 @@ fn resolvePeerTypesInner(analyser: *Analyser, peer_tys: []?Type) !?Type {
69626959 };
69636960 },
69646961
6965- .func = > return null , // TODO
6962+ .func = > {
6963+ var opt_cur_ty : ? Type = null ;
6964+ for (peer_tys ) | opt_ty | {
6965+ const ty = opt_ty orelse continue ;
6966+ const cur_ty = opt_cur_ty orelse {
6967+ opt_cur_ty = ty ;
6968+ continue ;
6969+ };
6970+ if (ty .zigTypeTag (analyser ).? != .@"fn" ) {
6971+ return null ;
6972+ }
6973+ if (cur_ty .eql (ty )) {
6974+ continue ;
6975+ }
6976+ // TODO: coerce function types
6977+ return null ;
6978+ }
6979+ return opt_cur_ty .? ;
6980+ },
69666981
69676982 .enum_or_union = > return null , // TODO
69686983
0 commit comments