From 735337d5e68ea0ddf7a450316ea2f10149d79048 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Thu, 8 Feb 2018 14:35:35 -0500 Subject: [PATCH] [metadata] Implement MONO_CLASS_IS_INTERFACE(c) in terms of public API Althought it was previously defined in a public API header, the macro was not usable for the last several years since it was implemented in terms of the MonoClass definition which was not visible in the public API. There is a subtle semantic change here: mono_type_is_generic_parameter will return FALSE if it's given a byref type parameter, the previous definition of the macro would return TRUE. (E.g. if you had "class F" then IS_INTERFACE("T&") used to return TRUE but will now return FALSE. ) --- mono/metadata/metadata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mono/metadata/metadata.h b/mono/metadata/metadata.h index b6e48e8389c..b78b54be5c0 100644 --- a/mono/metadata/metadata.h +++ b/mono/metadata/metadata.h @@ -19,7 +19,7 @@ MONO_BEGIN_DECLS #define MONO_TYPE_IS_POINTER(t) mono_type_is_pointer (t) #define MONO_TYPE_IS_REFERENCE(t) mono_type_is_reference (t) -#define MONO_CLASS_IS_INTERFACE(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR)) +#define MONO_CLASS_IS_INTERFACE(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_INTERFACE) || mono_type_is_generic_parameter (mono_class_get_type (c))) #define MONO_CLASS_IS_IMPORT(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_IMPORT)) -- 2.11.4.GIT