diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs index 49a2f61401c..e9da9a22fdd 100644 --- a/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs @@ -277,6 +277,7 @@ public override string ToString () sb.Append ($"IsSmartEnum: {IsSmartEnum}, "); sb.Append ($"IsArray: {IsArray}, "); sb.Append ($"IsReferenceType: {IsReferenceType}, "); + sb.Append ($"IsStruct: {IsStruct}, "); sb.Append ($"IsVoid : {IsVoid}, "); sb.Append ($"IsNSObject : {IsNSObject}, "); sb.Append ($"IsNativeObject: {IsINativeObject}, "); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/TestDataFactory.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/TestDataFactory.cs index 275b5448b5b..5c28ac2e00d 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/TestDataFactory.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/TestDataFactory.cs @@ -40,7 +40,8 @@ public static TypeInfo ReturnTypeForInt (bool isNullable = false) name: "int", specialType: SpecialType.System_Int32, isBlittable: !isNullable, - isNullable: isNullable + isNullable: isNullable, + isStruct: true ) { Parents = ["System.ValueType", "object"], Interfaces = isNullable @@ -86,7 +87,8 @@ public static TypeInfo ReturnTypeForIntPtr (bool isNullable = false) name: "nint", specialType: SpecialType.System_IntPtr, isBlittable: !isNullable, - isNullable: isNullable + isNullable: isNullable, + isStruct: true ) { Parents = ["System.ValueType", "object"], Interfaces = isNullable @@ -132,7 +134,8 @@ public static TypeInfo ReturnTypeForBool () => new ( name: "bool", specialType: SpecialType.System_Boolean, - isBlittable: false + isBlittable: false, + isStruct: true ) { Parents = ["System.ValueType", "object"], Interfaces = [ @@ -147,7 +150,7 @@ public static TypeInfo ReturnTypeForBool () }; public static TypeInfo ReturnTypeForVoid () - => new ("void", SpecialType.System_Void) { Parents = ["System.ValueType", "object"], }; + => new ("void", SpecialType.System_Void, isStruct: true) { Parents = ["System.ValueType", "object"], }; public static TypeInfo ReturnTypeForClass (string className, bool isNullable = false) => new ( @@ -174,7 +177,8 @@ public static TypeInfo ReturnTypeForInterface (string interfaceName) public static TypeInfo ReturnTypeForStruct (string structName) => new ( - name: structName + name: structName, + isStruct: true ) { Parents = ["System.ValueType", "object"] }; public static TypeInfo ReturnTypeForEnum (string enumName, bool isSmartEnum = false, bool isNativeEnum = false)