Skip to content

Commit 6949799

Browse files
authored
Merge pull request #4250 from ntrel/is-keyword
[spec/expression] Extend `is(T == keyword)` example
2 parents 0168c43 + f388c8a commit 6949799

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

spec/expression.dd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3269,9 +3269,16 @@ static assert(!is(immutable int == const));
32693269
)
32703270
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
32713271
---
3272+
Object o;
3273+
static assert(!is(o == class)); // `o` is not a type
32723274
static assert(is(Object == class));
32733275
static assert(is(ModuleInfo == struct));
32743276
static assert(!is(int == class));
3277+
3278+
void f();
3279+
static assert(!is(f == function)); // `f` is not a type
3280+
static assert(is(typeof(f) == function));
3281+
static assert(!is(typeof(&f) == function)); // function pointer is not a function
32753282
---
32763283
)
32773284
$(P The `module` and `package` forms are satisfied when *Type* is a symbol, not a *type*,

0 commit comments

Comments
 (0)