Skip to content

Commit

Permalink
Re-add annotation trait location test case
Browse files Browse the repository at this point in the history
This re-adds a test case for annotation trait source locations
without parens. It also adds in a detailed explanation of what the
cases are doing since it wasn't clear before.
  • Loading branch information
JordonPhillips committed Mar 24, 2022
1 parent c10ad7f commit 0d0af2f
Showing 1 changed file with 33 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,45 @@ document documentTrait
@trait
string stringTrait

/// Documentation
@sensitive
@internal()
@deprecated(
@trait
structure annotationTrait {}

// This is used to test that trait locations are properly set for a variety of
// trait types. The locations for annotation traits in particular used to be
// fraught. To ensure there's no regressions, do not remove any traits from
// here. If a trait absolutely must be removed, replace it with a custom
// trait that looks exactly the same, like those above. At minimum there
// should be one trait for each Node type, including a case for every syntactic
// variation.

/// Documentation trait using the doc comment syntax
@annotationTrait // Annotation trait without parens
@internal() // Annotation trait with parens
@deprecated( // Structured trait with no braces
since: "1.0"
)
@tags(["foo"])
@unstable({})
@stringTrait("foo")
@tags(["foo"]) // List trait
@unstable({}) // Structured trait with braces
@stringTrait("foo") // String trait using normal string syntax
@since("""
0.9""")
@numberTrait(1)
@boolTrait(true)
@documentTrait(null)
0.9""") // String trait using block syntax
@numberTrait(1) // Number trait
@boolTrait(true) // Boolean trait
@documentTrait(null) // Null value trait
structure TraitBearer {
/// Documentation
@internal()
@deprecated(
/// Documentation trait using the doc comment syntax
@annotationTrait // Annotation trait without parens
@internal() // Annotation trait with parens
@deprecated( // Structured trait with no braces
since: "1.0"
)
@tags(["foo"])
@unstable({})
@pattern("foo")
@tags(["foo"]) // List trait
@unstable({}) // Structured trait with braces
@stringTrait("foo") // String trait using normal string syntax
@since("""
0.9""")
@numberTrait(1)
@boolTrait(true)
@documentTrait(null)
0.9""") // String trait using block syntax
@numberTrait(1) // Number trait
@boolTrait(true) // Boolean trait
@documentTrait(null) // Null value trait
member: String
}

0 comments on commit 0d0af2f

Please sign in to comment.