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
1 change: 1 addition & 0 deletions src/error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
// BI1051 Internal error: Don't know how to get attributes for {0}. Please file a bug report (http://bugzilla.xamarin.com) with a test case.
// BI1052 Internal error: Could not find the type {0} in the assembly {1}. Please file a bug report (http://bugzilla.xamarin.com) with a test case.
// BI1053 Internal error: unknown target framework '{0}'.
// BI1060 The {0} protocol is decorated with [Model], but not [BaseType]. Please verify that [Model] is relevant for this protocol; if so, add [BaseType] as well, otherwise remove [Model].
// BI11xx warnings
// BI1101 Trying to use a string as a [Target]
// BI1102 Using the deprecated EventArgs for a delegate signature in {0}.{1}, please use DelegateName instead
Expand Down
10 changes: 3 additions & 7 deletions src/generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,6 @@ string ParameterGetMarshalType (MarshalInfo mai, bool formatted = false)
throw new BindingException (1017, true, "Do not know how to make a signature for {0}", mai.Type);
}

static HashSet<Type> missing_base_type_warning_shown = new HashSet<Type> ();
static bool IsProtocolInterface (Type type, bool checkPrefix = true)
{
// for subclassing the type (from the binding files) is not yet prefixed by an `I`
Expand Down Expand Up @@ -5451,12 +5450,9 @@ public void Generate (Type type)
if (is_protocol) {
if (is_static_class)
throw new BindingException (1025, true, "[Static] and [Protocol] are mutually exclusive ({0})", type.FullName);
if (is_model && base_type == TypeManager.System_Object){
if (!missing_base_type_warning_shown.Contains (type)){
missing_base_type_warning_shown.Add (type);
Console.WriteLine ("Warning, protocol {0} does not have a BaseType, wont generate the class, only the interface and extensions class", type.FullName);
}
}
if (is_model && base_type == TypeManager.System_Object)
throw new BindingException (1060, true, "The {0} protocol is decorated with [Model], but not [BaseType]. Please verify that [Model] is relevant for this protocol; if so, add [BaseType] as well, otherwise remove [Model].", type.FullName);

var protocol = AttributeManager.GetCustomAttribute<ProtocolAttribute> (type);
GenerateProtocolTypes (type, class_visibility, TypeName, protocol.Name ?? objc_type_name, protocol);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/generator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include $(TOP)/Make.config
IOS_CURRENT_DIR=$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current
IOS_GENERATOR = $(IOS_CURRENT_DIR)/bin/btouch-native /baselib:$(IOS_CURRENT_DIR)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll /unsafe
IOS_TESTS = bug15283 bug15307 bug15799 bug16036 sof20696157 bug23041 bug27430 bug27428 bug34042 btouch-with-hyphen-in-name property-redefination-ios arrayfromhandlebug bug36457 bug39614 bug40282 bug17232 bug24078-ignore-methods-events strong-dict-support-templated-dicts bug43579 bindastests
IOS_CUSTOM_TESTS = forum54078 desk63279 desk79124 multiple-api-definitions1 multiple-api-definitions2 bug29493 classNameCollision bi1036 bug37527 bug27986 bug35176 bi1046 bindas1048error bindas1049error bindas1050modelerror bindas1050protocolerror virtualwrap
IOS_CUSTOM_TESTS = forum54078 desk63279 desk79124 multiple-api-definitions1 multiple-api-definitions2 bug29493 classNameCollision bi1036 bug37527 bug27986 bug35176 bi1046 bindas1048error bindas1049error bindas1050modelerror bindas1050protocolerror virtualwrap bug42855

MAC_CURRENT_DIR=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current
MAC_GENERATOR = $(MAC_CURRENT_DIR)/bin/bmac
Expand Down Expand Up @@ -61,6 +61,7 @@ $(eval $(call iOSErrorCodeTestTemplate,bindas1048error,1048))
$(eval $(call iOSErrorCodeTestTemplate,bindas1049error,1049))
$(eval $(call iOSErrorCodeTestTemplate,bindas1050modelerror,1050))
$(eval $(call iOSErrorCodeTestTemplate,bindas1050protocolerror,1050))
$(eval $(call iOSErrorCodeTestTemplate,bug42855,1060))

classNameCollision:
@rm -Rf $@.tmpdir
Expand Down
16 changes: 16 additions & 0 deletions tests/generator/bug42855.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Foundation;

namespace Bug42855Tests {

[Protocol][Model]
interface MyFooClass {

[Abstract]
[Export ("stringMethod:")]
NSString StringMethod (int arg1);

[Export ("stringMethod2:")]
NSString StringMethod2 (int arg1);
}
}