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
17 changes: 17 additions & 0 deletions tests/linker/ios/link all/LinkAllTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,23 @@ void CheckAsyncTaskMethodBuilder (Type atmb)
Assert.Null (oifd, atmb.FullName + ".ObjectIdForDebugger");
#endif
}

[Test]
public void LinkedAwayGenericTypeAsOptionalMemberInProtocol ()
{
// https://github.com/xamarin/xamarin-macios/issues/3523
// This test will fail at build time if it regresses (usually these types of build tests go into monotouch-test, but monotouch-test uses NSSet<T> elsewhere, which this test requires to be linked away).
Assert.IsNull (typeof (NSObject).Assembly.GetType (NamespacePrefix + "Foundation.NSSet`1"), "NSSet<T> must be linked away, otherwise this test is useless");
}

[Protocol (Name = "ProtocolWithGenericsInOptionalMember", WrapperType = typeof (ProtocolWithGenericsInOptionalMemberWrapper))]
[ProtocolMember (IsRequired = false, IsProperty = false, IsStatic = false, Name = "ConfigureView", Selector = "configureViewForParameters:", ParameterType = new Type [] { typeof (global::Foundation.NSSet<global::Foundation.NSString>) }, ParameterByRef = new bool [] { false })]
public interface IProtocolWithGenericsInOptionalMember : INativeObject, IDisposable { }

internal sealed class ProtocolWithGenericsInOptionalMemberWrapper : BaseWrapper, IProtocolWithGenericsInOptionalMember
{
public ProtocolWithGenericsInOptionalMemberWrapper (IntPtr handle, bool owns) : base (handle, owns) { }
}
}

[Introduced (PlatformName.MacOSX, 1, 0, PlatformArchitecture.Arch64)]
Expand Down
2 changes: 1 addition & 1 deletion tests/linker/ios/link all/link all.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<MtouchI18n>mideast,other</MtouchI18n>
<MtouchArch>i386, x86_64</MtouchArch>
<DefineConstants>LINKALL;;$(DefineConstants)</DefineConstants>
<MtouchExtraArgs>--optimize=all,-remove-dynamic-registrar</MtouchExtraArgs>
<MtouchExtraArgs>--registrar:static --optimize=all,-remove-dynamic-registrar</MtouchExtraArgs>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
Expand Down
2 changes: 2 additions & 0 deletions tools/common/StaticRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@ TypeDefinition ResolveType (TypeReference tr)
// this method if there's an actual need.
if (tr is ArrayType arrayType) {
return arrayType.ElementType.Resolve ();
} else if (tr is GenericInstanceType git) {
return ResolveType (git.ElementType);
} else {
var td = tr.Resolve ();
if (td == null)
Expand Down