Commit Graph

18 Commits

Author SHA1 Message Date
Erik Eckstein
afdce751cf tests: small improvement for Misc/verify-swift-feature-testing.test-sh
The `git grep` command fails if the repository has a branch named `test`.
Inserting a `--` in the git command line makes it clear that `test` is the directory and not the branch
2025-08-29 11:03:01 +02:00
Gabor Horvath
4b64abdc45 [cxx-interop] Configure requires ObjC from frontend option
We sometimes don't have the information in the modulemaps whether a
module requires ObjC or not. This info is useful for reverse interop.
This PR introduces a frontend flag to have a comma separated list of
modules that we should import as if they had "requires ObjC" in their
modulemaps.
2025-07-17 21:29:50 +01:00
Allan Shortlidge
897a74f495 Tests: Move some availability tests into a new test/Availability directory.
Un-reverts 9c01ee2c1b.

Also, add myself as a reviewer for more availability related files.

NFC.
2025-06-23 15:57:34 -07:00
Allan Shortlidge
de1017fef4 Revert "Move some availability tests into a new test/Availability directory"
This reverts commit 9c01ee2c1b.
2025-06-08 22:22:41 -07:00
Slava Pestov
9c01ee2c1b Move some availability tests into a new test/Availability directory 2025-06-06 17:10:42 -04:00
Saleem Abdulrasool
a65912f095 test: tweak verify-swift-feature-testing
Attempt to use `git grep` instead of `grep`. This might help reduce the
cost of this test. Currently, on Windows, this test takes ~350s, placing
it 2nd in the slowest tests on Windows.
2025-04-14 21:37:46 -07:00
Anthony Latsis
6a8213c74b test: Speed up test/Misc/verify-swift-feature-testing.test-sh some more
Instead of first invoking `grep` to get a list of files with matches,
and then invoking it again on each file to find lines with matches,
invoke it once on the entire test suite to get a list of paths and lines
with matches, and parse that output into a dictionary that maps file
paths to lists of lines.
This further reduces run time from ~2.5s to ~1s.
2025-03-04 15:55:22 +00:00
Anthony Latsis
203a1e0a11 Merge pull request #79720 from AnthonyLatsis/haliotis-rufescens
[NFC] test: Factor out feature frontend tests into subdirectory
2025-03-04 03:33:31 +00:00
Anthony Latsis
02359f451b test: Improve error messages in Swift feature usage verification script
* Place 'error: ' after file name.
* Be more clear about what's wrong and where.
2025-03-03 22:32:43 +00:00
Anthony Latsis
64dcce31a3 test: Improve regex in Swift feature usage verification script
* Account for variable number of spaces.
* Match strings like '-enable-upcoming-feature\'. We want to complain
  about these because the script cannot get the job done when the option
  and argument are on different lines.
  The capture group will match '' in these cases.
2025-03-03 22:31:41 +00:00
Anthony Latsis
986f1d40e5 test: Speed up Swift feature usage verification script
* The set of files that enable features and the set of files that
  require features are expected to have a very small, if any,
  difference. Don't compute and check each set separately.
* Find RUN and REQUIRES lines in a file in one go.
2025-03-03 22:31:36 +00:00
Anthony Latsis
d18425e3dc [NFC] test: Factor out feature frontend tests into subdirectory 2025-03-01 03:55:09 +00:00
Allan Shortlidge
24f5632ca1 Frontend: Implement optional parsing diagnostics for enabled language features.
Parsing for `-enable-upcoming-feature` and `-enable-experimental-feature` is
lenient by default because some projects need to be compatible with multiple
language versions and compiler toolchains simultaneously, and strict
diagnostics would be a nuisance. On the other hand, though, it would be useful
to get feedback from the compiler when you attempt to enable a feature that
doesn't exist. This change splits the difference by introducing new diagnostics
for potential feature enablement misconfigurations but leaves those diagnostics
ignored by default. Projects that wish to use them can specify `-Wwarning
StrictLanguageFeatures`.
2025-01-15 16:34:32 -08:00
Becca Royal-Gordon
01b8bbea89 Tie attributes to language features
The new `DECL_ATTR_FEATURE_REQUIREMENT` macro in DeclAttr.def can be used to declare that an attribute should only be available when a related language feature is enabled.

Effects:

• `#if hasAttribute(someAttr)` will return `false` unless the required feature is enabled.
• Code completion will not include the attribute unless the required feature is enabled.
• `TypeChecker::checkDeclAttributes()` diagnoses non-implicit uses of the attribute.

Add this mechanism and use it to tie @abi to the ABIAttribute feature. Also design tests for it.
2024-12-19 15:49:34 -08:00
Daniel Rodríguez Troitiño
d2d830fc0e [test] Warning about Swift features that do not exist (#77542)
Sometimes features are removed from `Features.def`, but they are not
removed from the test files. The compiler ignores every feature that
does not exist. This leads to removed features still being tested, and
with the introduction of #76740, `REQUIRED:`.

Modify the code that generates the active feature set for testing to
also generate the set of existing features, and pass this list of
existing features to the verifier script. If a feature is trying to be
activated and does not exist, the verifier will warn the user.

- `SwiftParser` feature was renamed `ParserASTGen`, but some tests were
  using both spellings. Remove the mentions of `SwiftParser` in the
  tests.
- `ImportObjcForwardDeclarations` was spelled with upper case `C` in
  a couple of tests. Fix it so the matching is easier.
- `TransferringArgsAndResults` was an experimental feature that was
  removed.
- Ignore the usage of inexisting feature in `swift-export-as.swift`
  because it seems to be what the test is actually testing.
- Ignore the test `availability_define.swift` because it tests the
  pseudo-feature `AvailabilityMacro=` which is not part of
  `Features.def`.
2024-11-12 08:58:53 -08:00
Daniel Rodríguez Troitiño
e5751afd40 [test] Verify usage of swift_feature_ markers without enabling features
When a feature is removed from `Features.def` or when a test removes all
usages of `-enable-experimental/upcoming-feature` keeping the
`REQUIRES:` lines around is probably a mistake. Warn about possibly
missing flags if a `REQUIRES:` is found referencing a feature without
the equivalent `-enable-*-feature` in a `RUN:` line.
2024-11-04 20:53:06 -08:00
Daniel Rodríguez Troitiño
fff1884d9d [test] Lint test/Misc/verify-swift-feature-testing.test-sh
It is not automatically linted because of its extension.
2024-11-04 17:32:16 -08:00
Daniel Rodríguez Troitiño
2cad3ca547 [test] Add test that verify correct usage of REQUIRES for Swift features
The test will look for other tests using `RUN:` lines that use
experimental or upcoming features and will check that the tests also are
checking with the right `REQUIRES:` lines for the used features. This
should avoid new tests being introduced without the right `REQUIRES` and
should avoid breaking the toolchain in less tested configurations.
2024-11-02 11:46:46 -07:00