Skip to content
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
3 changes: 2 additions & 1 deletion lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,8 @@ namespace {
ExprRewriter(ConstraintSystem &cs, Solution &solution,
Optional<SolutionApplicationTarget> target,
bool suppressDiagnostics)
: cs(cs), dc(cs.DC), solution(solution), target(target),
: cs(cs), dc(target ? target->getDeclContext() : cs.DC),
solution(solution), target(target),
SuppressDiagnostics(suppressDiagnostics) {}

ConstraintSystem &getConstraintSystem() const { return cs; }
Expand Down
16 changes: 16 additions & 0 deletions test/expr/closure/multi_statement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,19 @@ func test_local_function_capturing_vars() {
}
}
}

func test_taps_type_checked_with_correct_decl_context() {
struct Path {
func contains<T>(_: T) -> Bool where T: StringProtocol { return false }
}

let paths: [Path] = []
let strs: [String] = []

_ = paths.filter { path in
for str in strs where path.contains("\(str).hello") {
return true
}
return false
}
}