Skip to content

Commit fb56bb9

Browse files
Merge pull request #430 from swiftwasm/master
[pull] swiftwasm from master
2 parents 3999a2e + e1b6eb6 commit fb56bb9

File tree

155 files changed

+2230
-1894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+2230
-1894
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ Swift Next
4646
// OK, <U where U: Equatable> has broader visibility than <T where T == Int>
4747
override func foo() where U: Equatable { ... }
4848
}
49+
50+
* [SR-75][]:
51+
52+
Unapplied references to protocol methods are now supported. Previously this
53+
only worked for methods defined in structs, enums and classes.
54+
55+
```swift
56+
protocol Cat {
57+
func play(catToy: Toy)
58+
}
59+
60+
let fn = Cat.play(catToy:)
61+
fn(myCat)(myToy)
4962
```
5063

5164
* [SE-0266][]:
@@ -7939,6 +7952,7 @@ Swift 1.0
79397952
[SE-0267]: <https://github.com/apple/swift-evolution/blob/master/proposals/0267-where-on-contextually-generic.md>
79407953
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
79417954

7955+
[SR-75]: <https://bugs.swift.org/browse/SR-75>
79427956
[SR-106]: <https://bugs.swift.org/browse/SR-106>
79437957
[SR-419]: <https://bugs.swift.org/browse/SR-419>
79447958
[SR-631]: <https://bugs.swift.org/browse/SR-631>

docs/Lexicon.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ source code, tests, and commit messages. See also the `LLVM lexicon`_.
299299
}
300300
}
301301

302-
`Outer` is the parent type of `Inner`.
302+
``Outer`` is the parent type of ``Inner``.
303303

304304
Note that the terms "parent type" and "superclass" refer to completely
305305
different concepts.

include/swift/AST/SourceFile.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ class SourceFile final : public FileUnit {
194194
/// mechanism which is not SourceFile-dependent.)
195195
SeparatelyImportedOverlayMap separatelyImportedOverlays;
196196

197+
using SeparatelyImportedOverlayReverseMap =
198+
llvm::SmallDenseMap<ModuleDecl *, ModuleDecl *>;
199+
200+
/// A lazily populated mapping from a separately imported overlay to its
201+
/// underlying shadowed module.
202+
///
203+
/// This is used by tooling to substitute the name of the underlying module
204+
/// wherever the overlay's name would otherwise be reported.
205+
SeparatelyImportedOverlayReverseMap separatelyImportedOverlaysReversed;
206+
197207
/// A pointer to PersistentParserState with a function reference to its
198208
/// deleter to handle the fact that it's forward declared.
199209
using ParserStatePtr =
@@ -382,6 +392,7 @@ class SourceFile final : public FileUnit {
382392
/// \returns true if the overlay was added; false if it already existed.
383393
bool addSeparatelyImportedOverlay(ModuleDecl *overlay,
384394
ModuleDecl *declaring) {
395+
separatelyImportedOverlaysReversed.clear();
385396
return std::get<1>(separatelyImportedOverlays[declaring].insert(overlay));
386397
}
387398

@@ -399,6 +410,12 @@ class SourceFile final : public FileUnit {
399410
overlays.append(value.begin(), value.end());
400411
}
401412

413+
/// Retrieves a module shadowed by the provided separately imported overlay
414+
/// \p shadowed. If such a module is returned, it should be presented to users
415+
/// as owning the symbols in \p overlay.
416+
ModuleDecl *
417+
getModuleShadowedBySeparatelyImportedOverlay(const ModuleDecl *overlay);
418+
402419
void cacheVisibleDecls(SmallVectorImpl<ValueDecl *> &&globals) const;
403420
const SmallVectorImpl<ValueDecl *> &getCachedVisibleDecls() const;
404421

include/swift/Basic/LangOptions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ namespace swift {
296296
/// incrementals parsing.
297297
bool BuildSyntaxTree = false;
298298

299+
/// Whether parsing is occurring for creation of syntax tree only, and no typechecking will occur after
300+
/// parsing e.g. when parsing for SwiftSyntax. This is intended to affect parsing, e.g. disable
301+
/// unnecessary name lookups that are not useful for pure syntactic parsing.
302+
bool ParseForSyntaxTreeOnly = false;
303+
299304
/// Whether to verify the parsed syntax tree and emit related diagnostics.
300305
bool VerifySyntaxTree = false;
301306

include/swift/Basic/PathRemapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class PathRemapper {
3939
/// Adds a mapping such that any paths starting with `FromPrefix` have that
4040
/// portion replaced with `ToPrefix`.
4141
void addMapping(StringRef FromPrefix, StringRef ToPrefix) {
42-
PathMappings.emplace_back(FromPrefix, ToPrefix);
42+
PathMappings.emplace_back(FromPrefix.str(), ToPrefix.str());
4343
}
4444

4545
/// Returns a remapped `Path` if it starts with a prefix in the map; otherwise

include/swift/Frontend/PrintingDiagnosticConsumer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class PrintingDiagnosticConsumer : public DiagnosticConsumer {
3737
// implicitly associated with it. Uses `std::unique_ptr` so that
3838
// `AnnotatedSourceSnippet` can be forward declared.
3939
std::unique_ptr<AnnotatedSourceSnippet> currentSnippet;
40+
// Educational notes which are buffered until the consumer is finished
41+
// constructing a snippet.
42+
SmallVector<std::string, 1> BufferedEducationalNotes;
4043

4144
public:
4245
PrintingDiagnosticConsumer(llvm::raw_ostream &stream = llvm::errs());

0 commit comments

Comments
 (0)