@@ -324,8 +324,8 @@ testSuiteFieldGrammar = TestSuiteStanza
324
324
<*> monoidalFieldAla " code-generators" (alaList' CommaFSep Token ) testStanzaCodeGenerators
325
325
^^^ availableSince CabalSpecV3_8 []
326
326
327
- validateTestSuite :: Position -> TestSuiteStanza -> ParseResult TestSuite
328
- validateTestSuite pos stanza = case testSuiteType of
327
+ validateTestSuite :: CabalSpecVersion -> Position -> TestSuiteStanza -> ParseResult TestSuite
328
+ validateTestSuite cabalSpecVersion pos stanza = case testSuiteType of
329
329
Nothing -> pure basicTestSuite
330
330
331
331
Just tt@ (TestTypeUnknown _ _) ->
@@ -357,9 +357,10 @@ validateTestSuite pos stanza = case testSuiteType of
357
357
{ testInterface = TestSuiteLibV09 ver module_ }
358
358
359
359
where
360
- testSuiteType =
361
- _testStanzaTestType stanza
362
- <|> testTypeExe <$ _testStanzaMainIs stanza
360
+ testSuiteType = _testStanzaTestType stanza <|> do
361
+ guard (cabalSpecVersion >= CabalSpecV3_8 )
362
+
363
+ testTypeExe <$ _testStanzaMainIs stanza
363
364
<|> testTypeLib <$ _testStanzaTestModule stanza
364
365
365
366
missingField name tt = " The '" ++ name ++ " ' field is required for the "
@@ -446,8 +447,8 @@ benchmarkFieldGrammar = BenchmarkStanza
446
447
<*> optionalField " benchmark-module" benchmarkStanzaBenchmarkModule
447
448
<*> blurFieldGrammar benchmarkStanzaBuildInfo buildInfoFieldGrammar
448
449
449
- validateBenchmark :: Position -> BenchmarkStanza -> ParseResult Benchmark
450
- validateBenchmark pos stanza = case benchmarkStanzaType of
450
+ validateBenchmark :: CabalSpecVersion -> Position -> BenchmarkStanza -> ParseResult Benchmark
451
+ validateBenchmark cabalSpecVersion pos stanza = case benchmarkStanzaType of
451
452
Nothing -> pure emptyBenchmark
452
453
{ benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza }
453
454
@@ -474,9 +475,10 @@ validateBenchmark pos stanza = case benchmarkStanzaType of
474
475
}
475
476
476
477
where
477
- benchmarkStanzaType =
478
- _benchmarkStanzaBenchmarkType stanza
479
- <|> benchmarkTypeExe <$ _benchmarkStanzaMainIs stanza
478
+ benchmarkStanzaType = _benchmarkStanzaBenchmarkType stanza <|> do
479
+ guard (cabalSpecVersion >= CabalSpecV3_8 )
480
+
481
+ benchmarkTypeExe <$ _benchmarkStanzaMainIs stanza
480
482
481
483
missingField name tt = " The '" ++ name ++ " ' field is required for the "
482
484
++ prettyShow tt ++ " benchmark type."
0 commit comments