You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR changes the initializers for `.bug()` from ones taking an undecorated
and unspecified "identifier" to ones taking either a URL (as a string) or a
numeric ID ("bug number.")
The existing interface is ambiguous to tools authors seeking to integrate with
it. They must treat _every_ bug as potentially containing a URL with fallback
paths if a bug's ID cannot be parsed as a URL. By splitting URLs and numbers up
into two separate properties, tools authors can provide reliable, distinct
interfaces for bugs known by number vs. those known by URL.
- If the bug identifier can be parsed as an unsigned integer, it is assumed to
35
-
represent an issue with that numeric identifier in an unspecified bug-tracking
36
-
system.
37
-
- All other bug identifiers are considered invalid and will cause the compiler
38
-
to generate an error at compile time.
23
+
"issues." To avoid confusion with the ``Issue`` type in the testing library,
24
+
this document consistently refers to them as "bugs."
39
25
40
-
<!--
41
-
Possible additional formats we could recognize (which would require special
42
-
handling to detect:
26
+
A bug may have both an associated URL _and_ an associated unique identifier. It
27
+
must have at least one or the other in order for the testing library to be able
28
+
to interpret it correctly.
43
29
44
-
- If the bug identifier begins with `"#"` and can be parsed as a positive
45
-
integer, it is assumed to represent a [GitHub](https://github.com) issue in
46
-
the same repository as the test.
47
-
-->
30
+
To create an instance of ``Bug`` with a URL, use the ``Trait/bug(url:_:)``
31
+
trait. At compile time, the testing library will validate that the given string
32
+
can be parsed as a URL according to [RFC 3986](https://www.ietf.org/rfc/rfc3986.txt).
33
+
34
+
To create an instance of ``Bug`` with a bug's unique identifier, use the
35
+
``Trait/bug(_:url:_:)-7f1e4`` trait. The testing library does not require that
36
+
a bug's unique identifier match any particular format, but will interpret
37
+
unique identifiers starting with `"FB"` as referring to bugs tracked with the
38
+
[Apple Feedback Assistant](https://feedbackassistant.apple.com). For
39
+
convenience, you can also directly pass an integer as a bug's identifier using
40
+
``Trait/bug(_:url:_:)-41twe``.
48
41
49
42
## Examples
50
43
@@ -53,10 +46,12 @@ handling to detect:
53
46
|`.bug(12345)`| Yes | None |
54
47
|`.bug("12345")`| Yes | None |
55
48
|`.bug("Things don't work")`|**No**| None |
56
-
|`.bug("rdar:12345")`| Yes | Apple Radar |
57
-
|`.bug("https://github.com/apple/swift/pull/12345")`| Yes |[GitHub Issues for the Swift project](https://github.com/apple/swift/issues)|
|`.bug(url: "https://github.com/apple/swift/pull/12345")`| Yes |[GitHub Issues for the Swift project](https://github.com/apple/swift/issues)|
0 commit comments