@@ -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 ;
@@ -3097,8 +3098,6 @@ pub const Type = struct {
3097
3098
}
3098
3099
},
3099
3100
.function = > | info | {
3100
- std .hash .autoHash (hasher , info .fn_token );
3101
- hasher .update (info .handle .uri );
3102
3101
info .container_type .hashWithHasher (hasher );
3103
3102
for (info .parameters ) | param | {
3104
3103
param .type .hashWithHasher (hasher );
@@ -3178,8 +3177,6 @@ pub const Type = struct {
3178
3177
},
3179
3178
.function = > | a_info | {
3180
3179
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 ;
3183
3180
if (! a_info .container_type .eql (b_info .container_type .* )) return false ;
3184
3181
if (a_info .parameters .len != b_info .parameters .len ) return false ;
3185
3182
for (a_info .parameters , b_info .parameters ) | a_param , b_param | {
@@ -6967,7 +6964,25 @@ fn resolvePeerTypesInner(analyser: *Analyser, peer_tys: []?Type) !?Type {
6967
6964
};
6968
6965
},
6969
6966
6970
- .func = > return null , // TODO
6967
+ .func = > {
6968
+ var opt_cur_ty : ? Type = null ;
6969
+ for (peer_tys ) | opt_ty | {
6970
+ const ty = opt_ty orelse continue ;
6971
+ const cur_ty = opt_cur_ty orelse {
6972
+ opt_cur_ty = ty ;
6973
+ continue ;
6974
+ };
6975
+ if (ty .zigTypeTag (analyser ).? != .@"fn" ) {
6976
+ return null ;
6977
+ }
6978
+ if (cur_ty .eql (ty )) {
6979
+ continue ;
6980
+ }
6981
+ // TODO: coerce function types
6982
+ return null ;
6983
+ }
6984
+ return opt_cur_ty .? ;
6985
+ },
6971
6986
6972
6987
.enum_or_union = > return null , // TODO
6973
6988
0 commit comments