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
4 changes: 2 additions & 2 deletions lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3059,8 +3059,8 @@ operator()(SubstitutableType *maybeOpaqueType) const {
}))
return maybeOpaqueType;

// If the type still contains opaque types, recur.
if (substTy->hasOpaqueArchetype()) {
// If the type changed, but still contains opaque types, recur.
if (!substTy->isEqual(maybeOpaqueType) && substTy->hasOpaqueArchetype()) {
return ::substOpaqueTypesWithUnderlyingTypes(
substTy, inContext, contextExpansion, isContextWholeModule);
}
Expand Down
11 changes: 11 additions & 0 deletions test/SILGen/Inputs/replace_opaque_type_public_assoc_type_m.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public protocol Gesture {
associatedtype Body: Gesture
var body: Body { get }

associatedtype Value
var value: Value { get }
}

extension Gesture {
public var value: Body.Value { return body.value }
}
14 changes: 14 additions & 0 deletions test/SILGen/replace_opaque_type_public_assoc_type.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -disable-availability-checking -emit-module-path %t/replace_opaque_type_public_assoc_type_m.swiftmodule %S/Inputs/replace_opaque_type_public_assoc_type_m.swift
// RUN: %target-swift-emit-silgen -disable-availability-checking -I %t %s -verify

import replace_opaque_type_public_assoc_type_m

struct PiggyBack: Gesture {
var action: () -> Void

var body: some Gesture {
action()
return self
}
}