From b89a54e5c68df4d4d9b39512accd3a69b082cbba Mon Sep 17 00:00:00 2001
From: Russ Cox
-asserts that the value stored in x
is of type T
.
+asserts that x
is not the zero interface value
+and that the value stored in x
is of type T
.
The notation x.(T)
is called a type assertion.
The type of x
must be an interface type.
x
is identical to the type T
(§Type identity and compatibility).
If T
is an interface type, x.(T)
asserts that the dynamic type
of T
implements the interface T
(§Interface types).
-TODO: gri wants an error if x is already of type T.
If the type assertion holds, the value of the expression is the value -- 2.48.1