Uploaded image for project: 'Swift'
  1. Swift
  2. SR-8850

swiftc error for unsupported -swift-version shouldn't tell user to use major version

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:
    • Environment:

      Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
      Target: x86_64-apple-darwin18.0.0

      Description

      Right now passing an unsupported minor Swift version to swiftc -swift-version tells the user to use a major version number. This error message is bad because we actually support a version with a minor version number (4.2). The other problem with this error is it doesn't tell the user what the supported versions are, which the error you get by specifying an unsupported major version number does. The fact that the other error tells the user what the supported versions are is sufficient info to let them infer that they should usually not specify a minor version.

      Current behavior:

      $ swiftc -swift-version 4.1 foo.swift
      <unknown>:0: error: invalid value '4.1' in '-swift-version 4.1'
      <unknown>:0: note: use major version, as in '-swift-version 4'
      

      Expected behavior:

      $ swiftc -swift-version 4.1 foo.swift
      <unknown>:0: error: invalid value '4.1' in '-swift-version 4.1'
      <unknown>:0: note: valid arguments to '-swift-version' are '3', '4', '4.2', '5'
      

        Attachments

          Activity

            People

            • Assignee:
              jrose Jordan Rose
              Reporter:
              Eridius Lily Ballard
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: