diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index 7dd527b4d1035..d99855556fd45 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -2088,7 +2088,7 @@ class ParameterTypeFlags { return value.toRaw() != other.value.toRaw(); } - uint8_t toRaw() const { return value.toRaw(); } + uint16_t toRaw() const { return value.toRaw(); } }; class YieldTypeFlags { diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index c3072f51ce25c..f22134061c37c 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -1932,7 +1932,7 @@ static ConstraintSystem::TypeMatchResult matchCallArguments( locator->getAnchor().isExpr(ExprKind::UnresolvedMemberChainResult)) { locator = cs.getConstraintLocator(cast( - locator->getAnchor().get())->getChainBase()); + locator->getAnchor().get())->getSubExpr()); } cs.recordFix(NotCompileTimeConst::create(cs, paramTy, locator)); } diff --git a/test/Sema/const_enum_elements2.swift b/test/Sema/const_enum_elements2.swift new file mode 100644 index 0000000000000..35a6ef25e2d73 --- /dev/null +++ b/test/Sema/const_enum_elements2.swift @@ -0,0 +1,12 @@ +// RUN: %target-typecheck-verify-swift + +enum E { + case a + case b(Int) + + var c: E { .b(42) } +} + +func test(_: _const E) {} + +test(.a.c) // expected-error {{expect a compile-time constant literal}}