Skip to content

Commit

Permalink
LoadableByAddress: Make sure that indirect return arguments are at th…
Browse files Browse the repository at this point in the history
…e right type expansion

rdar://70220886
  • Loading branch information
aschwaighofer committed Oct 15, 2020
1 parent d35cb3c commit 18777bf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/IRGen/LoadableByAddress.cpp
Expand Up @@ -1407,7 +1407,8 @@ void LoadableStorageAllocation::insertIndirectReturnArgs() {
canType = genEnv->mapTypeIntoContext(canType)->getCanonicalType();
}
resultStorageType = SILType::getPrimitiveObjectType(canType);
auto newResultStorageType = pass.getNewSILType(loweredTy, resultStorageType);
auto newResultStorageType =
pass.F->getLoweredType(pass.getNewSILType(loweredTy, resultStorageType));

auto &ctx = pass.F->getModule().getASTContext();
auto var = new (ctx) ParamDecl(
Expand Down
26 changes: 26 additions & 0 deletions test/IRGen/big_types_generic.swift
Expand Up @@ -67,3 +67,29 @@ func useStuff() {
print(generic2(1).0)
print(generic2(1).1)
}


public struct BigThing<T> {
var x: (Int64, Int64, Int64, Int64) = (0, 0, 0, 0)
var y: (Int64, Int64, Int64, Int64) = (0, 0, 0, 0)
var z: (Int64, Int64, Int64, Int64) = (0, 0, 0, 0)
}

public protocol P {}

public protocol Assoc {
associatedtype A
func foo() -> A
}

extension Int : P {}

public struct DefineSome : Assoc {
public func foo() -> some P {
return 5
}
}

public func abiIndirect() -> BigThing<DefineSome.A> {
return BigThing<DefineSome.A>()
}

0 comments on commit 18777bf

Please sign in to comment.