Skip to content

[CS] Don't bail out of CollectVarRefs early #38542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/Sema/CSGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2519,10 +2519,8 @@ namespace {
std::pair<bool, Expr *> walkToExprPre(Expr *expr) override {
// If there are any error expressions in this closure
// it wouldn't be possible to infer its type.
if (isa<ErrorExpr>(expr)) {
if (isa<ErrorExpr>(expr))
hasErrorExprs = true;
return {false, nullptr};
}

// Retrieve type variables from references to var decls.
if (auto *declRef = dyn_cast<DeclRefExpr>(expr)) {
Expand Down
47 changes: 47 additions & 0 deletions validation-test/IDE/crashers_2_fixed/sr14709.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// RUN: %swift-ide-test --code-completion --source-filename %s --code-completion-token=CC

struct Listing {}

protocol View2 {}

extension View2 {
@available(macOS 10.15, *)
func onTapGesturf(perform action: () -> Void) -> some View2 { fatalError() }
}

@resultBuilder struct ViewBuilder2 {
static func buildBlock() -> Never { fatalError() }
static func buildBlock<Content>(_ content: Content) -> Content where Content : View2 { fatalError() }
}

struct HStack2<Content> : View2 {
init(@ViewBuilder2 content: () -> Content) { fatalError() }
}

struct ItemImage2 : View2 {
init(path: String) {}
}

struct ForEach2<Data, Content>: View2 {
init(_ data: [Listing], @ViewBuilder2 content: (Data) -> Content) {}
}


struct TodayNookazonSection {

let listings: [Listing]

@available(macOS 10.15, *)
@ViewBuilder2 var body: some View2 {
ForEach2(listings) { listing in
HStack2 {
HStack2 {
ItemImage2(path#^CC^#: "abc")
}
.onTapGesturf {
listing
}
}
}
}
}