@@ -314,13 +314,23 @@ goSections specVer = traverse_ process
314
314
commonStanzas <- use stateCommonStanzas
315
315
name' <- parseUnqualComponentName pos args
316
316
testStanza <- lift $ parseCondTree' testSuiteFieldGrammar (fromBuildInfo' name') commonStanzas fields
317
- testSuite <- lift $ traverse (validateTestSuite pos) testStanza
317
+ testSuite <- lift $ traverse (validateTestSuite specVer pos) testStanza
318
318
319
319
let hasType ts = testInterface ts /= testInterface mempty
320
320
unless (onAllBranches hasType testSuite) $ lift $ parseFailure pos $ concat
321
321
[ " Test suite " ++ show (prettyShow name')
322
- , " is missing required field \" main-is\" or the field "
323
- , " is not present in all conditional branches."
322
+
323
+ , concat $ case specVer of
324
+ v | v >= CabalSpecV3_8 ->
325
+ [ " is missing required field \" main-is\" or the field "
326
+ , " is not present in all conditional branches."
327
+ ]
328
+ _ ->
329
+ [ " is missing required field \" type\" or the field "
330
+ , " is not present in all conditional branches. The "
331
+ , " available test types are: "
332
+ , intercalate " , " (map prettyShow knownTestTypes)
333
+ ]
324
334
]
325
335
326
336
-- TODO check duplicate name here?
@@ -330,13 +340,22 @@ goSections specVer = traverse_ process
330
340
commonStanzas <- use stateCommonStanzas
331
341
name' <- parseUnqualComponentName pos args
332
342
benchStanza <- lift $ parseCondTree' benchmarkFieldGrammar (fromBuildInfo' name') commonStanzas fields
333
- bench <- lift $ traverse (validateBenchmark pos) benchStanza
343
+ bench <- lift $ traverse (validateBenchmark specVer pos) benchStanza
334
344
335
345
let hasType ts = benchmarkInterface ts /= benchmarkInterface mempty
336
346
unless (onAllBranches hasType bench) $ lift $ parseFailure pos $ concat
337
347
[ " Benchmark " ++ show (prettyShow name')
338
- , " is missing required field \" main-is\" or the field "
339
- , " is not present in all conditional branches."
348
+ , concat $ case specVer of
349
+ v | v >= CabalSpecV3_8 ->
350
+ [ " is missing required field \" main-is\" or the field "
351
+ , " is not present in all conditional branches."
352
+ ]
353
+ _ ->
354
+ [ " is missing required field \" type\" or the field "
355
+ , " is not present in all conditional branches. The "
356
+ , " available benchmark types are: "
357
+ , intercalate " , " (map prettyShow knownBenchmarkTypes)
358
+ ]
340
359
]
341
360
342
361
-- TODO check duplicate name here?
0 commit comments