@@ -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 ;
@@ -3094,8 +3095,6 @@ pub const Type = struct {
30943095 }
30953096 },
30963097 .function = > | info | {
3097- std .hash .autoHash (hasher , info .fn_token );
3098- hasher .update (info .handle .uri );
30993098 info .container_type .hashWithHasher (hasher );
31003099 for (info .parameters ) | param | {
31013100 param .type .hashWithHasher (hasher );
@@ -3175,8 +3174,6 @@ pub const Type = struct {
31753174 },
31763175 .function = > | a_info | {
31773176 const b_info = b .function ;
3178- if (a_info .fn_token != b_info .fn_token ) return false ;
3179- if (! std .mem .eql (u8 , a_info .handle .uri , b_info .handle .uri )) return false ;
31803177 if (! a_info .container_type .eql (b_info .container_type .* )) return false ;
31813178 if (a_info .parameters .len != b_info .parameters .len ) return false ;
31823179 for (a_info .parameters , b_info .parameters ) | a_param , b_param | {
@@ -7014,7 +7011,25 @@ fn resolvePeerTypesInner(analyser: *Analyser, peer_tys: []?Type) !?Type {
70147011 };
70157012 },
70167013
7017- .func = > return null , // TODO
7014+ .func = > {
7015+ var opt_cur_ty : ? Type = null ;
7016+ for (peer_tys ) | opt_ty | {
7017+ const ty = opt_ty orelse continue ;
7018+ const cur_ty = opt_cur_ty orelse {
7019+ opt_cur_ty = ty ;
7020+ continue ;
7021+ };
7022+ if (ty .zigTypeTag (analyser ).? != .@"fn" ) {
7023+ return null ;
7024+ }
7025+ if (cur_ty .eql (ty )) {
7026+ continue ;
7027+ }
7028+ // TODO: coerce function types
7029+ return null ;
7030+ }
7031+ return opt_cur_ty .? ;
7032+ },
70187033
70197034 .enum_or_union = > return null , // TODO
70207035
0 commit comments