@@ -2279,6 +2279,7 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, options: ResolveOptions) error
2279
2279
var buf : [1 ]Ast.Node.Index = undefined ;
2280
2280
const fn_proto = tree .fullFnProto (& buf , node ).? ;
2281
2281
2282
+ // TODO: should we avoid calling innermostContainer if this is a function type?
2282
2283
const container_type = options .container_type orelse try analyser .innermostContainer (handle , tree .tokenStart (fn_proto .ast .fn_token ));
2283
2284
const doc_comments = try getDocComments (analyser .arena , tree , node );
2284
2285
const name = if (fn_proto .name_token ) | t | tree .tokenSlice (t ) else null ;
@@ -3094,8 +3095,6 @@ pub const Type = struct {
3094
3095
}
3095
3096
},
3096
3097
.function = > | info | {
3097
- std .hash .autoHash (hasher , info .fn_token );
3098
- hasher .update (info .handle .uri );
3099
3098
info .container_type .hashWithHasher (hasher );
3100
3099
for (info .parameters ) | param | {
3101
3100
param .type .hashWithHasher (hasher );
@@ -3175,8 +3174,6 @@ pub const Type = struct {
3175
3174
},
3176
3175
.function = > | a_info | {
3177
3176
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 ;
3180
3177
if (! a_info .container_type .eql (b_info .container_type .* )) return false ;
3181
3178
if (a_info .parameters .len != b_info .parameters .len ) return false ;
3182
3179
for (a_info .parameters , b_info .parameters ) | a_param , b_param | {
@@ -7055,7 +7052,25 @@ fn resolvePeerTypesInner(analyser: *Analyser, peer_tys: []?Type) !?Type {
7055
7052
};
7056
7053
},
7057
7054
7058
- .func = > return null , // TODO
7055
+ .func = > {
7056
+ var opt_cur_ty : ? Type = null ;
7057
+ for (peer_tys ) | opt_ty | {
7058
+ const ty = opt_ty orelse continue ;
7059
+ const cur_ty = opt_cur_ty orelse {
7060
+ opt_cur_ty = ty ;
7061
+ continue ;
7062
+ };
7063
+ if (ty .zigTypeTag (analyser ).? != .@"fn" ) {
7064
+ return null ;
7065
+ }
7066
+ if (cur_ty .eql (ty )) {
7067
+ continue ;
7068
+ }
7069
+ // TODO: coerce function types
7070
+ return null ;
7071
+ }
7072
+ return opt_cur_ty .? ;
7073
+ },
7059
7074
7060
7075
.enum_or_union = > return null , // TODO
7061
7076
0 commit comments