Skip to content

Commit 5bc3b99

Browse files
committed
[move-only] Only require AST level noncopyable types to have an ownership specifier.
Otherwise, we cannot parse our own compiler output around guaranteed boxes. I discovered this when writing tests for the next commit. rdar://105635396
1 parent 9597195 commit 5bc3b99

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,19 +2261,26 @@ bool TypeResolver::diagnoseMoveOnly(TypeRepr *repr, Type genericArgTy) {
22612261
bool TypeResolver::diagnoseMoveOnlyMissingOwnership(
22622262
TypeRepr *repr,
22632263
TypeResolutionOptions options) {
2264-
// only required on function inputs.
2265-
// we can ignore InoutFunctionInput since it's already got ownership.
2264+
// Though this is only required on function inputs... we can ignore
2265+
// InoutFunctionInput since it's already got ownership.
22662266
if (!options.is(TypeResolverContext::FunctionInput))
22672267
return false;
22682268

2269-
// enum cases don't need to specify ownership for associated values
2269+
// Enum cases don't need to specify ownership for associated values
22702270
if (options.hasBase(TypeResolverContext::EnumElementDecl))
22712271
return false;
22722272

2273-
// otherwise, we require ownership.
2273+
// Otherwise, we require ownership.
22742274
if (options.contains(TypeResolutionFlags::HasOwnership))
22752275
return false;
22762276

2277+
// Do not run this on SIL files since there is currently a bug where we are
2278+
// trying to parse it in SILBoxes.
2279+
//
2280+
// To track what we want to do long term: rdar://105635373.
2281+
if (options.contains(TypeResolutionFlags::SILType))
2282+
return false;
2283+
22772284
diagnose(repr->getLoc(),
22782285
diag::moveonly_parameter_missing_ownership);
22792286

0 commit comments

Comments
 (0)