@@ -109,6 +109,7 @@ fn functionNameDiagnostic(ctx: *LinterContext, fn_name: []const u8, case: CaseTy
109109 .{ctx .spanT (name )},
110110 );
111111}
112+
112113fn genericsArePascaleCase (ctx : * LinterContext , fn_name : []const u8 , name : Ast.TokenIndex ) Error {
113114 var d = ctx .diagnosticf (
114115 "Function '{s}' returns a type, but does not use PascalCase" ,
@@ -164,7 +165,8 @@ fn fnReturnsType(ctx: *LinterContext, fn_proto: *const Ast.full.FnProto) bool {
164165 @branchHint (.cold );
165166 return false ;
166167 }
167- return std .ascii .isUpper (return_type [0 ]) or std .mem .eql (u8 , return_type , "type" );
168+
169+ return std .mem .eql (u8 , return_type , "type" );
168170}
169171
170172// Used by the Linter to register the rule so it can be run.
@@ -180,9 +182,23 @@ test CaseConvention {
180182 var runner = RuleTester .init (t .allocator , case_convention .rule ());
181183 defer runner .deinit ();
182184
183- const pass = &[_ ][:0 ]const u8 { "fn alllowercasefunctionsarealwaysgreen() void {}" , "fn thisFunctionIsInCamelCase() void {}" , "fn Generic(T: type) T { return T{}; }" , "fn FooBar() type { return u32; }" };
185+ const pass = &[_ ][:0 ]const u8 {
186+ "fn alllowercasefunctionsarealwaysgreen() void {}" ,
187+ "fn thisFunctionIsInCamelCase() void {}" ,
188+ "fn Generic(T: type) type { return *T; }" ,
189+ "fn FooBar() type { return u32; }" ,
190+ };
184191
185- const fail = &[_ ][:0 ]const u8 { "fn ThisFunctionIsInPascalCase() void {}" , "fn @\" this-one-is-in-kebab-case\" () void {}" , "fn this_one_is_in_snake_case() void {}" , "fn @\" This-is-both-Pascal-and-Kebab-kinda\" () void {}" , "fn This_is_both_snake_case_and_pascal_kinda() void {}" , "fn This_is_both_snake_case_and_pascal_kinda(a: u32, b: u32, c: u32, d: u32) void {}" , "fn fooBar() type { return u32; }" };
192+ const fail = &[_ ][:0 ]const u8 {
193+ "fn ThisFunctionIsInPascalCase() void {}" ,
194+ "fn @\" this-one-is-in-kebab-case\" () void {}" ,
195+ "fn this_one_is_in_snake_case() void {}" ,
196+ "fn @\" This-is-both-Pascal-and-Kebab-kinda\" () void {}" ,
197+ "fn This_is_both_snake_case_and_pascal_kinda() void {}" ,
198+ "fn This_is_both_snake_case_and_pascal_kinda(a: u32, b: u32, c: u32, d: u32) void {}" ,
199+ "fn fooBar() type { return u32; }" ,
200+ "fn NotGeneric(T: type) T { return T{}; }" ,
201+ };
186202
187203 try runner
188204 .withPass (pass )
0 commit comments