From edd27e120eca13be1754d4111dfc3cf2ab2f99f8 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 14 Aug 2021 10:14:51 +0900 Subject: A comment for typed data in `rb_check_type` [ci skip] --- error.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index 5ac0f0913e..ef01e94044 100644 --- a/error.c +++ b/error.c @@ -1007,6 +1007,14 @@ rb_check_type(VALUE x, int t) xt = TYPE(x); if (xt != t || (xt == T_DATA && RTYPEDDATA_P(x))) { + /* + * Typed data is not simple `T_DATA`, but in a sense an + * extension of `struct RVALUE`, which are incompatible with + * each other except when inherited. + * + * So it is not enough to just check `T_DATA`, it must be + * identified by its `type` using `Check_TypedStruct` instead. + */ unexpected_type(x, xt, t); } } -- cgit v1.2.1