Explorar o código

Rename `Type` -> `type`, per #2360. (#2507)

Also make minor updates to the skeletal design in
docs/design/name_lookup.md following #2113, as there are no longer any prelude names that are made available to unqualified name lookup by default.

Add `type` to the keyword list in
docs/design/lexical_conventions/words.md, following #2360.
Richard Smith %!s(int64=3) %!d(string=hai) anos
pai
achega
4daaa4866f
Modificáronse 100 ficheiros con 428 adicións e 427 borrados
  1. 1 1
      common/fuzzing/proto_to_carbon.cpp
  2. 11 11
      docs/design/README.md
  3. 1 1
      docs/design/classes.md
  4. 11 11
      docs/design/expressions/arithmetic.md
  5. 3 3
      docs/design/expressions/as_expressions.md
  6. 11 11
      docs/design/expressions/bitwise.md
  7. 3 3
      docs/design/expressions/comparison_operators.md
  8. 11 11
      docs/design/expressions/if.md
  9. 1 1
      docs/design/expressions/implicit_conversions.md
  10. 9 9
      docs/design/expressions/indexing.md
  11. 3 3
      docs/design/expressions/literals.md
  12. 6 6
      docs/design/expressions/member_access.md
  13. 136 135
      docs/design/generics/details.md
  14. 4 4
      docs/design/generics/overview.md
  15. 8 8
      docs/design/generics/terminology.md
  16. 1 0
      docs/design/lexical_conventions/words.md
  17. 7 8
      docs/design/name_lookup.md
  18. 4 4
      docs/design/sum_types.md
  19. 2 2
      docs/design/templates.md
  20. 1 1
      explorer/ast/declaration.h
  21. 1 1
      explorer/ast/expression.cpp
  22. 2 2
      explorer/ast/expression.h
  23. 42 42
      explorer/data/prelude.carbon
  24. 1 1
      explorer/interpreter/action_stack.cpp
  25. 2 2
      explorer/interpreter/impl_scope.h
  26. 2 2
      explorer/interpreter/interpreter.cpp
  27. 7 7
      explorer/interpreter/type_checker.cpp
  28. 2 2
      explorer/interpreter/value.cpp
  29. 4 4
      explorer/interpreter/value.h
  30. 1 1
      explorer/syntax/lexer.lpp
  31. 1 1
      explorer/testdata/alias/function_alias.carbon
  32. 2 2
      explorer/testdata/alias/interface_alias.carbon
  33. 2 2
      explorer/testdata/array/element_convertible_to_type.carbon
  34. 1 1
      explorer/testdata/as/fail_destination_not_type.carbon
  35. 1 1
      explorer/testdata/assoc_const/fail_anonymous.carbon
  36. 1 1
      explorer/testdata/assoc_const/fail_different_type.carbon
  37. 3 3
      explorer/testdata/assoc_const/fail_equal_indirectly.carbon
  38. 1 1
      explorer/testdata/assoc_const/fail_equal_to_dependent_type.carbon
  39. 2 2
      explorer/testdata/assoc_const/fail_implied_constraints.carbon
  40. 3 3
      explorer/testdata/assoc_const/fail_incomplete_impl_1.carbon
  41. 3 3
      explorer/testdata/assoc_const/fail_incomplete_impl_2.carbon
  42. 1 1
      explorer/testdata/assoc_const/fail_indirectly_equal.carbon
  43. 3 3
      explorer/testdata/assoc_const/fail_match_in_deduction.carbon
  44. 1 1
      explorer/testdata/assoc_const/fail_missing_equal.carbon
  45. 1 1
      explorer/testdata/assoc_const/fail_missing_rewrite.carbon
  46. 3 3
      explorer/testdata/assoc_const/fail_multi_impl_scoping.carbon
  47. 5 5
      explorer/testdata/assoc_const/fail_multiple_deduction.carbon
  48. 1 1
      explorer/testdata/assoc_const/fail_overspecified_impl.carbon
  49. 2 2
      explorer/testdata/assoc_const/fail_redefined.carbon
  50. 1 1
      explorer/testdata/assoc_const/fail_rewrite_creates_infinite_type.carbon
  51. 10 10
      explorer/testdata/assoc_const/fail_rewrite_cycle.carbon
  52. 1 1
      explorer/testdata/assoc_const/fail_rewrite_depends_on_later_rewrite.carbon
  53. 2 2
      explorer/testdata/assoc_const/fail_simple_rewrite_cycle_1.carbon
  54. 2 2
      explorer/testdata/assoc_const/fail_simple_rewrite_cycle_2.carbon
  55. 1 1
      explorer/testdata/assoc_const/fail_unknown_value.carbon
  56. 1 1
      explorer/testdata/assoc_const/fail_unknown_value_specified_in_constraint.carbon
  57. 1 1
      explorer/testdata/assoc_const/impl_lookup.carbon
  58. 2 2
      explorer/testdata/assoc_const/impl_used_by_later_rewrite.carbon
  59. 1 1
      explorer/testdata/assoc_const/pass_equal_to_rewrite.carbon
  60. 1 1
      explorer/testdata/assoc_const/pass_rewrite_to_equal.carbon
  61. 10 10
      explorer/testdata/assoc_const/resolve_rewrites.carbon
  62. 1 1
      explorer/testdata/assoc_const/rewrite_depends_on_prior_rewrite.carbon
  63. 7 7
      explorer/testdata/assoc_const/rewrite_interface_params.carbon
  64. 8 8
      explorer/testdata/assoc_const/rewrite_large_type.carbon
  65. 1 1
      explorer/testdata/assoc_const/simple_constraint.carbon
  66. 1 1
      explorer/testdata/assoc_const/simple_equality.carbon
  67. 1 1
      explorer/testdata/basic_syntax/fail_alternative_not_type.carbon
  68. 1 1
      explorer/testdata/basic_syntax/fail_nested_binding.carbon
  69. 1 1
      explorer/testdata/basic_syntax/fail_var_type.carbon
  70. 1 1
      explorer/testdata/choice/generic_choice_multiple_template_arguments.carbon
  71. 2 2
      explorer/testdata/choice/generic_choice_nested_in_template_class.carbon
  72. 1 1
      explorer/testdata/choice/generic_choice_simple_assignment.carbon
  73. 1 1
      explorer/testdata/choice/type_of_type.carbon
  74. 1 1
      explorer/testdata/class/fail_extends_non_class.carbon
  75. 1 1
      explorer/testdata/class/fail_member_call_before_typecheck.carbon
  76. 1 1
      explorer/testdata/class/fail_method_deduced.carbon
  77. 1 1
      explorer/testdata/class/type_of_type.carbon
  78. 1 1
      explorer/testdata/constraint/binding_self.carbon
  79. 1 1
      explorer/testdata/constraint/fail_dot_self_after_scope.carbon
  80. 1 1
      explorer/testdata/constraint/fail_dot_self_after_scope_2.carbon
  81. 1 1
      explorer/testdata/constraint/fail_non_type_self.carbon
  82. 1 1
      explorer/testdata/constraint/fail_where_equals_different_types.carbon
  83. 1 1
      explorer/testdata/constraint/fail_where_non_type_is.carbon
  84. 1 1
      explorer/testdata/constraint/rewrite.carbon
  85. 1 1
      explorer/testdata/constraint/rewrite_compound.carbon
  86. 1 1
      explorer/testdata/constraint/rewrite_in_qualifier.carbon
  87. 2 2
      explorer/testdata/constraint/rewrite_in_qualifier_and_type.carbon
  88. 1 1
      explorer/testdata/constraint/type_of_type.carbon
  89. 1 1
      explorer/testdata/constraint/where_is.carbon
  90. 2 2
      explorer/testdata/constraint/where_self.carbon
  91. 3 3
      explorer/testdata/experimental_continuation/convert_run.carbon
  92. 1 1
      explorer/testdata/function/auto_return/modify_arg_type.carbon
  93. 1 1
      explorer/testdata/function/auto_return/modify_return_type.carbon
  94. 1 1
      explorer/testdata/function/auto_return/type.carbon
  95. 1 1
      explorer/testdata/function/fail_parameter_type.carbon
  96. 1 1
      explorer/testdata/function/fail_recurse_before_typecheck.carbon
  97. 1 1
      explorer/testdata/function/fail_return_call_has_invalid_body.carbon
  98. 1 1
      explorer/testdata/function/fail_var_type_is_call.carbon
  99. 2 2
      explorer/testdata/function/return_convertible_to_type.carbon
  100. 3 3
      explorer/testdata/generic_class/convert_from_struct.carbon

+ 1 - 1
common/fuzzing/proto_to_carbon.cpp

@@ -371,7 +371,7 @@ static auto ExpressionToCarbon(const Fuzzing::Expression& expression,
       break;
 
     case Fuzzing::Expression::kTypeTypeLiteral:
-      out << "Type";
+      out << "type";
       break;
 
     case Fuzzing::Expression::kUnimplementedExpression:

+ 11 - 11
docs/design/README.md

@@ -2583,10 +2583,10 @@ given any type `T` that implements the `Ordered` interface. Subsequent calls to
 `Ordered`.
 
 The parameter could alternatively be declared to be a _template_ generic
-parameter by prefixing with the `template` keyword, as in `template T:! Type`.
+parameter by prefixing with the `template` keyword, as in `template T:! type`.
 
 ```carbon
-fn Convert[template T:! Type](source: T, template U:! Type) -> U {
+fn Convert[template T:! type](source: T, template U:! type) -> U {
   var converted: U = source;
   return converted;
 }
@@ -2621,7 +2621,7 @@ declaration, and the condition can only use constant values known at
 type-checking time, including `template` parameters.
 
 ```carbon
-class Array(template T:! Type, template N:! i64)
+class Array(template T:! type, template N:! i64)
     if N >= 0 and N < MaxArraySize / sizeof(T);
 ```
 
@@ -2630,7 +2630,7 @@ provided by the caller, _in addition_ to any constraints. This means member name
 lookup and type checking for anything
 [dependent](generics/terminology.md#dependent-names) on the template parameter
 can't be completed until the template is instantiated with a specific concrete
-type. When the constraint is just `Type`, this gives semantics similar to C++
+type. When the constraint is just `type`, this gives semantics similar to C++
 templates. Constraints can then be added incrementally, with the compiler
 verifying that the semantics stay the same. Once all constraints have been
 added, removing the word `template` to switch to a checked parameter is safe.
@@ -2825,7 +2825,7 @@ to a class must be generic, and so defined with `:!`, either with or without the
 type `T`:
 
 ```carbon
-class Stack(T:! Type) {
+class Stack(T:! type) {
   fn Push[addr self: Self*](value: T);
   fn Pop[addr self: Self*]() -> T;
 
@@ -2847,7 +2847,7 @@ The values of type parameters are part of a type's value, and so may be deduced
 in a function call, as in this example:
 
 ```carbon
-fn PeekTopOfStack[T:! Type](s: Stack(T)*) -> T {
+fn PeekTopOfStack[T:! type](s: Stack(T)*) -> T {
   var top: T = s->Pop();
   s->Push(top);
   return top;
@@ -2868,7 +2868,7 @@ PeekTopOfStack(&int_stack);
 [Choice types](#choice-types) may be parameterized similarly to classes:
 
 ```carbon
-choice Result(T:! Type, Error:! Type) {
+choice Result(T:! type, Error:! type) {
   Success(value: T),
   Failure(error: Error)
 }
@@ -2880,7 +2880,7 @@ Interfaces are always parameterized by a `Self` type, but in some cases they
 will have additional parameters.
 
 ```carbon
-interface AddWith(U:! Type);
+interface AddWith(U:! type);
 ```
 
 Interfaces without parameters may only be implemented once for a given type, but
@@ -2904,11 +2904,11 @@ parameter list_`]` after the `impl` keyword introducer, as in:
 
 ```carbon
 external impl forall [T:! Printable] Vector(T) as Printable;
-external impl forall [Key:! Hashable, Value:! Type]
+external impl forall [Key:! Hashable, Value:! type]
     HashMap(Key, Value) as Has(Key);
 external impl forall [T:! Ordered] T as PartiallyOrdered;
 external impl forall [T:! ImplicitAs(i32)] BigInt as AddWith(T);
-external impl forall [U:! Type, T:! As(U)]
+external impl forall [U:! type, T:! As(U)]
     Optional(T) as As(Optional(U));
 ```
 
@@ -3123,7 +3123,7 @@ There are some situations where the common type for two types is needed:
     will be set to the common type of the corresponding arguments, as in:
 
     ```carbon
-    fn F[T:! Type](x: T, y: T);
+    fn F[T:! type](x: T, y: T);
 
     // Calls `F` with `T` set to the
     // common type of `G()` and `H()`:

+ 1 - 1
docs/design/classes.md

@@ -1084,7 +1084,7 @@ Other type constants can be defined using a `let` declaration:
 ```
 class MyClass {
   let Pi:! f32 = 3.141592653589793;
-  let IndexType:! Type = i32;
+  let IndexType:! type = i32;
 }
 ```
 

+ 11 - 11
docs/design/expressions/arithmetic.md

@@ -193,15 +193,15 @@ following family of interfaces:
 ```
 // Unary `-`.
 interface Negate {
-  let Result:! Type = Self;
+  let Result:! type = Self;
   fn Op[self: Self]() -> Result;
 }
 ```
 
 ```
 // Binary `+`.
-interface AddWith(U:! Type) {
-  let Result:! Type = Self;
+interface AddWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Add {
@@ -211,8 +211,8 @@ constraint Add {
 
 ```
 // Binary `-`.
-interface SubWith(U:! Type) {
-  let Result:! Type = Self;
+interface SubWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Sub {
@@ -222,8 +222,8 @@ constraint Sub {
 
 ```
 // Binary `*`.
-interface MulWith(U:! Type) {
-  let Result:! Type = Self;
+interface MulWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Mul {
@@ -233,8 +233,8 @@ constraint Mul {
 
 ```
 // Binary `/`.
-interface DivWith(U:! Type) {
-  let Result:! Type = Self;
+interface DivWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Div {
@@ -244,8 +244,8 @@ constraint Div {
 
 ```
 // Binary `%`.
-interface ModWith(U:! Type) {
-  let Result:! Type = Self;
+interface ModWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Mod {

+ 3 - 3
docs/design/expressions/as_expressions.md

@@ -78,7 +78,7 @@ var m: auto = b as T as U;
 ```
 
 **Note:** `b as (bool as Hashable)` is valid but not useful, because
-[the second operand of `as` is implicitly converted to type `Type`](#extensibility).
+[the second operand of `as` is implicitly converted to type `type`](#extensibility).
 This expression therefore has the same interpretation as `b as bool`.
 
 **TODO:** We should consider making `as` expressions left-associative now that
@@ -164,7 +164,7 @@ Explicit casts can be defined for user-defined types such as
 [classes](../classes.md) by implementing the `As` interface:
 
 ```
-interface As(Dest:! Type) {
+interface As(Dest:! type) {
   fn Convert[self: Self]() -> Dest;
 }
 ```
@@ -172,7 +172,7 @@ interface As(Dest:! Type) {
 The expression `x as U` is rewritten to `x.(As(U).Convert)()`.
 
 **Note:** This rewrite causes the expression `U` to be implicitly converted to
-type `Type`. The program is invalid if this conversion is not possible.
+type `type`. The program is invalid if this conversion is not possible.
 
 ## Alternatives considered
 

+ 11 - 11
docs/design/expressions/bitwise.md

@@ -197,15 +197,15 @@ implementing the following family of interfaces:
 ```
 // Unary `^`.
 interface BitComplement {
-  let Result:! Type = Self;
+  let Result:! type = Self;
   fn Op[self: Self]() -> Result;
 }
 ```
 
 ```
 // Binary `&`.
-interface BitAndWith(U:! Type) {
-  let Result:! Type = Self;
+interface BitAndWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint BitAnd {
@@ -215,8 +215,8 @@ constraint BitAnd {
 
 ```
 // Binary `|`.
-interface BitOrWith(U:! Type) {
-  let Result:! Type = Self;
+interface BitOrWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint BitOr {
@@ -226,8 +226,8 @@ constraint BitOr {
 
 ```
 // Binary `^`.
-interface BitXorWith(U:! Type) {
-  let Result:! Type = Self;
+interface BitXorWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint BitXor {
@@ -237,8 +237,8 @@ constraint BitXor {
 
 ```
 // Binary `<<`.
-interface LeftShiftWith(U:! Type) {
-  let Result:! Type = Self;
+interface LeftShiftWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint LeftShift {
@@ -248,8 +248,8 @@ constraint LeftShift {
 
 ```
 // Binary `>>`.
-interface RightShiftWith(U:! Type) {
-  let Result:! Type = Self;
+interface RightShiftWith(U:! type) {
+  let Result:! type = Self;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint RightShift {

+ 3 - 3
docs/design/expressions/comparison_operators.md

@@ -253,7 +253,7 @@ The `EqWith` interface is used to define the semantics of the `==` and `!=`
 operators for a given pair of types:
 
 ```
-interface EqWith(U:! Type) {
+interface EqWith(U:! type) {
   fn Equal[self: Self](u: U) -> bool;
   default fn NotEqual[self: Self](u: U) -> bool {
     return not (self == u);
@@ -353,7 +353,7 @@ choice Ordering {
   Greater,
   Incomparable
 }
-interface OrderedWith(U:! Type) {
+interface OrderedWith(U:! type) {
   fn Compare[self: Self](u: U) -> Ordering;
   default fn Less[self: Self](u: U) -> bool {
     return self.Compare(u) == Ordering.Less;
@@ -432,7 +432,7 @@ implemented. The behaviors of such overrides should follow those of the above
 default implementations, and the members of an `OrderedWith` implementation
 should have no observable side-effects.
 
-`OrderedWith` implementations should be _transitive_. That is, given `V:! Type`,
+`OrderedWith` implementations should be _transitive_. That is, given `V:! type`,
 `U:! OrderedWith(V)`, `T:! OrderedWith(U) & OrderedWith(V)`, `a: T`, `b: U`,
 `c: V`, then:
 

+ 11 - 11
docs/design/expressions/if.md

@@ -87,8 +87,8 @@ The interface `CommonTypeWith` is used to customize the behavior of
 `CommonType`:
 
 ```
-interface CommonTypeWith(U:! Type) {
-  let Result:! Type
+interface CommonTypeWith(U:! type) {
+  let Result:! type
     where Self is ImplicitAs(.Self) and
           U is ImplicitAs(.Self);
 }
@@ -120,15 +120,15 @@ The interface `SymmetricCommonTypeWith` is an implementation detail of the
 `CommonType` constraint. It is defined and implemented as follows:
 
 ```
-interface SymmetricCommonTypeWith(U:! Type) {
-  let Result:! Type
+interface SymmetricCommonTypeWith(U:! type) {
+  let Result:! type
     where Self is ImplicitAs(.Self) and
           U is ImplicitAs(.Self);
 }
 match_first {
-  impl forall [T:! Type, U:! CommonTypeWith(T)]
+  impl forall [T:! type, U:! CommonTypeWith(T)]
       T as SymmetricCommonTypeWith(U) where .Result = U.Result {}
-  impl forall [U:! Type, T:! CommonTypeWith(U)]
+  impl forall [U:! type, T:! CommonTypeWith(U)]
       T as SymmetricCommonTypeWith(U) where .Result = T.Result {}
 }
 ```
@@ -152,10 +152,10 @@ the `CommonType` constraint is not met. For example, given:
 
 ```
 // Implementation #1
-impl forall [T:! Type] MyX as CommonTypeWith(T) where .Result = MyX {}
+impl forall [T:! type] MyX as CommonTypeWith(T) where .Result = MyX {}
 
 // Implementation #2
-impl forall [T:! Type] MyY as CommonTypeWith(T) where .Result = MyY {}
+impl forall [T:! type] MyY as CommonTypeWith(T) where .Result = MyY {}
 ```
 
 `MyX as CommonTypeWith(MyY)` will select #1, and `MyY as CommonTypeWith(MyX)`
@@ -167,7 +167,7 @@ because result types differ.
 If `T` is the same type as `U`, the result is that type:
 
 ```
-final impl forall [T:! Type] T as CommonTypeWith(T) where .Result = T {}
+final impl forall [T:! type] T as CommonTypeWith(T) where .Result = T {}
 ```
 
 _Note:_ This rule is intended to be considered more specialized than the other
@@ -175,7 +175,7 @@ rules in this document.
 
 Because this `impl` is declared `final`, `T.(CommonType(T)).Result` is always
 assumed to be `T`, even in contexts where `T` involves a generic parameter and
-so the result would normally be an unknown type whose type-of-type is `Type`.
+so the result would normally be an unknown type whose type-of-type is `type`.
 
 ```
 fn F[T:! Hashable](c: bool, x: T, y: T) -> HashCode {
@@ -189,7 +189,7 @@ fn F[T:! Hashable](c: bool, x: T, y: T) -> HashCode {
 If `T` implicitly converts to `U`, the common type is `U`:
 
 ```
-impl forall [T:! Type, U:! ImplicitAs(T)]
+impl forall [T:! type, U:! ImplicitAs(T)]
     T as CommonTypeWith(U) where .Result = T {}
 ```
 

+ 1 - 1
docs/design/expressions/implicit_conversions.md

@@ -207,7 +207,7 @@ extends
 [the `As` interface used to implement `as` expressions](as_expressions.md#extensibility):
 
 ```
-interface ImplicitAs(Dest:! Type) {
+interface ImplicitAs(Dest:! type) {
   extends As(Dest);
   // Inherited from As(Dest):
   // fn Convert[self: Self]() -> Dest;

+ 9 - 9
docs/design/expressions/indexing.md

@@ -48,13 +48,13 @@ left-to-right with all of them.
 Its semantics are defined in terms of the following interfaces:
 
 ```
-interface IndexWith(SubscriptType:! Type) {
-  let ElementType:! Type;
+interface IndexWith(SubscriptType:! type) {
+  let ElementType:! type;
   fn At[me: Self](subscript: SubscriptType) -> ElementType;
   fn Addr[addr me: Self*](subscript: SubscriptType) -> ElementType*;
 }
 
-interface IndirectIndexWith(SubscriptType:! Type) {
+interface IndirectIndexWith(SubscriptType:! type) {
   impl as IndexWith(SubscriptType);
   fn Addr[me: Self](subscript: SubscriptType) -> ElementType*;
 }
@@ -75,9 +75,9 @@ implement `IndirectIndexWith(I)`:
 
 ```
 final external impl forall
-    [SubscriptType:! Type, T:! IndirectIndexWith(SubscriptType)]
+    [SubscriptType:! type, T:! IndirectIndexWith(SubscriptType)]
     T as IndexWith(SubscriptType) {
-  let ElementType:! Type = T.(IndirectIndexWith(SubscriptType)).ElementType;
+  let ElementType:! type = T.(IndirectIndexWith(SubscriptType)).ElementType;
   fn At[me: Self](subscript: SubscriptType) -> ElementType {
     return *(me.(IndirectIndexWith(SubscriptType).Addr)(index));
   }
@@ -95,9 +95,9 @@ its own definitions of `IndexWith.At` and `IndexWith.Addr`.
 An array type could implement subscripting like so:
 
 ```
-class Array(template T:! Type) {
+class Array(template T:! type) {
   external impl as IndexWith(like i64) {
-    let ElementType:! Type = T;
+    let ElementType:! type = T;
     fn At[me: Self](subscript: i64) -> T;
     fn Addr[addr me: Self*](subscript: i64) -> T*;
   }
@@ -107,9 +107,9 @@ class Array(template T:! Type) {
 And a type such as `std::span` could look like this:
 
 ```
-class Span(T:! Type) {
+class Span(T:! type) {
   external impl as IndirectIndexWith(like i64) {
-    let ElementType:! Type = T;
+    let ElementType:! type = T;
     fn Addr[me: Self](subscript: i64) -> T*;
   }
 }

+ 3 - 3
docs/design/expressions/literals.md

@@ -75,7 +75,7 @@ and binary integer literals, and decimal and hexadecimal real number literals.
 The following types are defined in the Carbon prelude:
 
 -   `Core.BigInt`, an arbitrary-precision integer type;
--   `Core.Rational(T:! Type)`, a rational type, parameterized by a type used for
+-   `Core.Rational(T:! type)`, a rational type, parameterized by a type used for
     its numerator and denominator -- the exact constraints on `T` are not yet
     decided;
 -   `Core.IntLiteral(N:! Core.BigInt)`, a type representing integer literals;
@@ -145,7 +145,7 @@ var z: f64 = 1.0 / 3.0;
 // This is an error: 300 cannot be represented in type `i8`.
 var c: i8 = 300;
 
-fn F[template T:! Type](v: T) {
+fn F[template T:! type](v: T) {
   var x: i32 = v * 2;
 }
 
@@ -156,7 +156,7 @@ F(1_000_000_000);
 F(2_000_000_000);
 
 // No storage required for the bound when it's of integer literal type.
-struct Span(template T:! Type, template BoundT:! Type) {
+struct Span(template T:! type, template BoundT:! type) {
   var begin: T*;
   var bound: BoundT;
 }

+ 6 - 6
docs/design/expressions/member_access.md

@@ -204,18 +204,18 @@ parameter is unknown. Evaluation of an expression involving the parameter may
 still succeed, but will result in a symbolic value involving that parameter.
 
 ```
-class GenericWrapper(T:! Type) {
+class GenericWrapper(T:! type) {
   var field: T;
 }
-fn F[T:! Type](x: GenericWrapper(T)) -> T {
+fn F[T:! type](x: GenericWrapper(T)) -> T {
   // ✅ OK, finds `GenericWrapper(T).field`.
   return x.field;
 }
 
-class TemplateWrapper(template T:! Type) {
+class TemplateWrapper(template T:! type) {
   var field: T;
 }
-fn G[template T:! Type](x: TemplateWrapper(T)) -> T {
+fn G[template T:! type](x: TemplateWrapper(T)) -> T {
   // 🤷 Not yet decided.
   return x.field;
 }
@@ -564,10 +564,10 @@ fn CallStaticMethod(c: C) {
   c.(C.field) = 1;
 
   // ✅ OK
-  let T:! Type = C.Nested;
+  let T:! type = C.Nested;
   // ❌ Error: value of `:!` binding is not constant because it
   // refers to local variable `c`.
-  let U:! Type = c.Nested;
+  let U:! type = c.Nested;
 }
 ```
 

+ 136 - 135
docs/design/generics/details.md

@@ -181,7 +181,7 @@ interface contains enough information to
 [type and definition check](terminology.md#complete-definition-checking) the
 function body -- you can only call functions defined in the interface in the
 function body. Contrast this with making the type a template argument, where you
-could just use `Type` instead of an interface and it will work as long as the
+could just use `type` instead of an interface and it will work as long as the
 function is only called with types that allow the definition of the function to
 compile. The interface bound has other benefits:
 
@@ -748,7 +748,7 @@ defining a witness table type like:
 class Vector {
   // `Self` is the representation type, which is only
   // known at compile time.
-  var Self:! Type;
+  var Self:! type;
   // `fnty` is **placeholder** syntax for a "function type",
   // so `Add` is a function that takes two `Self` parameters
   // and returns a value of type `Self`.
@@ -887,17 +887,18 @@ whenever an interface may be. This includes all of these
 
 We don't expect developers to directly define many named constraints, but other
 constructs we do expect them to use will be defined in terms of them. For
-example, we can define the Carbon builtin `Type` as:
+example, if `type` were not a keyword, we could define the Carbon builtin `type`
+as:
 
 ```
-constraint Type { }
+constraint type { }
 ```
 
-That is, `Type` is the type-of-type with no requirements (so matches every
+That is, `type` is the type-of-type with no requirements (so matches every
 type), and defines no names.
 
 ```
-fn Identity[T:! Type](x: T) -> T {
+fn Identity[T:! type](x: T) -> T {
   // Can accept values of any type. But, since we know nothing about the
   // type, we don't know about any operations on `x` inside this function.
   return x;
@@ -907,7 +908,7 @@ var i: i32 = Identity(3);
 var s: String = Identity("string");
 ```
 
-**Aside:** We can define `auto` as syntactic sugar for `(template _:! Type)`.
+**Aside:** We can define `auto` as syntactic sugar for `(template _:! type)`.
 This definition allows you to use `auto` as the type for a local variable whose
 type can be statically determined by the compiler. It also allows you to use
 `auto` as the type of a function parameter, to mean "accepts a value of any
@@ -1308,11 +1309,11 @@ in parameters or constraints of the interface being extended.
 ```
 // A type can implement `ConvertibleTo` many times, using
 // different values of `T`.
-interface ConvertibleTo(T:! Type) { ... }
+interface ConvertibleTo(T:! type) { ... }
 
 // A type can only implement `PreferredConversion` once.
 interface PreferredConversion {
-  let AssociatedType:! Type;
+  let AssociatedType:! type;
   extends ConvertibleTo(AssociatedType);
 }
 ```
@@ -1644,7 +1645,7 @@ Consider a type with a generic type parameter, like a hash map:
 
 ```
 interface Hashable { ... }
-class HashMap(KeyT:! Hashable, ValueT:! Type) {
+class HashMap(KeyT:! Hashable, ValueT:! type) {
   fn Find[self: Self](key: KeyT) -> Optional(ValueT);
   // ...
 }
@@ -1831,7 +1832,7 @@ use to the adapter instead:
 
 ```
 adapter ComparableFromDifferenceFn
-    (T:! Type, Difference:! fnty(T, T)->i32) for T {
+    (T:! type, Difference:! fnty(T, T)->i32) for T {
   impl as Comparable {
     fn Less[self: Self](rhs: Self) -> bool {
       return Difference(self, rhs) < 0;
@@ -2060,7 +2061,7 @@ name. For example:
 
 ```
 interface StackAssociatedType {
-  let ElementType:! Type;
+  let ElementType:! type;
   fn Push[addr self: Self*](value: ElementType);
   fn Pop[addr self: Self*]() -> ElementType;
   fn IsEmpty[addr self: Self*]() -> bool;
@@ -2074,7 +2075,7 @@ of `StackAssociatedType` must also define. For example, maybe `DynamicArray`
 implements `StackAssociatedType`:
 
 ```
-class DynamicArray(T:! Type) {
+class DynamicArray(T:! type) {
   class IteratorType { ... }
   fn Begin[addr self: Self*]() -> IteratorType;
   fn End[addr self: Self*]() -> IteratorType;
@@ -2160,7 +2161,7 @@ interface Container {
   ...
 }
 
-class DynamicArray(T:! Type) {
+class DynamicArray(T:! type) {
   ...
   impl as Container {
     class IteratorType {
@@ -2198,13 +2199,13 @@ interface Container {
 is represented by:
 
 ```
-class Iterator(Self:! Type) {
+class Iterator(Self:! type) {
   var Advance: fnty(this: Self*);
   ...
 }
-class Container(Self:! Type) {
+class Container(Self:! type) {
   // Representation type for the iterator.
-  let IteratorType:! Type;
+  let IteratorType:! type;
   // Witness that IteratorType implements Iterator.
   var iterator_impl: Iterator(IteratorType)*;
 
@@ -2228,7 +2229,7 @@ associated types, write a parameter list after the name of the interface instead
 of the associated type declaration:
 
 ```
-interface StackParameterized(ElementType:! Type) {
+interface StackParameterized(ElementType:! type) {
   fn Push[addr self: Self*](value: ElementType);
   fn Pop[addr self: Self*]() -> ElementType;
   fn IsEmpty[addr self: Self*]() -> bool;
@@ -2275,7 +2276,7 @@ for `StackParameterized(T)` it would generate a compile error:
 ```
 // ❌ Error: can't deduce interface parameter `T`.
 fn BrokenPeekAtTopOfStackParameterized
-    [T:! Type, StackType:! StackParameterized(T)]
+    [T:! type, StackType:! StackParameterized(T)]
     (s: StackType*) -> T { ... }
 ```
 
@@ -2286,7 +2287,7 @@ explicit parameters.
 
 ```
 fn PeekAtTopOfStackParameterized
-    [T:! Type, StackType:! StackParameterized(T)]
+    [T:! type, StackType:! StackParameterized(T)]
     (s: StackType*, _:! singleton_type_of(T)) -> T { ... }
 
 var produce: Produce = ...;
@@ -2308,7 +2309,7 @@ be comparable with multiple other types, and in fact interfaces for
 [operator overloads](#operator-overloading) more generally. Example:
 
 ```
-interface EquatableWith(T:! Type) {
+interface EquatableWith(T:! type) {
   fn Equals[self: Self](rhs: T) -> bool;
   ...
 }
@@ -2337,7 +2338,7 @@ could be an interface parameter:
 
 ```
 interface ReadTupleMember(index:! u32) {
-  let T:! Type;
+  let T:! type;
   // Returns self[index]
   fn Get[self: Self]() -> T;
 }
@@ -2350,10 +2351,10 @@ indices to be associated with different types.
 parameters are required to always be different. For example:
 
 ```
-interface Map(FromType:! Type, ToType:! Type) {
+interface Map(FromType:! type, ToType:! type) {
   fn Map[addr self: Self*](needle: FromType) -> Optional(ToType);
 }
-class Bijection(FromType:! Type, ToType:! Type) {
+class Bijection(FromType:! type, ToType:! type) {
   impl as Map(FromType, ToType) { ... }
   impl as Map(ToType, FromType) { ... }
 }
@@ -2366,10 +2367,10 @@ contain the `impl` for the reverse map lookup, instead of implementing the `Map`
 interface twice:
 
 ```
-class Bijection(FromType:! Type, ToType:! Type) {
+class Bijection(FromType:! type, ToType:! type) {
   impl as Map(FromType, ToType) { ... }
 }
-adapter ReverseLookup(FromType:! Type, ToType:! Type)
+adapter ReverseLookup(FromType:! type, ToType:! type)
     for Bijection(FromType, ToType) {
   impl as Map(ToType, FromType) { ... }
 }
@@ -2581,11 +2582,11 @@ example, we could make the `ElementType` of an `Iterator` interface equal to the
 
 ```
 interface Iterator {
-  let ElementType:! Type;
+  let ElementType:! type;
   ...
 }
 interface Container {
-  let ElementType:! Type;
+  let ElementType:! type;
   let IteratorType:! Iterator where .ElementType == ElementType;
   ...
 }
@@ -2595,8 +2596,8 @@ Given an interface with two associated types
 
 ```
 interface PairInterface {
-  let Left:! Type;
-  let Right:! Type;
+  let Left:! type;
+  let Right:! type;
 }
 ```
 
@@ -2685,7 +2686,7 @@ must satisfy the `Comparable` interface.
 
 ```
 interface Container {
-  let ElementType:! Type;
+  let ElementType:! type;
   ...
 }
 
@@ -2702,7 +2703,7 @@ type-of-type.
 following Swift, but maybe we should have another operator that more clearly
 returns a boolean like `has_type`?
 
-**Note:** `Container` defines `ElementType` as having type `Type`, but
+**Note:** `Container` defines `ElementType` as having type `type`, but
 `ContainerType.ElementType` has type `Comparable`. This is because
 `ContainerType` has type `Container where .ElementType is Comparable`, not
 `Container`. This means we need to be a bit careful when talking about the type
@@ -2822,7 +2823,7 @@ defined.
 
 ```
 interface Container {
-  let ElementType:! Type;
+  let ElementType:! type;
 
   let SliceType:! Container
       where .ElementType == ElementType and
@@ -2852,7 +2853,7 @@ Note that using the `constraint` approach we can name these constraints using
 
 The `.Self` construct follows these rules:
 
--   `X :!` introduces `.Self:! Type`, where references to `.Self` are resolved
+-   `X :!` introduces `.Self:! type`, where references to `.Self` are resolved
     to `X`. This allows you to use `.Self` as an interface parameter as in
     `X:! I(.Self)`.
 -   `A where` introduces `.Self:! A` and `.Foo` for each member `Foo` of `A`
@@ -2864,7 +2865,7 @@ The `.Self` construct follows these rules:
 
 So in `X:! A where ...`, `.Self` is introduced twice, after the `:!` and the
 `where`. This is allowed since both times it means `X`. After the `:!`, `.Self`
-has the type `Type`, which gets refined to `A` after the `where`. In contrast,
+has the type `type`, which gets refined to `A` after the `where`. In contrast,
 it is an error if `.Self` could mean two different things, as in:
 
 ```
@@ -2881,14 +2882,14 @@ addition the function needs the result to implement a specific interface.
 
 ```
 // Some parameterized type.
-class Vector(T:! Type) { ... }
+class Vector(T:! type) { ... }
 
 // Parameterized type implements interface only for some arguments.
 external impl Vector(String) as Printable { ... }
 
 // Constraint: `T` such that `Vector(T)` implements `Printable`
 fn PrintThree
-    [T:! Type where Vector(.Self) is Printable]
+    [T:! type where Vector(.Self) is Printable]
     (a: T, b: T, c: T) {
   var v: Vector(T) = (a, b, c);
   Print(v);
@@ -2907,7 +2908,7 @@ For example, we might need a type parameter `T` to support explicit conversion
 from an integer type like `i32`:
 
 ```
-interface As(T:! Type) {
+interface As(T:! type) {
   fn Convert[self: Self]() -> T;
 }
 
@@ -2924,7 +2925,7 @@ current type. This means referring to some
 `.MemberName`, or [`.Self`](#recursive-constraints). Examples:
 
 -   `Container where .ElementType = i32`
--   `Type where Vector(.Self) is Sortable`
+-   `type where Vector(.Self) is Sortable`
 -   `Addable where i32 is AddableWith(.Result)`
 
 Constraints that only refer to other types should be moved to the type that is
@@ -2932,23 +2933,23 @@ declared last. So:
 
 ```carbon
 // ❌ Error: `where A == B` does not use `.Self` or a designator
-fn F[A:! Type, B:! Type, C:! Type where A == B](a: A, b: B, c: C);
+fn F[A:! type, B:! type, C:! type where A == B](a: A, b: B, c: C);
 ```
 
 must be replaced by:
 
 ```carbon
 // ✅ Allowed
-fn F[A:! Type, B:! Type where A == .Self, C:! Type](a: A, b: B, c: C);
+fn F[A:! type, B:! type where A == .Self, C:! type](a: A, b: B, c: C);
 ```
 
 This includes `where` clauses used in an `impl` declaration:
 
 ```
 // ❌ Error: `where T is B` does not use `.Self` or a designator
-external impl forall [T:! Type] T as A where T is B {}
+external impl forall [T:! type] T as A where T is B {}
 // ✅ Allowed
-external impl forall [T:! Type where .Self is B] T as A {}
+external impl forall [T:! type where .Self is B] T as A {}
 // ✅ Allowed
 external impl forall [T:! B] T as A {}
 ```
@@ -2966,7 +2967,7 @@ redundant ways to express a restriction, following the
 Imagine we have a generic function that accepts an arbitrary `HashMap`:
 
 ```
-fn LookUp[KeyType:! Type](hm: HashMap(KeyType, i32)*,
+fn LookUp[KeyType:! type](hm: HashMap(KeyType, i32)*,
                           k: KeyType) -> i32;
 
 fn PrintValueOrDefault[KeyType:! Printable,
@@ -2988,7 +2989,7 @@ Effectively that means that these functions are automatically rewritten to add a
 `where` constraint on `KeyType` attached to the `HashMap` type:
 
 ```
-fn LookUp[KeyType:! Type]
+fn LookUp[KeyType:! type]
     (hm: HashMap(KeyType, i32)*
         where KeyType is Hashable & EqualityComparable & Movable,
      k: KeyType) -> i32;
@@ -3023,7 +3024,7 @@ limited to a single signature. Consider this interface declaration:
 
 ```
 interface GraphNode {
-  let Edge:! Type;
+  let Edge:! type;
   fn EdgesFrom[self: Self]() -> HashSet(Edge);
 }
 ```
@@ -3056,14 +3057,14 @@ constraint feature would ensure all of its requirements were met. The developer
 can create a trivial
 [parameterized type implements interface](#parameterized-type-implements-interface)
 `where` constraint to just say the type is a legal with this argument, by saying
-that the parameterized type implements `Type`, which all types do.
+that the parameterized type implements `type`, which all types do.
 
 For example, a function that adds its parameters to a `HashSet` to deduplicate
 them, needs them to be `Hashable` and so on. To say "`T` is a type where
 `HashSet(T)` is legal," we can write:
 
 ```
-fn NumDistinct[T:! Type where HashSet(.Self) is Type]
+fn NumDistinct[T:! type where HashSet(.Self) is type]
     (a: T, b: T, c: T) -> i32 {
   var set: HashSet(T);
   set.Add(a);
@@ -3340,16 +3341,16 @@ subtypes of `T`.
 
 ```
 fn F[T:! Extends(BaseType)](p: T*);
-fn UpCast[T:! Type](p: T*, U:! Type where T is Extends(.Self)) -> U*;
-fn DownCast[T:! Type](p: T*, U:! Extends(T)) -> U*;
+fn UpCast[T:! type](p: T*, U:! type where T is Extends(.Self)) -> U*;
+fn DownCast[T:! type](p: T*, U:! Extends(T)) -> U*;
 ```
 
 **Open question:** Alternatively, we could define a new `extends` operator:
 
 ```
-fn F[T:! Type where .Self extends BaseType](p: T*);
-fn UpCast[T:! Type](p: T*, U:! Type where T extends .Self) -> U*;
-fn DownCast[T:! Type](p: T*, U:! Type where .Self extends T) -> U*;
+fn F[T:! type where .Self extends BaseType](p: T*);
+fn UpCast[T:! type](p: T*, U:! type where T extends .Self) -> U*;
+fn DownCast[T:! type](p: T*, U:! type where .Self extends T) -> U*;
 ```
 
 **Comparison to other languages:** In Swift, you can
@@ -3375,7 +3376,7 @@ Specifically, given two types `T1` and `T2`, they are equivalent if
 they may not be deduced. Specifically, this code would be illegal:
 
 ```
-fn Illegal[U:! Type, T:! CompatibleWith(U)](x: T*) ...
+fn Illegal[U:! type, T:! CompatibleWith(U)](x: T*) ...
 ```
 
 In general there would be multiple choices for `U` given a specific `T` here,
@@ -3383,7 +3384,7 @@ and no good way of picking one. However, similar code is allowed if there is
 another way of determining `U`:
 
 ```
-fn Allowed[U:! Type, T:! CompatibleWith(U)](x: U*, y: T*) ...
+fn Allowed[U:! type, T:! CompatibleWith(U)](x: U*, y: T*) ...
 ```
 
 #### Same implementation restriction
@@ -3403,7 +3404,7 @@ class HashSet(T:! Hashable) { ... }
 Then `HashSet(T)` may be cast to `HashSet(U)` if
 `T is CompatibleWith(U, Hashable)`. The one-parameter interpretation of
 `CompatibleWith(U)` is recovered by letting the default for the second `TT`
-parameter be `Type`.
+parameter be `type`.
 
 #### Example: Multiple implementations of the same interface
 
@@ -3415,7 +3416,7 @@ enum CompareResult { Less, Equal, Greater }
 interface Comparable {
   fn Compare[self: Self](rhs: Self) -> CompareResult;
 }
-fn CombinedLess[T:! Type](a: T, b: T,
+fn CombinedLess[T:! type](a: T, b: T,
                           U:! CompatibleWith(T) & Comparable,
                           V:! CompatibleWith(T) & Comparable) -> bool {
   match ((a as U).Compare(b as U)) {
@@ -3442,7 +3443,7 @@ assert(CombinedLess(s1, s2, SongByArtist, SongByTitle) == True);
 We might generalize this to a list of implementations:
 
 ```
-fn CombinedCompare[T:! Type]
+fn CombinedCompare[T:! type]
     (a: T, b: T, CompareList:! List(CompatibleWith(T) & Comparable))
     -> CompareResult {
   for (let U:! auto in CompareList) {
@@ -3469,7 +3470,7 @@ combine `CompatibleWith` with [type adaptation](#adapting-types):
 
 ```
 adapter ThenCompare(
-      T:! Type,
+      T:! type,
       CompareList:! List(CompatibleWith(T) & Comparable))
     for T {
   impl as Comparable {
@@ -3545,7 +3546,7 @@ class Name {
   ...
 }
 
-fn F[T:! Type](x: T*) {  // T is unsized.
+fn F[T:! type](x: T*) {  // T is unsized.
   // ✅ Allowed: may access unsized values through a pointer.
   var y: T* = x;
   // ❌ Illegal: T is unsized.
@@ -3592,11 +3593,11 @@ relegate these capabilities to an interface called `TypeId` that all types
 automatically implement. This way generic code can indicate that it needs those
 capabilities by including `TypeId` in the list of requirements. In the case
 where no type capabilities are needed, for example the code is only manipulating
-pointers to the type, you would write `T:! Type` and get the efficiency of
+pointers to the type, you would write `T:! type` and get the efficiency of
 `void*` but without giving up type safety.
 
 ```
-fn SortByAddress[T:! Type](v: Vector(T*)*) { ... }
+fn SortByAddress[T:! type](v: Vector(T*)*) { ... }
 ```
 
 In particular, the compiler should in general avoid monomorphizing to generate
@@ -3701,7 +3702,7 @@ Interfaces may be implemented for a parameterized type. This can be done
 lexically in the class' scope:
 
 ```
-class Vector(T:! Type) {
+class Vector(T:! type) {
   impl as Iterable where .ElementType = T {
     ...
   }
@@ -3711,7 +3712,7 @@ class Vector(T:! Type) {
 This is equivalent to naming the type between `impl` and `as`:
 
 ```
-class Vector(T:! Type) {
+class Vector(T:! type) {
   impl Vector(T) as Iterable where .ElementType = T {
     ...
   }
@@ -3723,7 +3724,7 @@ keyword before `impl`. External impls may also be declared out-of-line, but all
 parameters must be declared in a `forall` clause:
 
 ```
-external impl forall [T:! Type] Vector(T) as Iterable
+external impl forall [T:! type] Vector(T) as Iterable
     where .ElementType = T {
   ...
 }
@@ -3733,7 +3734,7 @@ The parameter for the type can be used as an argument to the interface being
 implemented:
 
 ```
-class HashMap(Key:! Hashable, Value:! Type) {
+class HashMap(Key:! Hashable, Value:! type) {
   impl as Has(Key) { ... }
   impl as Contains(HashSet(Key)) { ... }
 }
@@ -3742,10 +3743,10 @@ class HashMap(Key:! Hashable, Value:! Type) {
 or externally out-of-line:
 
 ```
-class HashMap(Key:! Hashable, Value:! Type) { ... }
-external impl forall [Key:! Hashable, Value:! Type]
+class HashMap(Key:! Hashable, Value:! type) { ... }
+external impl forall [Key:! Hashable, Value:! type]
     HashMap(Key, Value) as Has(Key) { ... }
-external impl forall [Key:! Hashable, Value:! Type]
+external impl forall [Key:! Hashable, Value:! type]
     HashMap(Key, Value) as Contains(HashSet(Key)) { ... }
 ```
 
@@ -3771,9 +3772,9 @@ To do this with an [out-of-line `impl`](#external-impl), specify a more-specific
 interface Printable {
   fn Print[self: Self]();
 }
-class Vector(T:! Type) { ... }
+class Vector(T:! type) { ... }
 
-// By saying "T:! Printable" instead of "T:! Type" here,
+// By saying "T:! Printable" instead of "T:! type" here,
 // we constrain T to be Printable for this impl.
 external impl forall [T:! Printable] Vector(T) as Printable {
   fn Print[self: Self]() {
@@ -3790,7 +3791,7 @@ To define these `impl`s inline in a `class` definition, include a `forall`
 clause with a more-specific type between the `impl` and `as` keywords.
 
 ```
-class Array(T:! Type, template N:! i64) {
+class Array(T:! type, template N:! i64) {
   impl forall [P:! Printable] Array(P, N) as Printable { ... }
 }
 ```
@@ -3813,15 +3814,15 @@ example, the interface `Foo(T)` is only implemented when the two types are
 equal.
 
 ```
-interface Foo(T:! Type) { ... }
-class Pair(T:! Type, U:! Type) { ... }
-external impl forall [T:! Type] Pair(T, T) as Foo(T) { ... }
+interface Foo(T:! type) { ... }
+class Pair(T:! type, U:! type) { ... }
+external impl forall [T:! type] Pair(T, T) as Foo(T) { ... }
 ```
 
 You may also define the `impl` inline, in which case it can be internal:
 
 ```
-class Pair(T:! Type, U:! Type) {
+class Pair(T:! type, U:! type) {
   impl Pair(T, T) as Foo(T) { ... }
 }
 ```
@@ -3834,7 +3835,7 @@ types may not implement two different interfaces internally if they share a
 member name, even if their conditions are mutually exclusive:
 
 ```
-class X(T:! Type) {
+class X(T:! type) {
   impl X(i32) as Foo {
     fn F[self: Self]();
   }
@@ -3849,7 +3850,7 @@ However, the same interface may be implemented multiple times as long as there
 is no overlap in the conditions:
 
 ```
-class X(T:! Type) {
+class X(T:! type) {
   impl X(i32) as Foo {
     fn F[self: Self]();
   }
@@ -3878,7 +3879,7 @@ a vector type that only has a `Sort` method if its elements implement the
 `Comparable` interface:
 
 ```
-class Vector(T:! Type) {
+class Vector(T:! type) {
   // `Vector(T)` has a `Sort()` method if `T` is `Comparable`.
   fn Sort[C:! Comparable, addr self: Vector(C)*]();
 }
@@ -3908,7 +3909,7 @@ where blanket impls arise:
 -   `T` implements `CommonType(T)` for all `T`
 
     ```
-    external impl forall [T:! Type] T as CommonType(T)
+    external impl forall [T:! type] T as CommonType(T)
         where .Result = T { }
     ```
 
@@ -3954,7 +3955,7 @@ The different kinds of parameters to impls may be combined. For example, if `T`
 implements `As(U)`, then this implements `As(Optional(U))` for `Optional(T)`:
 
 ```
-external impl forall [U:! Type, T:! As(U)]
+external impl forall [U:! type, T:! As(U)]
   Optional(T) as As(Optional(U)) { ... }
 ```
 
@@ -4119,14 +4120,14 @@ considered to form cycles with themselves:
 
 ```
 impl forall [T:! Printable] Optional(T) as Printable;
-impl forall [T:! Type, U:! ComparableTo(T)] U as ComparableTo(Optional(T));
+impl forall [T:! type, U:! ComparableTo(T)] U as ComparableTo(Optional(T));
 ```
 
 **Example:** If `T` implements `ComparableWith(U)`, then `U` should implement
 `ComparableWith(T)`.
 
 ```
-external impl forall [U:! Type, T:! ComparableWith(U)]
+external impl forall [U:! type, T:! ComparableWith(U)]
     U as ComparableWith(T);
 ```
 
@@ -4142,11 +4143,11 @@ class Y {}
 class N {}
 interface True {}
 impl Y as True {}
-interface Z(T:! Type) { let Cond:! Type; }
+interface Z(T:! type) { let Cond:! type; }
 match_first {
-  impl forall [T:! Type, U:! Z(T) where .Cond is True] T as Z(U)
+  impl forall [T:! type, U:! Z(T) where .Cond is True] T as Z(U)
       where .Cond = N { }
-  impl forall [T:! Type, U:! Type] T as Z(U)
+  impl forall [T:! type, U:! type] T as Z(U)
       where .Cond = Y { }
 }
 ```
@@ -4171,13 +4172,13 @@ There is no reason to to prefer one of these outcomes over the other.
 class A {}
 class B {}
 class C {}
-interface D(T:! Type) { let Cond:! Type; }
+interface D(T:! type) { let Cond:! type; }
 match_first {
-  impl forall [T:! Type, U:! D(T) where .Cond = B] T as D(U)
+  impl forall [T:! type, U:! D(T) where .Cond = B] T as D(U)
       where .Cond = C { }
-  impl forall [T:! Type, U:! D(T) where .Cond = A] T as D(U)
+  impl forall [T:! type, U:! D(T) where .Cond = A] T as D(U)
       where .Cond = B { }
-  impl forall [T:! Type, U:! Type] T as D(U)
+  impl forall [T:! type, U:! type] T as D(U)
       where .Cond = A { }
 }
 ```
@@ -4227,7 +4228,7 @@ determining whether a type implements an interface could run forever.
 the result of a single impl:
 
 ```
-impl forall [A:! Type where Optional(.Self) is B] A as B { ... }
+impl forall [A:! type where Optional(.Self) is B] A as B { ... }
 ```
 
 This problem can also result from a chain of impls, as in `A is B` if `A* is C`,
@@ -4258,25 +4259,25 @@ generic function call, such as using an operator:
 ```
 // Interface defining the behavior of the prefix-* operator
 interface Deref {
-  let Result:! Type;
+  let Result:! type;
   fn DoDeref[self: Self]() -> Result;
 }
 
 // Types implementing `Deref`
-class Ptr(T:! Type) {
+class Ptr(T:! type) {
   ...
   external impl as Deref where .Result = T {
     fn DoDeref[self: Self]() -> Result { ... }
   }
 }
-class Optional(T:! Type) {
+class Optional(T:! type) {
   ...
   external impl as Deref where .Result = T {
     fn DoDeref[self: Self]() -> Result { ... }
   }
 }
 
-fn F[T:! Type](x: T) {
+fn F[T:! type](x: T) {
   // uses Ptr(T) and Optional(T) in implementation
 }
 ```
@@ -4288,7 +4289,7 @@ practice have to add a constraint, which is both verbose and exposes what should
 be implementation details:
 
 ```
-fn F[T:! Type where Optional(T).(Deref.Result) == .Self
+fn F[T:! type where Optional(T).(Deref.Result) == .Self
                 and Ptr(T).(Deref.Result) == .Self](x: T) {
   // uses Ptr(T) and Optional(T) in implementation
 }
@@ -4298,14 +4299,14 @@ To mark an impl as not able to be specialized, prefix it with the keyword
 `final`:
 
 ```
-class Ptr(T:! Type) {
+class Ptr(T:! type) {
   ...
   // Note: added `final`
   final external impl as Deref where .Result = T {
     fn DoDeref[self: Self]() -> Result { ... }
   }
 }
-class Optional(T:! Type) {
+class Optional(T:! type) {
   ...
   // Note: added `final`
   final external impl as Deref where .Result = T {
@@ -4323,7 +4324,7 @@ assume it won't be specialized so it can use the assignments of the associated
 types in that impl definition.
 
 ```
-fn F[T:! Type](x: T) {
+fn F[T:! type](x: T) {
   var p: Ptr(T) = ...;
   // *p has type `T`
   var o: Optional(T) = ...;
@@ -4627,16 +4628,16 @@ class MyClass;
 
 // Definition of interfaces that were previously declared
 interface Interface1 {
-  let T1:! Type;
+  let T1:! type;
 }
 interface Interface2 {
-  let T2:! Type;
+  let T2:! type;
 }
 interface Interface3 {
-  let T3:! Type;
+  let T3:! type;
 }
 interface Interface4 {
-  let T4:! Type;
+  let T4:! type;
 }
 
 // Forward declaration of external implementations
@@ -4648,10 +4649,10 @@ impl MyClass as Interface3 where .T3 = f32;
 impl MyClass as Interface4 where .T4 = String;
 
 interface Interface5 {
-  let T5:! Type;
+  let T5:! type;
 }
 interface Interface6 {
-  let T6:! Type;
+  let T6:! type;
 }
 
 // Definition of the previously declared class type
@@ -4741,8 +4742,8 @@ instead include that requirement in the body of the interface.
 ```
 // Want to require that `T` satisfies `CommonType(Self)`,
 // but that can't be done in the parameter list.
-interface CommonType(T:! Type) {
-  let Result:! Type;
+interface CommonType(T:! type) {
+  let Result:! type;
   // Instead add the requirement inside the definition.
   impl T as CommonType(Self);
 }
@@ -4754,8 +4755,8 @@ declaration
 [must involve `Self`](#interface-requiring-other-interfaces-revisited).
 
 ```
-interface CommonType(T:! Type) {
-  let Result:! Type;
+interface CommonType(T:! type) {
+  let Result:! type;
   // ❌ Illegal: `CommonType` is incomplete
   impl T as CommonType(Self) where .Result == Result;
 }
@@ -4766,16 +4767,16 @@ constraint that can only be defined later. This is
 [the same strategy used to work around cyclic references](#example-of-declaring-interfaces-with-cyclic-references).
 
 ```
-private constraint CommonTypeResult(T:! Type, R:! Type);
+private constraint CommonTypeResult(T:! type, R:! type);
 
-interface CommonType(T:! Type) {
-  let Result:! Type;
+interface CommonType(T:! type) {
+  let Result:! type;
   // ✅ Allowed: `CommonTypeResult` is incomplete, but
   //             no members are accessed.
   impl T as CommonTypeResult(Self, Result);
 }
 
-constraint CommonTypeResult(T:! Type, R:! Type) {
+constraint CommonTypeResult(T:! type, R:! type) {
   extends CommonType(T) where .Result == R;
 }
 ```
@@ -4834,8 +4835,8 @@ Defaults may also be provided for associated constants, such as associated
 types, and interface parameters, using the `= <default value>` syntax.
 
 ```
-interface Add(Right:! Type = Self) {
-  default let Result:! Type = Self;
+interface Add(Right:! type = Self) {
+  default let Result:! type = Self;
   fn DoAdd[self: Self](right: Right) -> Result;
 }
 
@@ -4864,8 +4865,8 @@ More generally, default expressions may reference other associated types or
 
 ```
 interface Iterator {
-  let Element:! Type;
-  default let Pointer:! Type = Element*;
+  let Element:! type;
+  default let Pointer:! type = Element*;
 }
 ```
 
@@ -4934,11 +4935,11 @@ class String {
   }
 }
 
-interface Add(T:! Type = Self) {
+interface Add(T:! type = Self) {
   // `AddWith` *always* equals `T`
-  final let AddWith:! Type = T;
+  final let AddWith:! type = T;
   // Has a *default* of `Self`
-  let Result:! Type = Self;
+  let Result:! type = Self;
   fn DoAdd[self: Self](right: AddWith) -> Result;
 }
 ```
@@ -4997,7 +4998,7 @@ says that if `Self` implements `IntLike`, then `i32` must implement `As(Self)`.
 Similarly,
 
 ```
-interface CommonTypeWith(T:! Type) {
+interface CommonTypeWith(T:! type) {
   impl T as CommonTypeWith(Self);
   // ...
 }
@@ -5067,7 +5068,7 @@ In some cases, the interface's requirement can be trivially satisfied by the
 implementation itself, as in:
 
 ```
-impl forall [T:! Type] T as CommonTypeWith(T) { ... }
+impl forall [T:! type] T as CommonTypeWith(T) { ... }
 ```
 
 Here is an example where the requirement of interface `Iterable` that the type
@@ -5075,11 +5076,11 @@ implements interface `Equatable` is satisfied by a constraint in the `impl`
 declaration:
 
 ```
-class Foo(T:! Type) {}
+class Foo(T:! type) {}
 // This is allowed because we know that an `impl Foo(T) as Equatable`
 // will exist for all types `T` for which this impl is used, even
 // though there's neither an imported impl nor an impl in this file.
-external impl forall [T:! Type where Foo(T) is Equatable]
+external impl forall [T:! type where Foo(T) is Equatable]
     Foo(T) as Iterable {}
 ```
 
@@ -5100,10 +5101,10 @@ satisfy. Consider an interface `B` that has a requirement that interface `A` is
 also implemented.
 
 ```
-interface A(T:! Type) {
-  let Result:! Type;
+interface A(T:! type) {
+  let Result:! type;
 }
-interface B(T:! Type) {
+interface B(T:! type) {
   impl as A(T) where .Result == i32;
 }
 ```
@@ -5229,7 +5230,7 @@ interface to overload the unary `-` operator:
 ```
 // Unary `-`.
 interface Negatable {
-  let Result:! Type = Self;
+  let Result:! type = Self;
   fn Negate[self: Self]() -> Result;
 }
 ```
@@ -5251,7 +5252,7 @@ expression, implement the
 [`As` interface](/docs/design/expressions/as_expressions.md#extensibility):
 
 ```
-interface As(Dest:! Type) {
+interface As(Dest:! type) {
   fn Convert[self: Self]() -> Dest;
 }
 ```
@@ -5266,8 +5267,8 @@ for a binary operator like `*`:
 
 ```
 // Binary `*`.
-interface MultipliableWith(U:! Type) {
-  let Result:! Type = Self;
+interface MultipliableWith(U:! type) {
+  let Result:! type = Self;
   fn Multiply[self: Self](other: U) -> Result;
 }
 ```
@@ -5290,12 +5291,12 @@ standard library will provide [adapters](#adapting-types) for defining the
 second implementation from the first, as in:
 
 ```
-interface ComparableWith(RHS:! Type) {
+interface ComparableWith(RHS:! type) {
   fn Compare[self: Self](right: RHS) -> CompareResult;
 }
 
 adapter ReverseComparison
-    (T:! Type, U:! ComparableWith(RHS)) for T {
+    (T:! type, U:! ComparableWith(RHS)) for T {
   impl as ComparableWith(U) {
     fn Compare[self: Self](right: RHS) -> CompareResult {
       return ReverseCompareResult(right.Compare(self));
@@ -5638,7 +5639,7 @@ storage of `Optional(T)` for type `T`," written here as `OptionalStorage`:
 
 ```
 interface OptionalStorage {
-  let Storage:! Type;
+  let Storage:! type;
   fn MakeNone() -> Storage;
   fn Make(x: Self) -> Storage;
   fn IsNone(x: Storage) -> bool;
@@ -5663,7 +5664,7 @@ patterns:
 
 ```
 // Specialization for pointers, using nullptr == None
-final external impl forall [T:! Type] T* as OptionalStorage
+final external impl forall [T:! type] T* as OptionalStorage
     where .Storage = Array(Byte, sizeof(T*)) {
   ...
 }

+ 4 - 4
docs/design/generics/overview.md

@@ -311,7 +311,7 @@ call site.
 
 ```
 // ERROR: can't determine `U` from explicit parameters
-fn Illegal[T:! Type, U:! Type](x: T) -> U { ... }
+fn Illegal[T:! type, U:! type](x: T) -> U { ... }
 ```
 
 #### Generic type parameters
@@ -560,7 +560,7 @@ those types to be different. An element in a hash map might have type
 `Equatable(Pair(String, i64))`.
 
 ```
-interface Equatable(T:! Type) {
+interface Equatable(T:! type) {
   fn IsEqual[self: Self](compare_to: T) -> bool;
 }
 ```
@@ -574,13 +574,13 @@ general, unless some other parameter determines `T`.
 ```
 // ✅ This is allowed, since the value of `T` is determined by the
 // `v` parameter.
-fn FindInVector[T:! Type, U:! Equatable(T)](v: Vector(T), needle: U)
+fn FindInVector[T:! type, U:! Equatable(T)](v: Vector(T), needle: U)
     -> Optional(i32);
 
 // ❌ This is forbidden. Since `U` could implement `Equatable`
 // multiple times, there is no way to determine the value for `T`.
 // Contrast with `PeekAtTopOfStack` in the associated type example.
-fn CompileError[T:! Type, U:! Equatable(T)](x: U) -> T;
+fn CompileError[T:! type, U:! Equatable(T)](x: U) -> T;
 ```
 
 ### Constraints

+ 8 - 8
docs/design/generics/terminology.md

@@ -191,7 +191,7 @@ For example, let's say we have some overloaded function called `F` that has two
 overloads:
 
 ```
-fn F[template T:! Type](x: T*) -> T;
+fn F[template T:! type](x: T*) -> T;
 fn F(x: Int) -> bool;
 ```
 
@@ -279,9 +279,9 @@ Note that function signatures can typically be rewritten to avoid using deduced
 parameters:
 
 ```
-fn F[template T:! Type](value: T);
+fn F[template T:! type](value: T);
 // is equivalent to:
-fn F(value: (template T:! Type));
+fn F(value: (template T:! type));
 ```
 
 See more [here](overview.md#deduced-parameters).
@@ -660,7 +660,7 @@ associated types. An associated type is a kind of
 ```
 // Stack using associated types
 interface Stack {
-  let ElementType:! Type;
+  let ElementType:! type;
   fn Push[addr self: Self*](value: ElementType);
   fn Pop[addr self: Self*]() -> ElementType;
 }
@@ -696,8 +696,8 @@ For example, we might have an interface that says how to perform addition with
 another type:
 
 ```
-interface AddWith(T:! Type) {
-  let ResultType:! Type;
+interface AddWith(T:! type) {
+  let ResultType:! type;
   fn Add[self: Self](rhs: T) -> ResultType;
 }
 ```
@@ -716,12 +716,12 @@ to be some way to determine the type to add to:
 ```
 // ✅ This is allowed, since the value of `T` is determined by the
 // `y` parameter.
-fn DoAdd[T:! Type, U:! AddWith(T)](x: U, y: T) -> U.ResultType {
+fn DoAdd[T:! type, U:! AddWith(T)](x: U, y: T) -> U.ResultType {
   return x.Add(y);
 }
 
 // ❌ This is forbidden, can't uniquely determine `T`.
-fn CompileError[T:! Type, U:! AddWith(T)](x: U) -> T;
+fn CompileError[T:! type, U:! AddWith(T)](x: U) -> T;
 ```
 
 Once the interface parameter can be determined, that determines the values for

+ 1 - 0
docs/design/lexical_conventions/words.md

@@ -78,6 +78,7 @@ The following words are interpreted as keywords:
 -   `returned`
 -   `Self`
 -   `then`
+-   `type`
 -   `var`
 -   `virtual`
 -   `where`

+ 7 - 8
docs/design/name_lookup.md

@@ -74,14 +74,13 @@ the package scope for unqualified name lookup.
 
 ### Name lookup for common, standard types
 
-The Carbon standard library is in the `Carbon` package. A very small subset of
-this standard library is provided implicitly in every file's scope. This is
-called the "prelude".
-
-Names in the prelude will be available without a package qualifier. For example,
-the name `Type` can be directly used in code without a `Carbon.` qualifier, even
-though it belongs to the `Carbon` package, and no import is necessary to use the
-name `Type`.
+The Carbon standard library is in the `Core` package. A subset of this package,
+called the "prelude", is implicitly imported in every file, so the package name
+`Core` is always available.
+
+Some keywords and type literals, such as `bool` and `i32`, are aliases for
+entities in the prelude. Similarly, some of the Carbon language syntax, such as
+operators and `for` loops, is defined in terms of interfaces in the prelude.
 
 ## Open questions
 

+ 4 - 4
docs/design/sum_types.md

@@ -49,7 +49,7 @@ than documentation), and `None`, which is empty. Choice types can also be
 parameterized, [like class types](generics/details.md#parameterized-types):
 
 ```carbon
-choice Optional(T:! Type) {
+choice Optional(T:! type) {
   Some(value: T),
   None
 }
@@ -107,10 +107,10 @@ It does so by implementing the `Match` interface, which is defined as follows:
 ```carbon
 interface Match {
   interface BaseContinuation {
-    let ReturnType:! Type;
+    let ReturnType:! type;
   }
 
-  let template Continuation:! Type;
+  let template Continuation:! type;
   fn Op[me: Self, C:! Continuation](continuation: C*)
     -> C.(MatchContinuation.ReturnType);
 }
@@ -135,7 +135,7 @@ require that `Match.Op` invoke the continuation as a tail call.
 For example, here's how `Optional` can be defined as a class:
 
 ```carbon
-class Optional(T:! Type) {
+class Optional(T:! type) {
   // Factory functions
   fn Some(value: T) -> Self;
   let None:! Self;

+ 2 - 2
docs/design/templates.md

@@ -44,7 +44,7 @@ are subject to full instantiation -- other parameters will be type checked and
 bound early to the extent possible. For example:
 
 ```
-class Stack(template T:! Type) {
+class Stack(template T:! type) {
   var storage: Array(T);
 
   fn Push[addr self: Self*](value: T);
@@ -67,7 +67,7 @@ arguments. The runtime call then passes the remaining arguments to the resulting
 complete definition.
 
 ```
-fn Convert[template T:! Type](source: T, template U:! Type) -> U {
+fn Convert[template T:! type](source: T, template U:! type) -> U {
   var converted: U = source;
   return converted;
 }

+ 1 - 1
explorer/ast/declaration.h

@@ -538,7 +538,7 @@ class ConstraintTypeDeclaration : public Declaration {
   auto params() -> std::optional<Nonnull<TuplePattern*>> { return params_; }
   // Get the type of `Self`, which is a reference to the interface itself, with
   // parameters mapped to their values. For example, in `interface X(T:!
-  // Type)`, the self type is `X(T)`.
+  // type)`, the self type is `X(T)`.
   auto self_type() const -> Nonnull<const SelfDeclaration*> {
     return self_type_;
   }

+ 1 - 1
explorer/ast/expression.cpp

@@ -329,7 +329,7 @@ void Expression::PrintID(llvm::raw_ostream& out) const {
       out << "String";
       break;
     case ExpressionKind::TypeTypeLiteral:
-      out << "Type";
+      out << "type";
       break;
     case ExpressionKind::ContinuationTypeLiteral:
       out << "Continuation";

+ 2 - 2
explorer/ast/expression.h

@@ -202,9 +202,9 @@ class IdentifierExpression : public Expression {
 // A `.Self` expression within either a `:!` binding or a standalone `where`
 // expression.
 //
-// In a `:!` binding, the type of `.Self` is always `Type`. For example, in
+// In a `:!` binding, the type of `.Self` is always `type`. For example, in
 // `A:! AddableWith(.Self)`, the expression `.Self` refers to the same type as
-// `A`, but with type `Type`.
+// `A`, but with type `type`.
 //
 // In a `where` binding, the type of `.Self` is the constraint preceding the
 // `where` keyword. For example, in `Foo where .Result is Bar(.Self)`, the type

+ 42 - 42
explorer/data/prelude.carbon

@@ -9,49 +9,49 @@ package Carbon api;
 // ----------------------
 
 // Explicitly convert `Self` to `T`.
-interface As(T:! Type) {
+interface As(T:! type) {
   fn Convert[self: Self]() -> T;
 }
 
 // Implicitly convert `Self` to `T`.
-interface ImplicitAs(T:! Type) {
+interface ImplicitAs(T:! type) {
   extends As(T);
 }
 
 // TODO: This should be private.
 interface __EqualConverter {
-  let T:! Type;
+  let T:! type;
   fn Convert(t: T) -> Self;
 }
-fn __EqualConvert[T:! Type](t: T, U:! __EqualConverter where .T = T) -> U {
+fn __EqualConvert[T:! type](t: T, U:! __EqualConverter where .T = T) -> U {
   return U.Convert(t);
 }
-impl forall [U:! Type] U as __EqualConverter where .T = U {
+impl forall [U:! type] U as __EqualConverter where .T = U {
   fn Convert(u: U) -> U { return u; }
 }
 
 // Every type implicitly converts to single-step-equal types.
-impl forall [T:! Type, U:! Type where .Self == T] T as ImplicitAs(U) {
+impl forall [T:! type, U:! type where .Self == T] T as ImplicitAs(U) {
   fn Convert[self: Self]() -> U { return __EqualConvert(self, U); }
 }
 
 // TODO: Simplify this once we have variadics.
 // TODO: Should these be final?
-impl forall [U1:! Type, T1:! ImplicitAs(U1)]
+impl forall [U1:! type, T1:! ImplicitAs(U1)]
     (T1,) as ImplicitAs((U1,)) {
   fn Convert[self: Self]() -> (U1,) {
     let (v1: T1,) = self;
     return (v1.Convert(),);
   }
 }
-impl forall [U1:! Type, U2:! Type, T1:! ImplicitAs(U1), T2:! ImplicitAs(U2)]
+impl forall [U1:! type, U2:! type, T1:! ImplicitAs(U1), T2:! ImplicitAs(U2)]
     (T1, T2) as ImplicitAs((U1, U2)) {
   fn Convert[self: Self]() -> (U1, U2) {
     let (v1: T1, v2: T2) = self;
     return (v1.Convert(), v2.Convert());
   }
 }
-impl forall [U1:! Type, U2:! Type, U3:! Type,
+impl forall [U1:! type, U2:! type, U3:! type,
              T1:! ImplicitAs(U1), T2:! ImplicitAs(U2), T3:! ImplicitAs(U3)]
     (T1, T2, T3) as ImplicitAs((U1, U2, U3)) {
   fn Convert[self: Self]() -> (U1, U2, U3) {
@@ -68,7 +68,7 @@ impl forall [U1:! Type, U2:! Type, U3:! Type,
 // EQUAL
 // ----------------------
 
-interface EqWith(U:! Type) {
+interface EqWith(U:! type) {
   fn Equal[self: Self](other: U) -> bool;
   fn NotEqual[self: Self](other: U) -> bool;
 }
@@ -78,7 +78,7 @@ constraint Eq {
 }
 
 // TODO: Simplify this once we have variadics
-impl forall [T2:! Type, U2:! Type, T1:! EqWith(T2), U1:! EqWith(U2)]
+impl forall [T2:! type, U2:! type, T1:! EqWith(T2), U1:! EqWith(U2)]
     (T1, U1) as EqWith((T2, U2)) {
   fn Equal[self: Self](other: (T2, U2)) -> bool {
     let (l1: T1, l2: U1) = self;
@@ -133,7 +133,7 @@ choice Ordering {
 }
 
 // TODO: Per the design, this should be named `OrderedWith`.
-interface CompareWith(U:! Type) {
+interface CompareWith(U:! type) {
   fn Compare[self: Self](u: U) -> Ordering;
   // TODO: Add `default fn` for Less, LessOrEquivalent, Greater, and GreaterOrEquivalent once it's available.
 }
@@ -174,19 +174,19 @@ impl String as CompareWith(Self) {
   }
 }
 
-interface LessWith(U:! Type) {
+interface LessWith(U:! type) {
   fn Less[self: Self](other: U) -> bool;
 }
 
-interface LessEqWith(U:! Type) {
+interface LessEqWith(U:! type) {
   fn LessEq[self: Self](other: U) -> bool;
 }
 
-interface GreaterWith(U:! Type) {
+interface GreaterWith(U:! type) {
   fn Greater[self: Self](other: U) -> bool;
 }
 
-interface GreaterEqWith(U:! Type) {
+interface GreaterEqWith(U:! type) {
   fn GreaterEq[self: Self](other: U) -> bool;
 }
 
@@ -304,49 +304,49 @@ impl String as GreaterEqWith(Self) {
 
 interface Negate {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self]() -> Result;
 }
 
-interface AddWith(U:! Type) {
+interface AddWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Add {
   extends AddWith(Self) where .Result = Self;
 }
 
-interface SubWith(U:! Type) {
+interface SubWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Sub {
   extends SubWith(Self) where .Result = Self;
 }
 
-interface MulWith(U:! Type) {
+interface MulWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Mul {
   extends MulWith(Self) where .Result = Self;
 }
 
-interface DivWith(U:! Type) {
+interface DivWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Div {
   extends DivWith(Self) where .Result = Self;
 }
 
-interface ModWith(U:! Type) {
+interface ModWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint Mod {
@@ -380,14 +380,14 @@ external impl i32 as ModWith(i32) where .Result = i32 {
 // Unary `^`.
 interface BitComplement {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self]() -> Result;
 }
 
 // Binary `&`.
-interface BitAndWith(U:! Type) {
+interface BitAndWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint BitAnd {
@@ -395,9 +395,9 @@ constraint BitAnd {
 }
 
 // Binary `|`.
-interface BitOrWith(U:! Type) {
+interface BitOrWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint BitOr {
@@ -405,9 +405,9 @@ constraint BitOr {
 }
 
 // Binary `^`.
-interface BitXorWith(U:! Type) {
+interface BitXorWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint BitXor {
@@ -415,9 +415,9 @@ constraint BitXor {
 }
 
 // Binary `<<`.
-interface LeftShiftWith(U:! Type) {
+interface LeftShiftWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint LeftShift {
@@ -425,9 +425,9 @@ constraint LeftShift {
 }
 
 // Binary `>>`.
-interface RightShiftWith(U:! Type) {
+interface RightShiftWith(U:! type) {
   // TODO: = Self
-  let Result:! Type;
+  let Result:! type;
   fn Op[self: Self](other: U) -> Result;
 }
 constraint RightShift {
@@ -468,12 +468,12 @@ external impl i32 as RightShiftWith(i32) where .Result = i32 {
 //-------------------------
 // Optional
 //-------------------------
-choice OptionalElement(T:! Type) {
+choice OptionalElement(T:! type) {
   None(),
   Element(T)
 }
 
-class Optional(T:! Type) {
+class Optional(T:! type) {
   fn CreateEmpty() -> Optional(T) {
     return {.element = OptionalElement(T).None()};
   }
@@ -522,10 +522,10 @@ fn Rand(low: i32, high: i32) -> i32{
 }
 
 class Heap {
-  fn New[T:! Type, self: Self](x : T) -> T* {
+  fn New[T:! type, self: Self](x : T) -> T* {
     return __intrinsic_new(x);
   }
-  fn Delete[T:! Type, self: Self](p : T*) {
+  fn Delete[T:! type, self: Self](p : T*) {
     __intrinsic_delete(p);
   }
 }

+ 1 - 1
explorer/interpreter/action_stack.cpp

@@ -79,7 +79,7 @@ auto ActionStack::ValueOfNode(ValueNodeView value_node,
   // We don't know the value of this node, but at compile time we may still be
   // able to form a symbolic value for it. For example, in
   //
-  //   fn F[T:! Type](x: T) {}
+  //   fn F[T:! type](x: T) {}
   //
   // ... we don't know the value of `T` but can still symbolically evaluate it
   // to a `VariableType`. At runtime we need actual values.

+ 2 - 2
explorer/interpreter/impl_scope.h

@@ -22,8 +22,8 @@ class TypeChecker;
 // can vary from scope to scope. For example, consider the `bar` and
 // `baz` methods in the following class C and nested class D.
 //
-//     class C(U:! Type, T:! Type)  {
-//       class D(V:! Type where U is Fooable(T)) {
+//     class C(U:! type, T:! type)  {
+//       class D(V:! type where U is Fooable(T)) {
 //         fn bar[self: Self](x: U, y : T) -> T{
 //           return x.foo(y)
 //         }

+ 2 - 2
explorer/interpreter/interpreter.cpp

@@ -128,7 +128,7 @@ class Interpreter {
   // appear in constraints:
   //
   //   interface Iface { let N:! i32; }
-  //   fn PickType(N: i32) -> Type { return i32; }
+  //   fn PickType(N: i32) -> type { return i32; }
   //   fn F[T:! Iface where .N == 5](x: T) {
   //     var x: PickType(T.N) = 0;
   //   }
@@ -805,7 +805,7 @@ auto Interpreter::Convert(Nonnull<const Value*> value,
         case Value::Kind::NamedConstraintType:
         case Value::Kind::InterfaceType: {
           CARBON_CHECK(struct_val.elements().empty())
-              << "only empty structs convert to Type";
+              << "only empty structs convert to `type`";
           return arena_->New<StructType>();
         }
         default: {

+ 7 - 7
explorer/interpreter/type_checker.cpp

@@ -195,8 +195,8 @@ static auto IsType(Nonnull<const Value*> value) -> bool {
       // type-of-type.
       const auto& assoc = cast<AssociatedConstant>(*value);
       // TODO: Should we substitute in the arguments? Given
-      //   interface I(T:! Type) { let V:! T; }
-      // ... is T.(I(Type).V) considered to be a type?
+      //   interface I(T:! type) { let V:! T; }
+      // ... is T.(I(type).V) considered to be a type?
       return IsTypeOfType(&assoc.constant().static_type());
     }
     case Value::Kind::MixinPseudoType:
@@ -659,11 +659,11 @@ auto TypeChecker::ImplicitlyConvert(std::string_view context,
     // A type only implicitly converts to a constraint if there is an impl of
     // that constraint for that type in scope.
     // TODO: Instead of excluding the special case where the destination is
-    // `Type`, we should check if the source type has a subset of the
+    // `type`, we should check if the source type has a subset of the
     // constraints of the destination type. In that case, the source should not
     // be required to be constant.
     if (IsTypeOfType(destination) && !isa<TypeType>(destination)) {
-      // First convert the source expression to type `Type`.
+      // First convert the source expression to type `type`.
       CARBON_ASSIGN_OR_RETURN(Nonnull<Expression*> source_as_type,
                               ImplicitlyConvert(context, impl_scope, source,
                                                 arena_->New<TypeType>()));
@@ -878,7 +878,7 @@ class TypeChecker::ArgumentDeduction {
   }
 
   // Adds a value for a binding that is not deduced but still participates in
-  // substitution. For example, the `T` parameter in `fn F(T:! Type, x: T)`.
+  // substitution. For example, the `T` parameter in `fn F(T:! type, x: T)`.
   void AddNonDeducedBindingValue(Nonnull<const GenericBinding*> binding,
                                  Nonnull<Expression*> argument) {
     non_deduced_values_.push_back({binding, argument});
@@ -1228,7 +1228,7 @@ auto TypeChecker::ArgumentDeduction::Finish(TypeChecker& type_checker,
   // Evaluate and add non-deduced values. These are assumed to lexically follow
   // the deduced bindings, so any bindings the type might reference are now
   // known.
-  // TODO: This is not the case for `fn F(T:! Type, u: (V:! ImplicitAs(T)))`.
+  // TODO: This is not the case for `fn F(T:! type, u: (V:! ImplicitAs(T)))`.
   // However, we intend to disallow that.
   for (auto [binding, arg] : non_deduced_values_) {
     // Form the binding's resolved type and convert the argument expression to
@@ -4556,7 +4556,7 @@ auto TypeChecker::DeclareClassDeclaration(Nonnull<ClassDeclaration*> class_decl,
     class_vtable[fun->name()] = {fun, class_level};
   }
 
-  // For class declaration `class MyType(T:! Type, U:! AnInterface)`, `Self`
+  // For class declaration `class MyType(T:! type, U:! AnInterface)`, `Self`
   // should have the value `MyType(T, U)`.
   Nonnull<NominalClassType*> self_type = arena_->New<NominalClassType>(
       class_decl, Bindings::SymbolicIdentity(arena_, bindings), base_class,

+ 2 - 2
explorer/interpreter/value.cpp

@@ -482,7 +482,7 @@ void Value::Print(llvm::raw_ostream& out) const {
       out << "i32";
       break;
     case Value::Kind::TypeType:
-      out << "Type";
+      out << "type";
       break;
     case Value::Kind::AutoType:
       out << "auto";
@@ -571,7 +571,7 @@ void Value::Print(llvm::raw_ostream& out) const {
         out << combine << *ctx.context;
       }
       if (constraint.lookup_contexts().empty()) {
-        out << "Type";
+        out << "type";
       }
       out << " where ";
       llvm::ListSeparator sep(" and ");

+ 4 - 4
explorer/interpreter/value.h

@@ -312,7 +312,7 @@ class BoolValue : public Value {
 };
 
 // A value of a struct type. Note that the expression `{}` is a value of type
-// `{} as Type`; the former is a `StructValue` and the latter is a
+// `{} as type`; the former is a `StructValue` and the latter is a
 // `StructType`.
 class StructValue : public Value {
  public:
@@ -479,8 +479,8 @@ class TupleValue : public TupleValueBase {
   }
 };
 
-// A tuple type. This is the result of converting a tuple value containing
-// only types to type Type.
+// A tuple type. These values are produced by converting a tuple value
+// containing only types to type `type`.
 class TupleType : public TupleValueBase {
  public:
   // The unit type.
@@ -618,7 +618,7 @@ class FunctionType : public Value {
  public:
   // An explicit function parameter that is a `:!` binding:
   //
-  //     fn MakeEmptyVector(T:! Type) -> Vector(T);
+  //     fn MakeEmptyVector(T:! type) -> Vector(T);
   struct GenericParameter {
     size_t index;
     Nonnull<const GenericBinding*> binding;

+ 1 - 1
explorer/syntax/lexer.lpp

@@ -109,7 +109,7 @@ SLASH                "/"
 STRING               "String"
 THEN                 "then"
 TRUE                 "true"
-TYPE                 "Type"
+TYPE                 "type"
 UNDERSCORE           "_"
 UNIMPL_EXAMPLE       "__unimplemented_example_infix"
 VAR                  "var"

+ 1 - 1
explorer/testdata/alias/function_alias.carbon

@@ -12,7 +12,7 @@ package ExplorerTest api;
 alias TypeAlias = i32;
 
 fn Function(a: i32, b: TypeAlias) -> i32 { return a + b; }
-fn GenericFunction[T:! Type](x: T) -> T { return x; }
+fn GenericFunction[T:! type](x: T) -> T { return x; }
 
 alias FunctionAlias = Function;
 alias GenericFunctionAlias = GenericFunction;

+ 2 - 2
explorer/testdata/alias/interface_alias.carbon

@@ -10,9 +10,9 @@
 package ExplorerTest api;
 
 class Class { var a: i32; }
-class GenericClass(T:! Type) { var a: T; }
+class GenericClass(T:! type) { var a: T; }
 interface Interface { fn Make() -> Self; }
-interface GenericInterface(T:! Type) { fn Make() -> (Self, T); }
+interface GenericInterface(T:! type) { fn Make() -> (Self, T); }
 
 alias ClassAlias = Class;
 alias GenericClassAlias = GenericClass;

+ 2 - 2
explorer/testdata/array/element_convertible_to_type.carbon

@@ -10,8 +10,8 @@
 package ExplorerTest api;
 
 class TypeLike {
-  impl as ImplicitAs(Type) {
-    fn Convert[self: Self]() -> Type { return i32; }
+  impl as ImplicitAs(type) {
+    fn Convert[self: Self]() -> type { return i32; }
   }
   fn Make() -> Self { return {}; }
 }

+ 1 - 1
explorer/testdata/as/fail_destination_not_type.carbon

@@ -9,6 +9,6 @@
 package ExplorerTest api;
 
 fn Main() -> i32 {
-  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/as/fail_destination_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'Type'
+  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/as/fail_destination_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
   return 4 as 7;
 }

+ 1 - 1
explorer/testdata/assoc_const/fail_anonymous.carbon

@@ -10,7 +10,7 @@ package ExplorerTest api;
 
 interface Iface {
   // CHECK:STDERR: SYNTAX ERROR: {{.*}}/explorer/testdata/assoc_const/fail_anonymous.carbon:[[@LINE+1]]: syntax error, unexpected UNDERSCORE, expecting identifier
-  let _:! Type;
+  let _:! type;
 }
 
 fn Main() -> i32 { return 0; }

+ 1 - 1
explorer/testdata/assoc_const/fail_different_type.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface Iface {
-  let T:! Type;
+  let T:! type;
 }
 
 fn F(T:! Iface where .T == i32) {}

+ 3 - 3
explorer/testdata/assoc_const/fail_equal_indirectly.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface Iface {
-  let T:! Type;
+  let T:! type;
 }
 
 fn F[T:! Iface where .T == i32](x: T) {}
@@ -20,12 +20,12 @@ class Class {
 
 // OK, constraint on `F` rewritten to `T:! Iface where U == i32`, which we can
 // prove from the constraint on `U`.
-fn G[U:! Type where .Self == i32, T:! Iface where .T = U](x: T, y: U) {
+fn G[U:! type where .Self == i32, T:! Iface where .T = U](x: T, y: U) {
   F(x);
 }
 
 // Not OK: would require looking through two levels of `==`.
-fn H[V:! Type where .Self == i32, W:! Iface where .T == V](x: W, y: V) {
+fn H[V:! type where .Self == i32, W:! Iface where .T == V](x: W, y: V) {
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_equal_indirectly.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value (W).(Iface.T)) == i32, which is not known to be true
   F(x);
 }

+ 1 - 1
explorer/testdata/assoc_const/fail_equal_to_dependent_type.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface Iface {
-  let T:! Type;
+  let T:! type;
 }
 
 fn F[T:! Iface where .T == i32](x: T) {}

+ 2 - 2
explorer/testdata/assoc_const/fail_implied_constraints.carbon

@@ -8,9 +8,9 @@
 
 package ExplorerTest api;
 
-interface X(T:! Type) {}
+interface X(T:! type) {}
 
-interface Y(T:! Type) {
+interface Y(T:! type) {
     let M:! X(T);
 }
 

+ 3 - 3
explorer/testdata/assoc_const/fail_incomplete_impl_1.carbon

@@ -9,9 +9,9 @@
 package ExplorerTest api;
 
 interface HasThreeTypes {
-  let A:! Type;
-  let B:! Type;
-  let C:! Type;
+  let A:! type;
+  let B:! type;
+  let C:! type;
 }
 
 // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_incomplete_impl_1.carbon:[[@LINE+1]]: implementation doesn't provide a concrete value for interface HasThreeTypes.B

+ 3 - 3
explorer/testdata/assoc_const/fail_incomplete_impl_2.carbon

@@ -9,9 +9,9 @@
 package ExplorerTest api;
 
 interface HasThreeTypes {
-  let A:! Type;
-  let B:! Type;
-  let C:! Type;
+  let A:! type;
+  let B:! type;
+  let C:! type;
 }
 
 // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_incomplete_impl_2.carbon:[[@LINE+1]]: implementation doesn't provide a concrete value for interface HasThreeTypes.C

+ 1 - 1
explorer/testdata/assoc_const/fail_indirectly_equal.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface A {
-  let T:! Type;
+  let T:! type;
 }
 
 fn F1[T:! A where .T == i32](x: T.T) -> i32 {

+ 3 - 3
explorer/testdata/assoc_const/fail_match_in_deduction.carbon

@@ -15,11 +15,11 @@ interface Vector {
 }
 external impl (i32, i32, i32) as Vector where .Dim = 3 {}
 
-class Point(Scalar:! Type, Dim:! i32) {}
+class Point(Scalar:! type, Dim:! i32) {}
 
-fn F[Scalar:! Type, V:! Vector where .Dim == 3](p: Point(Scalar, V.Dim), v: V) {}
+fn F[Scalar:! type, V:! Vector where .Dim == 3](p: Point(Scalar, V.Dim), v: V) {}
 
-fn G[Scalar:! Type](p: Point(Scalar, 3)) {}
+fn G[Scalar:! type](p: Point(Scalar, 3)) {}
 fn H[V:! Vector where .Dim == 3](v: V) {
   var p: Point(i32, V.Dim) = {};
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_match_in_deduction.carbon:[[@LINE+1]]: mismatch in non-type values, `(V).(Vector.Dim)` != `3`

+ 1 - 1
explorer/testdata/assoc_const/fail_missing_equal.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface Container {
-  let Element:! Type;
+  let Element:! type;
   fn Front[self: Self]() -> Element;
 }
 

+ 1 - 1
explorer/testdata/assoc_const/fail_missing_rewrite.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface Container {
-  let Element:! Type;
+  let Element:! type;
   fn Front[self: Self]() -> Element;
 }
 

+ 3 - 3
explorer/testdata/assoc_const/fail_multi_impl_scoping.carbon

@@ -9,15 +9,15 @@
 package ExplorerTest api;
 
 interface A {
-  let TA:! Type;
+  let TA:! type;
   fn FA() -> TA;
 }
 interface B {
-  let TB:! Type;
+  let TB:! type;
   fn FB() -> TB;
 }
 
-class C(T:! Type) {
+class C(T:! type) {
   impl as A & B where .TA = i32 and .TB = i32 {
     fn FA() -> i32 {
       // OK, know that TA is i32 here.

+ 5 - 5
explorer/testdata/assoc_const/fail_multiple_deduction.carbon

@@ -9,14 +9,14 @@
 package ExplorerTest api;
 
 interface HasThreeTypes {
-  let A:! Type;
-  let B:! Type;
-  let C:! Type;
+  let A:! type;
+  let B:! type;
+  let C:! type;
   fn Make[self: Self]() -> (A, B, C);
 }
-fn F[T:! Type](x: (T, T, T));
+fn F[T:! type](x: (T, T, T));
 fn G[X:! HasThreeTypes where .A == .B and .B == .C and .C == .A](x: X) {
-  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_multiple_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type:
+  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_multiple_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! type:
   // CHECK:STDERR:   (X).(HasThreeTypes.A)
   // CHECK:STDERR:   (X).(HasThreeTypes.B)
   F(x.Make());

+ 1 - 1
explorer/testdata/assoc_const/fail_overspecified_impl.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface HasType {
-  let T:! Type;
+  let T:! type;
 }
 
 // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_overspecified_impl.carbon:[[@LINE+3]]: multiple different rewrites for `(i32).(HasType.T)`:

+ 2 - 2
explorer/testdata/assoc_const/fail_redefined.carbon

@@ -9,9 +9,9 @@
 package ExplorerTest api;
 
 interface Iface {
-  let T:! Type;
+  let T:! type;
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_redefined.carbon:[[@LINE+1]]: Duplicate name `T` also found at {{.*}}/explorer/testdata/assoc_const/fail_redefined.carbon:[[@LINE-1]]
-  let T:! Type;
+  let T:! type;
 }
 
 fn Main() -> i32 { return 0; }

+ 1 - 1
explorer/testdata/assoc_const/fail_rewrite_creates_infinite_type.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface HasType {
-  let T:! Type;
+  let T:! type;
 }
 
 // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_rewrite_creates_infinite_type.carbon:[[@LINE+1]]: rewrite of (H).(HasType.T) applies within its own resolved expansion of (H).(HasType.T)*

+ 10 - 10
explorer/testdata/assoc_const/fail_rewrite_cycle.carbon

@@ -9,16 +9,16 @@
 package ExplorerTest api;
 
 interface ManyTypes {
-  let T0:! Type;
-  let T1:! Type;
-  let T2:! Type;
-  let T3:! Type;
-  let T4:! Type;
-  let T5:! Type;
-  let T6:! Type;
-  let T7:! Type;
-  let T8:! Type;
-  let T9:! Type;
+  let T0:! type;
+  let T1:! type;
+  let T2:! type;
+  let T3:! type;
+  let T4:! type;
+  let T5:! type;
+  let T6:! type;
+  let T7:! type;
+  let T8:! type;
+  let T9:! type;
 }
 
 fn F[

+ 1 - 1
explorer/testdata/assoc_const/fail_rewrite_depends_on_later_rewrite.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 interface HasTypeAndValue {
-  let T:! Type;
+  let T:! type;
   let V:! T;
 }
 

+ 2 - 2
explorer/testdata/assoc_const/fail_simple_rewrite_cycle_1.carbon

@@ -9,8 +9,8 @@
 package ExplorerTest api;
 
 interface TwoTypes {
-  let T:! Type;
-  let U:! Type;
+  let T:! type;
+  let U:! type;
 }
 
 // Attempting to fully resolve the replacement for `.T` would never create a

+ 2 - 2
explorer/testdata/assoc_const/fail_simple_rewrite_cycle_2.carbon

@@ -9,8 +9,8 @@
 package ExplorerTest api;
 
 interface TwoTypes {
-  let T:! Type;
-  let U:! Type;
+  let T:! type;
+  let U:! type;
 }
 
 // Attempting to fully resolve the replacement for `.T` would never create a

+ 1 - 1
explorer/testdata/assoc_const/fail_unknown_value.carbon

@@ -10,7 +10,7 @@ package ExplorerTest api;
 
 interface Iface { let N:! i32; }
 
-fn PickType(N: i32) -> Type { return i32; }
+fn PickType(N: i32) -> type { return i32; }
 
 fn F[T:! Iface](x: T) -> i32 {
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_unknown_value.carbon:[[@LINE+1]]: value of associated constant (T).(Iface.N) is not known

+ 1 - 1
explorer/testdata/assoc_const/fail_unknown_value_specified_in_constraint.carbon

@@ -10,7 +10,7 @@ package ExplorerTest api;
 
 interface Iface { let N:! i32; }
 
-fn PickType(N: i32) -> Type { return i32; }
+fn PickType(N: i32) -> type { return i32; }
 
 fn F[T:! Iface where .N == 5](x: T) -> i32 {
   // TODO: This should be valid: the value of T.N is known to be 5 here.

+ 1 - 1
explorer/testdata/assoc_const/impl_lookup.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface Frob {
-  let Result:! Type;
+  let Result:! type;
   fn F[self: Self]() -> Result;
 }
 

+ 2 - 2
explorer/testdata/assoc_const/impl_used_by_later_rewrite.carbon

@@ -9,9 +9,9 @@
 
 package ExplorerTest api;
 
-interface X(T:! Type) {}
+interface X(T:! type) {}
 
-interface Y(T:! Type) {
+interface Y(T:! type) {
     let M:! X(T);
 }
 

+ 1 - 1
explorer/testdata/assoc_const/pass_equal_to_rewrite.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface Container {
-  let Element:! Type;
+  let Element:! type;
   fn Front[self: Self]() -> Element;
 }
 

+ 1 - 1
explorer/testdata/assoc_const/pass_rewrite_to_equal.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface Container {
-  let Element:! Type;
+  let Element:! type;
   fn Front[self: Self]() -> Element;
 }
 

+ 10 - 10
explorer/testdata/assoc_const/resolve_rewrites.carbon

@@ -10,16 +10,16 @@
 package ExplorerTest api;
 
 interface ManyTypes {
-  let T0:! Type;
-  let T1:! Type;
-  let T2:! Type;
-  let T3:! Type;
-  let T4:! Type;
-  let T5:! Type;
-  let T6:! Type;
-  let T7:! Type;
-  let T8:! Type;
-  let T9:! Type;
+  let T0:! type;
+  let T1:! type;
+  let T2:! type;
+  let T3:! type;
+  let T4:! type;
+  let T5:! type;
+  let T6:! type;
+  let T7:! type;
+  let T8:! type;
+  let T9:! type;
 }
 
 fn F[

+ 1 - 1
explorer/testdata/assoc_const/rewrite_depends_on_prior_rewrite.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface HasTypeAndValue {
-  let T:! Type;
+  let T:! type;
   let V:! T;
 }
 

+ 7 - 7
explorer/testdata/assoc_const/rewrite_interface_params.carbon

@@ -10,15 +10,15 @@
 package ExplorerTest api;
 
 interface HasTypes {
-  let A:! Type;
-  let B:! Type;
-  let C:! Type;
-  let D:! Type;
-  let E:! Type;
-  let F:! Type;
+  let A:! type;
+  let B:! type;
+  let C:! type;
+  let D:! type;
+  let E:! type;
+  let F:! type;
 }
 
-interface HasParams(A:! Type, B:! Type, C:! Type, D:! Type) {
+interface HasParams(A:! type, B:! type, C:! type, D:! type) {
   let V:! HasTypes;
 }
 

+ 8 - 8
explorer/testdata/assoc_const/rewrite_large_type.carbon

@@ -10,14 +10,14 @@
 package ExplorerTest api;
 
 interface ManyTypes {
-  let T0:! Type;
-  let T1:! Type;
-  let T2:! Type;
-  let T3:! Type;
-  let T4:! Type;
-  let T5:! Type;
-  let T6:! Type;
-  let T7:! Type;
+  let T0:! type;
+  let T1:! type;
+  let T2:! type;
+  let T3:! type;
+  let T4:! type;
+  let T5:! type;
+  let T6:! type;
+  let T7:! type;
 }
 
 interface Splat { fn Op(n: i32) -> Self; }

+ 1 - 1
explorer/testdata/assoc_const/simple_constraint.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface Frob {
-  let Result:! Type;
+  let Result:! type;
   fn F[self: Self]() -> Result;
 }
 

+ 1 - 1
explorer/testdata/assoc_const/simple_equality.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface Frob {
-  let Result:! Type;
+  let Result:! type;
   fn F[self: Self]() -> Result;
 }
 

+ 1 - 1
explorer/testdata/basic_syntax/fail_alternative_not_type.carbon

@@ -8,7 +8,7 @@
 
 package ExplorerTest api;
 
-// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/basic_syntax/fail_alternative_not_type.carbon:[[@LINE+1]]: type error in type expression: '(i32)' is not implicitly convertible to 'Type'
+// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/basic_syntax/fail_alternative_not_type.carbon:[[@LINE+1]]: type error in type expression: '(i32)' is not implicitly convertible to 'type'
 choice C { X(42) }
 
 fn Main() -> i32 {

+ 1 - 1
explorer/testdata/basic_syntax/fail_nested_binding.carbon

@@ -10,6 +10,6 @@ package ExplorerTest api;
 
 fn Main() -> i32 {
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/basic_syntax/fail_nested_binding.carbon:[[@LINE+1]]: the type of a binding pattern cannot contain bindings
-  var x: (T: Type) = 1;
+  var x: (T: type) = 1;
   return 1;
 }

+ 1 - 1
explorer/testdata/basic_syntax/fail_var_type.carbon

@@ -11,7 +11,7 @@ package ExplorerTest api;
 fn Main () -> i32
 {
   // 42 cannot be used as the type of a variable.
-  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/basic_syntax/fail_var_type.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'Type'
+  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/basic_syntax/fail_var_type.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'type'
   var x: 42 = 0;
   return x;
 }

+ 1 - 1
explorer/testdata/choice/generic_choice_multiple_template_arguments.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 
-choice MyOptionalElement(ZZ:! Type, YY:! Type) {
+choice MyOptionalElement(ZZ:! type, YY:! type) {
   None(YY),
   Element(ZZ)
 }

+ 2 - 2
explorer/testdata/choice/generic_choice_nested_in_template_class.carbon

@@ -11,12 +11,12 @@
 package ExplorerTest api;
 
 
-choice MyOptionalElement(T:! Type) {
+choice MyOptionalElement(T:! type) {
   None(),
   Element(T)
 }
 
-class MyOptional(T:! Type){
+class MyOptional(T:! type){
    fn CreateEmpty() -> MyOptional(T){
        return { .element = MyOptionalElement(T).None() };
    }

+ 1 - 1
explorer/testdata/choice/generic_choice_simple_assignment.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 
-choice MyOptionalElement(ZZ:! Type) {
+choice MyOptionalElement(ZZ:! type) {
   None(ZZ),
   Element(ZZ)
 }

+ 1 - 1
explorer/testdata/choice/type_of_type.carbon

@@ -13,7 +13,7 @@ choice C {}
 
 fn Main() -> i32 {
   var a: auto = C;
-  // OK: Type of `C` is `Type`.
+  // OK: type of `C` is `type`.
   a = i32;
   return 0;
 }

+ 1 - 1
explorer/testdata/class/fail_extends_non_class.carbon

@@ -8,7 +8,7 @@
 
 package ExplorerTest api;
 
-// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/class/fail_extends_non_class.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'Type'
+// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/class/fail_extends_non_class.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
 class C extends 3 {
   var x: i32;
   var y: i32;

+ 1 - 1
explorer/testdata/class/fail_member_call_before_typecheck.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 class C {
-  fn PickType() -> Type { return i32; }
+  fn PickType() -> type { return i32; }
   // This is invalid even though `PickType` is defined earlier, because
   // checking of member bodies is deferred until after the class is completed.
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/class/fail_member_call_before_typecheck.carbon:[[@LINE+1]]: attempt to call function `PickType` that has not been fully type-checked

+ 1 - 1
explorer/testdata/class/fail_method_deduced.carbon

@@ -13,7 +13,7 @@ class C {
   fn G[self: Self]() {}
 }
 
-fn H[T:! Type](x: T) {}
+fn H[T:! type](x: T) {}
 
 fn Main() -> i32 {
   H(C.F);

+ 1 - 1
explorer/testdata/class/type_of_type.carbon

@@ -13,7 +13,7 @@ class C {}
 
 fn Main() -> i32 {
   var a: auto = C;
-  // OK: Type of `C` is `Type`.
+  // OK: type of `C` is `type`.
   a = i32;
   return 0;
 }

+ 1 - 1
explorer/testdata/constraint/binding_self.carbon

@@ -9,7 +9,7 @@
 
 package ExplorerTest api;
 
-interface SwizzleWith(T:! Type) {
+interface SwizzleWith(T:! type) {
   fn Op[self: Self](x: T) -> i32;
 }
 

+ 1 - 1
explorer/testdata/constraint/fail_dot_self_after_scope.carbon

@@ -8,7 +8,7 @@
 
 package ExplorerTest api;
 
-interface FrobWith(T:! Type) {}
+interface FrobWith(T:! type) {}
 
 fn F[T:! FrobWith(.Self)]
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/constraint/fail_dot_self_after_scope.carbon:[[@LINE+1]]: could not resolve '.Self'

+ 1 - 1
explorer/testdata/constraint/fail_dot_self_after_scope_2.carbon

@@ -8,7 +8,7 @@
 
 package ExplorerTest api;
 
-interface FrobWith(T:! Type) {}
+interface FrobWith(T:! type) {}
 
 fn F[T:! FrobWith(.Self),
      // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/constraint/fail_dot_self_after_scope_2.carbon:[[@LINE+1]]: `.Self` used in type of non-type generic binding `U`

+ 1 - 1
explorer/testdata/constraint/fail_non_type_self.carbon

@@ -8,7 +8,7 @@
 
 package ExplorerTest api;
 
-class X(T:! Type) {}
+class X(T:! type) {}
 
 // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/constraint/fail_non_type_self.carbon:[[@LINE+1]]: `.Self` used in type of non-type generic binding `T`
 fn F[T:! X(.Self)](x: T) {}

+ 1 - 1
explorer/testdata/constraint/fail_where_equals_different_types.carbon

@@ -12,7 +12,7 @@ interface A {}
 
 // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/constraint/fail_where_equals_different_types.carbon:[[@LINE+3]]: type mismatch between values in `where LHS == RHS`
 // CHECK:STDERR:   LHS type: i32
-// CHECK:STDERR:   RHS type: Type
+// CHECK:STDERR:   RHS type: type
 alias B = A where 4 == i32;
 
 fn Main() -> i32 { return 0; }

+ 1 - 1
explorer/testdata/constraint/fail_where_non_type_is.carbon

@@ -10,7 +10,7 @@ package ExplorerTest api;
 
 interface A {}
 
-// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/constraint/fail_where_non_type_is.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'Type'
+// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/constraint/fail_where_non_type_is.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
 alias B = A where 4 is A;
 
 fn Main() -> i32 { return 0; }

+ 1 - 1
explorer/testdata/constraint/rewrite.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface HasAssoc {
-  let Assoc:! Type;
+  let Assoc:! type;
   let AssocVal:! i32;
 }
 class X {

+ 1 - 1
explorer/testdata/constraint/rewrite_compound.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface HasAssoc {
-  let Assoc:! Type;
+  let Assoc:! type;
 }
 class X {
   external impl as HasAssoc where .Assoc = i32 {}

+ 1 - 1
explorer/testdata/constraint/rewrite_in_qualifier.carbon

@@ -10,7 +10,7 @@
 package ExplorerTest api;
 
 interface HasAssoc {
-  let Assoc:! Type;
+  let Assoc:! type;
 }
 class X {
   external impl as HasAssoc where .Assoc = i32 {}

+ 2 - 2
explorer/testdata/constraint/rewrite_in_qualifier_and_type.carbon

@@ -10,13 +10,13 @@
 package ExplorerTest api;
 
 interface HasAssoc {
-  let Assoc:! Type;
+  let Assoc:! type;
 }
 class X {
   external impl as HasAssoc where .Assoc = i32 {}
 }
 
-fn H[T:! HasAssoc where .Assoc = i32, U:! Type where .Self == i32](a: T, b: U) -> i32 {
+fn H[T:! HasAssoc where .Assoc = i32, U:! type where .Self == i32](a: T, b: U) -> i32 {
   var a: T.((HasAssoc where .Assoc = U).Assoc) = 3;
   return a;
 }

+ 1 - 1
explorer/testdata/constraint/type_of_type.carbon

@@ -13,7 +13,7 @@ interface I {}
 
 fn Main() -> i32 {
   var a: auto = I where .Self == i32;
-  // OK: Type of `I where ...` is `Type`.
+  // OK: type of `I where ...` is `type`.
   a = i32;
   return 0;
 }

+ 1 - 1
explorer/testdata/constraint/where_is.carbon

@@ -18,7 +18,7 @@ interface Extension {
   extends Base;
 }
 
-fn F[T:! Type where .Self is Extension](x: T) {
+fn F[T:! type where .Self is Extension](x: T) {
   x.(Extension.F)();
 }
 

+ 2 - 2
explorer/testdata/constraint/where_self.carbon

@@ -9,13 +9,13 @@
 
 package ExplorerTest api;
 
-interface SwizzleWith(T:! Type) {
+interface SwizzleWith(T:! type) {
   fn Op[self: Self](x: T) -> i32;
 }
 
 // TODO: There should be some way to write this that includes
 // `SwizzleWith(.Self)` in the list of lookup contexts.
-alias Swizzle = Type where .Self is SwizzleWith(.Self);
+alias Swizzle = type where .Self is SwizzleWith(.Self);
 
 impl i32 as SwizzleWith(i32) {
   fn Op[self: Self](x: Self) -> Self { return self * 10 + x; }

+ 3 - 3
explorer/testdata/experimental_continuation/convert_run.carbon

@@ -9,12 +9,12 @@
 
 package ExplorerTest api;
 
-class Wrap(T:! Type) {
+class Wrap(T:! type) {
   var v: T;
 }
-fn MakeWrap[T:! Type](x: T) -> Wrap(T) { return {.v = x}; }
+fn MakeWrap[T:! type](x: T) -> Wrap(T) { return {.v = x}; }
 
-impl forall [T:! Type] Wrap(T) as ImplicitAs(T) {
+impl forall [T:! type] Wrap(T) as ImplicitAs(T) {
   fn Convert[self: Self]() -> T {
     return self.v;
   }

+ 1 - 1
explorer/testdata/function/auto_return/modify_arg_type.carbon

@@ -9,7 +9,7 @@
 
 package ExplorerTest api;
 
-fn Id(t: Type) -> auto { return t; }
+fn Id(t: type) -> auto { return t; }
 
 // Test non-trivial type expression in parameter type.
 

+ 1 - 1
explorer/testdata/function/auto_return/modify_return_type.carbon

@@ -9,7 +9,7 @@
 
 package ExplorerTest api;
 
-fn Id(t: Type) -> auto { return t; }
+fn Id(t: type) -> auto { return t; }
 
 // Test non-trivial type expression in return type.
 

+ 1 - 1
explorer/testdata/function/auto_return/type.carbon

@@ -9,7 +9,7 @@
 
 package ExplorerTest api;
 
-fn Id(t: Type) -> auto { return t; }
+fn Id(t: type) -> auto { return t; }
 
 // Test non-trivial type expression in variable declaration statement.
 

+ 1 - 1
explorer/testdata/function/fail_parameter_type.carbon

@@ -9,7 +9,7 @@
 package ExplorerTest api;
 
 // 42 cannot be used as the type of a parameter.
-// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_parameter_type.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'Type'
+// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_parameter_type.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'type'
 fn f(x: 42) -> i32 {
   return x - 1;
 }

+ 1 - 1
explorer/testdata/function/fail_recurse_before_typecheck.carbon

@@ -8,7 +8,7 @@
 
 package ExplorerTest api;
 
-fn T() -> Type {
+fn T() -> type {
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_recurse_before_typecheck.carbon:[[@LINE+1]]: attempt to call function `T` that has not been fully type-checked
   var v: T() = 0;
   return i32;

+ 1 - 1
explorer/testdata/function/fail_return_call_has_invalid_body.carbon

@@ -8,7 +8,7 @@
 
 package EmptyIdentifier impl;
 
-fn apply[T:! Type, U:! Type](f: T, EmptyIdentifier: U) {
+fn apply[T:! type, U:! type](f: T, EmptyIdentifier: U) {
   // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_return_call_has_invalid_body.carbon:[[@LINE+1]]: only arrays and tuples can be indexed, found bool
   match (true[true]) {}
 }

+ 1 - 1
explorer/testdata/function/fail_var_type_is_call.carbon

@@ -13,7 +13,7 @@ fn test() -> i32 {
 }
 
 fn Main() -> i32 {
-  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_var_type_is_call.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'Type'
+  // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/function/fail_var_type_is_call.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'type'
   var x: test() = 1;
   return 0;
 }

+ 2 - 2
explorer/testdata/function/return_convertible_to_type.carbon

@@ -10,8 +10,8 @@
 package ExplorerTest api;
 
 class TypeLike {
-  impl as ImplicitAs(Type) {
-    fn Convert[self: Self]() -> Type { return i32; }
+  impl as ImplicitAs(type) {
+    fn Convert[self: Self]() -> type { return i32; }
   }
   fn Make() -> Self { return {}; }
 }

+ 3 - 3
explorer/testdata/generic_class/convert_from_struct.carbon

@@ -9,15 +9,15 @@
 
 package ExplorerTest api;
 
-class Point(T:! Type) {
+class Point(T:! type) {
   var x: T;
   var y: T;
 }
 
-fn GetX[T:! Type](pt: Point(T)) -> T {
+fn GetX[T:! type](pt: Point(T)) -> T {
   return pt.x;
 }
-fn GetY(T:! Type, pt: Point(T)) -> T {
+fn GetY(T:! type, pt: Point(T)) -> T {
   return pt.y;
 }
 

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio