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
Copy file name to clipboardExpand all lines: CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift
+1
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,7 @@ public let AVAILABILITY_NODES: [Node] = [
171
171
base:.syntax,
172
172
nameForDiagnostics:"version tuple",
173
173
documentation:"A version number like `1.2.0`. Only the first version component is required. There might be an arbitrary number of following components.",
/// Parse the source code of this node as a `VersionTupleSyntax`.
17
+
///
18
+
/// In some situations, like the `_version` argument of the `canImport` condition in `#if`, the version gets parsed as a normal expression, which results in
19
+
/// - an integer literal for single-component versions
20
+
/// - a floating point number for two-component versions
21
+
/// - a floating point number with a member accesses for versions with more than three components
22
+
///
23
+
/// This is done so the parser can parse `canImport` like any other function call, reducing the need for special handling.
24
+
///
25
+
/// This property re-interprets such an expression as a version tuple in cases where the client know that it should semantically represent a version.
0 commit comments