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

Improve error when using keywords as identifiers

    XMLWordPrintable

    Details

      Description

      func switch() { }
      
      repl.swift:1:6: error: expected identifier in function declaration
      func switch() { }
           ^
      

      We can do better than this. Someone inside Apple suggested "keyword 'switch' found where an identifier should be in a function's name. Try picking a different name for the function or putting backticks (`) around the name." The suggested fixes (the second sentence) should probably be two separate notes rather than crammed into the main diagnostic.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: