Bug 57797 - BindAs attribute for smart enums of an array of nullable values generates code that doesn't compile
Summary: BindAs attribute for smart enums of an array of nullable values generates cod...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: master
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-06-27 14:56 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2017-11-13 17:02 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: No
Last known good build:


Attachments

Description Rolf Bjarne Kvinge [MSFT] 2017-06-27 14:56:51 UTC
Code:

	[BindAs (typeof (AVMediaTypes?[]))]
	[Export ("strongNullableAVMediaTypesProperties:")]
	NSString[] StrongNullableAVMediaTypesProperties { get; set; }

results in:

	error CS1026: ) expected
	error CS1056: Unexpected character '`'
	error CS1003: Syntax error, ',' expected
	error CS1003: Syntax error, ']' expected
	error CS1003: Syntax error, ',' expected
	error CS1003: Syntax error, ',' expected
	error CS1003: Syntax error, ',' expected
	error CS1026: ) expected
	error CS1001: Identifier expected
	error CS1031: Type expected
	error CS1022: Type or namespace definition, or end-of-file expected
	error CS0116: A namespace cannot directly contain members such as fields or methods
	error CS1022: Type or namespace definition, or end-of-file expected
	error CS8124: Tuple must contain at least two elements.
	error CS1022: Type or namespace definition, or end-of-file expected
	error CS1022: Type or namespace definition, or end-of-file expected

I think the easiest here would be to disallow this in the generator, at least until we know there's a need for it.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2017-06-27 18:51:42 UTC
Another test case, with NSValue instead of smart enum:

	[Export ("PCATransform3DNullableArray")]
	[BindAs (typeof (CATransform3D?[]))]
	NSValue[] PCATransform3DNullableArrayValue { get; set; }
Comment 2 Alex Soto [MSFT] 2017-11-03 04:39:18 UTC
PR: https://github.com/xamarin/xamarin-macios/pull/2954
Comment 3 Alex Soto [MSFT] 2017-11-09 01:14:00 UTC
The PR was updated to show an error because registrar wasn't happy and kept the generator changes so whenever we implement this we still generate valid code.

PR: https://github.com/xamarin/xamarin-macios/pull/2954

Awaiting Rolf's review.
Comment 4 Alex Soto [MSFT] 2017-11-13 17:02:57 UTC
Fixed in xamarin-macios/master @ https://github.com/xamarin/xamarin-macios/commit/ee19c79febbe2a56bc67ad106248aa96abce0353

Note You need to log in before you can comment on or make changes to this bug.