Commit Graph

9 Commits

Author SHA1 Message Date
Henrik G. Olsson
cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00
Varun Gandhi
a1716fe2a6 [Diagnostics] Update compiler diagnostics to use less jargon. (#31315)
Fixes rdar://problem/62375243.
2020-04-28 14:11:39 -07:00
Jordan Rose
4a8f81db2b Special-case diagnostic for when you just need @unknown default (#21695)
This is a new feature of Swift 5 mode, so it deserves at least a
little bit of explanation right in the diagnostic. If you have an
otherwise-fully-covered switch but can't assume the enum is frozen,
you'll now get this message:

    switch covers known cases, but 'MusicGenre' may have additional
    unknown values

Furthermore, if the enum comes from a system header, it looks like
this:

    switch covers known cases, but 'NSMusicGenre' may have additional
    unknown values, possibly added in future versions

...to further suggest the idea that even though your switch is covered
/now/, it might not handle everything in the /future/. This extra bit
is limited to system headers to avoid showing up on C enums defined in
your own project, for which it sounds silly. (The main message is
still valid though, since you can cram whatever you want into a C
enum, and people use this pattern to implement "private cases".)

rdar://problem/39367045
2019-01-08 08:45:23 -08:00
Saleem Abdulrasool
7606e2b5c5 ClangImporter: improve ObjC-interop and enable tests
This enables additional tests for the ClangImporter.  This found a
missing piece in the `-enable-objc-interop` work that was done
previously.  Address that and enable the tests.  There are now the
following failing tests on Linux:

  * sdk - depends on Foundation (not hermetic, see SR-7572)
  * mixed-nsuinteger - depends on Foundation (not hermetic, see SR-7572)
  * import-mixed-with-header-twice - requires apple/swift PR#16022
  * can_import_objc_idempotent - requires apple/swift PR#16022
  * objc_protocol_renaming - requires apple/swift PR#16022
2018-05-01 18:39:42 -07:00
Jordan Rose
7c689c322e Prefer @unknown default over @unknown case _ in diagnostics
(and fix-its)
2018-04-05 17:54:49 -07:00
Jordan Rose
3e2411acd4 Diagnose when switching on a non-frozen enum without a catch-all case
The first half of Sema support for '@unknown'. The other part is
handling when the user /does/ write '@unknown', which results in
/other/ things being downgraded to warnings.

The diagnostics here are still pretty minimal; they should explain
what's going on with '@unknown' to someone who hasn't read the Swift 5
release notes.
2018-04-05 16:35:14 -07:00
Jordan Rose
782f37633f [ClangImporter] Fix-up for 43c0289dd4.
This is what happens when you don't test all the changes you make,
Jordan. (Thanks to Max for tracking this one down.)

rdar://problem/33784466
2017-08-15 18:01:47 -07:00
Jordan Rose
43c0289dd4 [ClangImporter] Avoid trying to import enums without definitions. (#11394)
This would fail later down the line anyway, meaning this does not
change the ultimate behavior of the importer, but since I added an
assertion that we're expecting a definition here in 2c68f8d49d, we
need to avoid even asking the question.

Also fix up a few other places where we aren't sure we'll have a
definition when calling these functions.

rdar://problem/33784466
2017-08-09 13:51:03 -07:00
Jordan Rose
61798ff6ec [test] Rename test/ClangModules to test/ClangImporter. (#5618)
...to match the component in include/ and lib/. No content change.
2016-11-02 18:00:53 -07:00