Skip to content

Commit d90f251

Browse files
authored
TypeSpecialization contains all TypeCtors (#3676)
and it reference TypeCtor in the documentation, so make it reference TypeCtor in the grammar directly.
1 parent 04c2db8 commit d90f251

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

spec/expression.dd

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,6 +2726,7 @@ $(GNAME IsExpression):
27262726

27272727
$(GNAME TypeSpecialization):
27282728
$(GLINK2 type, Type)
2729+
$(GLINK2 type, TypeCtor)
27292730
$(D struct)
27302731
$(D union)
27312732
$(D class)
@@ -2735,10 +2736,6 @@ $(GNAME TypeSpecialization):
27352736
$(D function)
27362737
$(D delegate)
27372738
$(D super)
2738-
$(D const)
2739-
$(D immutable)
2740-
$(D inout)
2741-
$(D shared)
27422739
$(D return)
27432740
$(D __parameters)
27442741
$(D module)
@@ -2835,6 +2832,18 @@ alias Bar = short;
28352832
static assert(is(Bar == short));
28362833
static assert(!is(Bar == int));
28372834
-------------
2835+
)
2836+
$(P
2837+
If *TypeSpecialization* is a $(GLINK2 type, TypeCtor)
2838+
then the condition is satisfied if *Type* is of that *TypeCtor*:
2839+
)
2840+
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
2841+
---
2842+
static assert(is(const int == const));
2843+
static assert(is(const int[] == const));
2844+
static assert(!is(const(int)[] == const)); // head is mutable
2845+
static assert(!is(immutable int == const));
2846+
---
28382847
)
28392848
$(P
28402849
If $(I TypeSpecialization) is one of
@@ -2885,22 +2894,6 @@ static assert(!is(int == class));
28852894
static assert(is(typeof(foo) == __parameters));
28862895
---
28872896
)
2888-
$(P
2889-
If *TypeSpecialization* is a $(GLINK2 type, TypeCtor) keyword
2890-
$(D const)
2891-
$(D immutable)
2892-
$(D inout)
2893-
$(D shared)
2894-
then the condition is satisfied if *Type* is of that *TypeCtor*:
2895-
)
2896-
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
2897-
---
2898-
static assert(is(const int == const));
2899-
static assert(is(const int[] == const));
2900-
static assert(!is(const(int)[] == const)); // head is mutable
2901-
static assert(!is(immutable int == const));
2902-
---
2903-
)
29042897
$(P $(B See also:) $(DDLINK spec/traits, Traits, Traits).)
29052898

29062899

0 commit comments

Comments
 (0)