(t *testing.T)
| 1009 | } |
| 1010 | |
| 1011 | func TestFunctionDeclToExprDecl(t *testing.T) { |
| 1012 | tests := []struct { |
| 1013 | fn *FunctionDecl |
| 1014 | exDecl *exprpb.Decl |
| 1015 | }{ |
| 1016 | { |
| 1017 | fn: testFunction(t, "equals", |
| 1018 | Overload("equals_value_value", |
| 1019 | []*types.Type{types.NewTypeParamType("T"), types.NewTypeParamType("T")}, types.BoolType)), |
| 1020 | exDecl: &exprpb.Decl{ |
| 1021 | Name: "equals", |
| 1022 | DeclKind: &exprpb.Decl_Function{ |
| 1023 | Function: &exprpb.Decl_FunctionDecl{ |
| 1024 | Overloads: []*exprpb.Decl_FunctionDecl_Overload{ |
| 1025 | { |
| 1026 | OverloadId: "equals_value_value", |
| 1027 | Params: []*exprpb.Type{ |
| 1028 | chkdecls.NewTypeParamType("T"), |
| 1029 | chkdecls.NewTypeParamType("T"), |
| 1030 | }, |
| 1031 | TypeParams: []string{"T"}, |
| 1032 | ResultType: chkdecls.Bool, |
| 1033 | }, |
| 1034 | }, |
| 1035 | }, |
| 1036 | }, |
| 1037 | }, |
| 1038 | }, |
| 1039 | { |
| 1040 | fn: testFunction(t, "equals", |
| 1041 | MemberOverload("value_equals_value", |
| 1042 | []*types.Type{types.NewTypeParamType("T"), types.NewTypeParamType("T")}, types.BoolType)), |
| 1043 | exDecl: &exprpb.Decl{ |
| 1044 | Name: "equals", |
| 1045 | DeclKind: &exprpb.Decl_Function{ |
| 1046 | Function: &exprpb.Decl_FunctionDecl{ |
| 1047 | Overloads: []*exprpb.Decl_FunctionDecl_Overload{ |
| 1048 | { |
| 1049 | OverloadId: "value_equals_value", |
| 1050 | IsInstanceFunction: true, |
| 1051 | Params: []*exprpb.Type{ |
| 1052 | chkdecls.NewTypeParamType("T"), |
| 1053 | chkdecls.NewTypeParamType("T"), |
| 1054 | }, |
| 1055 | TypeParams: []string{"T"}, |
| 1056 | ResultType: chkdecls.Bool, |
| 1057 | }, |
| 1058 | }, |
| 1059 | }, |
| 1060 | }, |
| 1061 | }, |
| 1062 | }, |
| 1063 | { |
| 1064 | fn: testFunction(t, "equals", |
| 1065 | Overload("equals_int_uint", |
| 1066 | []*types.Type{types.IntType, types.UintType}, types.BoolType)), |
| 1067 | exDecl: &exprpb.Decl{ |
| 1068 | Name: "equals", |
nothing calls this directly
no test coverage detected