Commit Graph

11 Commits

Author SHA1 Message Date
Allan Shortlidge
8e5988e5fc NFC: Increase test coverage for SPI enum elements.
These tests identified a gap in type checking the exportability of case statements. Unfortunately this gap is not simple to close, since exportability is usually checked during availability checking but availability checking isn't appropriate for case statements and there isn't existing infrastructure to check exportability independently.
2022-11-29 22:11:02 -08:00
Allan Shortlidge
c54689bf49 Test: Fix copy-pasta in spi_helper.swift by making SPIStruct type a struct instead of a class. 2022-10-21 20:59:13 -07:00
Arnold Schwaighofer
084db0d38f Revert "Merge pull request #34848 from aschwaighofer/make_prespecialization_experimental"
This reverts commit 3aec862e62, reversing
changes made to 158427bd5b.
2021-02-12 10:12:01 -08:00
Arnold Schwaighofer
8346bf7e90 Pre-specialization: This is an experimental feature
Only enable if explicitly required.
2020-11-20 09:13:16 -08:00
Slava Pestov
5f5372a3fc Sema: Don't check SPI violations in diagnoseInlinableDeclRefAccess()
There's no need to check for that here, because we also run
diagnoseDeclRefExportability() on declarations referenced
from inlinable code.

This changes some diagnostics; we now produce the same diagnostic
for references to SPI types in declaration signatures and for
references to non-type SPI declarations in inlinable function bodies.

Also note that the old inlinable reference diagnostic no longer has
to handle the 'public' and 'open' access levels, which previously
happened for '@_spi'; so I changed those entries in the %select to
%error.
2020-10-22 01:11:46 -04:00
Slava Pestov
94e999a1b5 Sema: Pull availability checking out of resolveType()
We used to diagnose references to unavailable declarations in
two places:

- inside Exprs, right after type checking the expression
- inside TypeReprs, from resolveType()

In broad terms, resolveType() is called with TypeReprs
stored inside both Stmts and Decls.

To handle the first case, I added a new overload of
diagAvailability() that takes a Stmt, to be called from
typeCheckStmt(). This doesn't actually walk into any Exprs
stored inside the statement; this means it only walks
Patterns and such.

For the second case, a new DeclAvailabilityChecker is
now defined in TypeCheckAccess.cpp. It's structure is
analogous to the other three walkers there:

- AccessControlChecker
- UsableFromInlineChecker
- ExportabilityChecker

The new implementation of availability checking for types
introduces a lot more code than the old online logic
it replaces. However, I hope to consolidate some of the
code duplication among the four checkers that are defined
in TypeCheckAccess.cpp, and do some other cleanups that
will make the benefit of the new approach apparent.
2020-10-14 23:42:02 -04:00
Alexis Laferrière
dac3922090 [Sema] Accept use of SPI in inlinable SPI declarations
rdar://63978500
rdar://63189125
2020-09-16 11:20:56 -07:00
Alexis Laferrière
63d9acda3e [Sema] Report public use of local SPIs by the exportability checker
This change improves slightly the quality of the diagnostics and detects
the use of local SPI types on public property with a default value.
2020-06-29 11:18:04 -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
Alexis Laferrière
412469326d [SPI Test] Extend and update SPI tests 2020-03-04 16:43:05 -08:00
Alexis Laferrière
4d6adefa4c [Test] Test clients of modules defining SPI decls 2020-02-19 14:17:14 -08:00