Skip to content

Commit bf100d9

Browse files
Merge pull request #4809 from swiftwasm/release/5.7
[pull] swiftwasm-release/5.7 from release/5.7
2 parents f6e399f + 57c7317 commit bf100d9

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3885,17 +3885,14 @@ bool MissingMemberFailure::diagnoseInLiteralCollectionContext() const {
38853885
if (!parentExpr)
38863886
return false;
38873887

3888-
auto parentType = getType(parentExpr);
3888+
// This could happen if collection is a dictionary literal i.e.
3889+
// ["a": .test] - the element is a tuple - ("a", .test).
3890+
if (isExpr<TupleExpr>(parentExpr))
3891+
parentExpr = findParentExpr(parentExpr);
38893892

3890-
if (!parentType->isKnownStdlibCollectionType() && !parentType->is<TupleType>())
3893+
if (!isExpr<CollectionExpr>(parentExpr))
38913894
return false;
38923895

3893-
if (isa<TupleExpr>(parentExpr)) {
3894-
parentExpr = findParentExpr(parentExpr);
3895-
if (!parentExpr)
3896-
return false;
3897-
}
3898-
38993896
if (auto *defaultableVar =
39003897
getRawType(parentExpr)->getAs<TypeVariableType>()) {
39013898
if (solution.DefaultedConstraints.count(

test/expr/closure/multi_statement.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,3 +515,23 @@ func test_conflicting_pattern_vars() {
515515
}
516516
}
517517
}
518+
519+
// rdar://91452726 - crash in MissingMemberFailure::diagnoseInLiteralCollectionContext
520+
struct Test {
521+
struct ID {
522+
}
523+
524+
enum E : Hashable, Equatable {
525+
case id
526+
}
527+
528+
var arr: [(ID, E)]
529+
530+
func test() {
531+
_ = arr.map { v in
532+
switch v {
533+
case .id: return true // expected-error {{value of tuple type '(Test.ID, Test.E)' has no member 'id'}}
534+
}
535+
}
536+
}
537+
}

utils/build-presets.ini

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,6 @@ lldb-use-system-debugserver
539539
release-debuginfo
540540
assertions
541541

542-
# We need to build an unoptimized swift benchmark driver for stepper testing.
543-
# Ditto for the swift stdlib. (LLDB doesn't support stepping through optimized
544-
# swift code yet.)
545-
extra-cmake-options=-DSWIFT_BENCHMARK_UNOPTIMIZED_DRIVER:BOOL=1
546-
debug-swift-stdlib
547-
548542
# Disable non-x86 building/testing.
549543
skip-build-ios
550544
skip-test-ios

0 commit comments

Comments
 (0)