lint: disallow extra fields in "negative" metadata (#3009)

This commit is contained in:
jugglinmike 2021-06-24 13:37:55 -04:00 committed by GitHub
parent 9997a26c7d
commit 64a8968246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -27,6 +27,9 @@ class CheckNegative(Check):
if not 'phase' in negative:
return '"negative" must specify a "phase" field'
if len(negative.keys()) > 2:
return '"negative" must specify only "type" and "phase" fields'
if negative["phase"] not in ["parse", "resolution", "runtime"]:
return '"phase" must be one of ["parse", "resolution", "runtime"]'

View File

@ -0,0 +1,15 @@
NEGATIVE
^ expected errors | v input
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-assignment-operators-static-semantics-early-errors
description: Extraneous field in "negative" frontmatter
negative:
flags: strict
type: ReferenceError
phase: runtime
---*/
x;
let x;