@@ -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 | {
@@ -7014,7 +7011,25 @@ fn resolvePeerTypesInner(analyser: *Analyser, peer_tys: []?Type) !?Type {
7014
7011
};
7015
7012
},
7016
7013
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
+ },
7018
7033
7019
7034
.enum_or_union = > return null , // TODO
7020
7035
0 commit comments