Commit Graph

21 Commits

Author SHA1 Message Date
ApolloZhu
683d469fcd Extends canImport to check for submodule availability 2021-12-28 22:54:47 -08:00
Doug Gregor
884e72a9a3 Warn about an unused @_predatesConcurrency attribute on an import.
We'll already suggest the addition of `@_predatesConcurrency` on an import
to downgrade or silence `Sendable`-related diagnostics, so we'll be
adding these to people's code. Over time, this attribute can go stale,
if the imported module's adopt `Sendable`. When the attribute isn't
doing anything, because it didn't suppress any `Sendable`-related
diagnostics, suggest that it be removed.
2021-12-21 15:04:40 -08:00
Doug Gregor
7a3da5ad58 Don't consider source locations part of AttributedImport's identity 2021-12-21 13:54:56 -08:00
Doug Gregor
23cc638ccc Suggest @_predatesConcurrency import to suppress diagnostics.
When diagnosing a `Sendable` violation, suggest the use of
`@_predatesConcurrency` on the corresponding import to suppress those
diagnostics.
2021-12-21 11:24:56 -08:00
Doug Gregor
0367213929 Implement predates-concurrency imports for Sendable diagnostic downgrades 2021-12-21 11:24:56 -08:00
Brent Royal-Gordon
944ad88455 [NFC] Improve simple_display for AttributedImport 2020-10-09 18:59:20 -07:00
Brent Royal-Gordon
48b866b8fe [NFC] Compare spiGroups in DenseMapInfo
This ought to result in more consistent behavior.
2020-10-09 18:59:20 -07:00
Brent Royal-Gordon
bf074b093e Run some implicit imports through import resolution
Unloaded implicit imports (e.g. the `-import-module` flag) will now be processed by import resolution, and will be fully validated and cross-imported. Preloaded imports, like the standard library import, are still not run through full import resolution, but this is a definite improvement over the status quo.

This also folds `-import-underlying-module` and `@_exported import <ParentModule>` into a single code path, slightly changing the diagnostic for a failed overlay-style underlying module import.
2020-10-09 18:59:19 -07:00
Brent Royal-Gordon
d02b34cccc [NFC] Add conveniences to clean up import code 2020-10-09 18:59:19 -07:00
Brent Royal-Gordon
c13067a0e0 [NFC] Rework ImplicitImportInfo::ModuleNames
Replace with an array of AttributedImport<UnloadedImportedModule> to add flexibility.
2020-10-09 18:58:03 -07:00
Brent Royal-Gordon
563386b06d [NFC] Eliminate ImplicitImport
Instead, we will use AttributedImport<ImportedModule>, a common currency type which supports a superset of ImplicitImport’s current behavior.
2020-10-09 18:58:03 -07:00
Brent Royal-Gordon
d55c5bd549 [NFC] Add type for ModuleDecl::getImplicitImports()
This doesn’t really change the design yet.
2020-10-09 18:58:03 -07:00
Brent Royal-Gordon
8070e8aaed [NFC] Use AttributedImport in import resolution
Removes what amount to redundant definitions from UnboundImport.
2020-10-09 18:58:03 -07:00
Brent Royal-Gordon
c489fffb79 [NFC] Rename and document fields of AttributedImport
Also renames a member in ImportResolution.cpp to align with this naming.
2020-10-09 18:57:07 -07:00
Brent Royal-Gordon
f3d99cefbb [NFC] Turn ImportedModuleDesc into AttributedImport
Rename ImportedModuleDesc to AttributedImport and make it a template that’s parameterized on the representation of the module. This will allow us to reduce duplicated representations of “abstract” ImportDecls.
2020-10-09 18:57:07 -07:00
Brent Royal-Gordon
b440ab7331 [NFC] Move several types/functions to Import.h
To help consolidate our various types describing imports, this commit moves the following types and methods to Import.h:

* ImplicitImports
* ImplicitStdlibKind
* ImplicitImportInfo
* ModuleDecl::ImportedModule
* ModuleDecl::OrderImportedModules (as ImportedModule::Order)
* ModuleDecl::removeDuplicateImports() (as ImportedModule::removeDuplicates())
* SourceFile::ImportFlags
* SourceFile::ImportOptions
* SourceFile::ImportedModuleDesc

This commit is large and intentionally kept mechanical—nothing interesting to see here.
2020-10-09 18:57:07 -07:00
Alexey Komnin
f18f3daba8 Fix SR-13490: Fix LT operator and add tests for ImportPath 2020-09-29 15:18:56 +03:00
Brent Royal-Gordon
7bfeeebcb9 [NFC] Add helper to parse import paths in strings 2020-09-10 19:08:29 -07:00
Brent Royal-Gordon
6da428a38e [NFC] Rename “DeclPath” -> “AccessPath”
To avoid ambiguity, ImportResolution and a few other things used the term “decl path” instead of “access path”. Switch back to the correct terminology now that the compiler is becoming more consistent about it.
2020-09-10 19:08:29 -07:00
Brent Royal-Gordon
1ed3caece6 [NFC] Add new ImportPath types 2020-09-10 19:07:48 -07:00
Brent Royal-Gordon
5afe2f97e2 [NFC] Move ImportKind to a new Import.h header 2020-09-10 18:36:03 -07:00