File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2181,7 +2181,7 @@ if (isCallable!func)
2181
2181
2182
2182
2183
2183
/**
2184
- Get the function type from a callable object `func`.
2184
+ Get the function type from a callable object `func`, or from a function pointer/delegate type .
2185
2185
2186
2186
Using builtin `typeof` on a property function yields the types of the
2187
2187
property value, not of the property function itself. Still,
@@ -2229,10 +2229,17 @@ if (isCallable!func)
2229
2229
{
2230
2230
class C
2231
2231
{
2232
- int value () @property { return 0 ; }
2232
+ int value () @property => 0 ;
2233
+ static string opCall () => " hi" ;
2233
2234
}
2234
2235
static assert (is ( typeof (C.value) == int ));
2235
2236
static assert (is ( FunctionTypeOf! (C.value) == function ));
2237
+ static assert (is ( FunctionTypeOf! C == typeof (C.opCall ) ));
2238
+
2239
+ int function () fp;
2240
+ alias IntFn = int ();
2241
+ static assert (is ( typeof (fp) == IntFn* ));
2242
+ static assert (is ( FunctionTypeOf! fp == IntFn ));
2236
2243
}
2237
2244
2238
2245
@system unittest
You can’t perform that action at this time.
0 commit comments