From 4daaa4866f8f12ab00e7ba053182761b1e762cfd Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 4 Jan 2023 14:22:30 -0800 Subject: [PATCH] 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. --- common/fuzzing/proto_to_carbon.cpp | 2 +- docs/design/README.md | 22 +- docs/design/classes.md | 2 +- docs/design/expressions/arithmetic.md | 22 +- docs/design/expressions/as_expressions.md | 6 +- docs/design/expressions/bitwise.md | 22 +- .../expressions/comparison_operators.md | 6 +- docs/design/expressions/if.md | 22 +- .../expressions/implicit_conversions.md | 2 +- docs/design/expressions/indexing.md | 18 +- docs/design/expressions/literals.md | 6 +- docs/design/expressions/member_access.md | 12 +- docs/design/generics/details.md | 271 +++++++++--------- docs/design/generics/overview.md | 8 +- docs/design/generics/terminology.md | 16 +- docs/design/lexical_conventions/words.md | 1 + docs/design/name_lookup.md | 13 +- docs/design/sum_types.md | 8 +- docs/design/templates.md | 4 +- explorer/ast/declaration.h | 2 +- explorer/ast/expression.cpp | 2 +- explorer/ast/expression.h | 4 +- explorer/data/prelude.carbon | 84 +++--- explorer/interpreter/action_stack.cpp | 2 +- explorer/interpreter/impl_scope.h | 4 +- explorer/interpreter/interpreter.cpp | 4 +- explorer/interpreter/type_checker.cpp | 14 +- explorer/interpreter/value.cpp | 4 +- explorer/interpreter/value.h | 8 +- explorer/syntax/lexer.lpp | 2 +- explorer/testdata/alias/function_alias.carbon | 2 +- .../testdata/alias/interface_alias.carbon | 4 +- .../array/element_convertible_to_type.carbon | 4 +- .../as/fail_destination_not_type.carbon | 2 +- .../assoc_const/fail_anonymous.carbon | 2 +- .../assoc_const/fail_different_type.carbon | 2 +- .../assoc_const/fail_equal_indirectly.carbon | 6 +- .../fail_equal_to_dependent_type.carbon | 2 +- .../fail_implied_constraints.carbon | 4 +- .../assoc_const/fail_incomplete_impl_1.carbon | 6 +- .../assoc_const/fail_incomplete_impl_2.carbon | 6 +- .../assoc_const/fail_indirectly_equal.carbon | 2 +- .../fail_match_in_deduction.carbon | 6 +- .../assoc_const/fail_missing_equal.carbon | 2 +- .../assoc_const/fail_missing_rewrite.carbon | 2 +- .../fail_multi_impl_scoping.carbon | 6 +- .../fail_multiple_deduction.carbon | 10 +- .../fail_overspecified_impl.carbon | 2 +- .../assoc_const/fail_redefined.carbon | 4 +- .../fail_rewrite_creates_infinite_type.carbon | 2 +- .../assoc_const/fail_rewrite_cycle.carbon | 20 +- ...il_rewrite_depends_on_later_rewrite.carbon | 2 +- .../fail_simple_rewrite_cycle_1.carbon | 4 +- .../fail_simple_rewrite_cycle_2.carbon | 4 +- .../assoc_const/fail_unknown_value.carbon | 2 +- ...known_value_specified_in_constraint.carbon | 2 +- .../testdata/assoc_const/impl_lookup.carbon | 2 +- .../impl_used_by_later_rewrite.carbon | 4 +- .../assoc_const/pass_equal_to_rewrite.carbon | 2 +- .../assoc_const/pass_rewrite_to_equal.carbon | 2 +- .../assoc_const/resolve_rewrites.carbon | 20 +- .../rewrite_depends_on_prior_rewrite.carbon | 2 +- .../rewrite_interface_params.carbon | 14 +- .../assoc_const/rewrite_large_type.carbon | 16 +- .../assoc_const/simple_constraint.carbon | 2 +- .../assoc_const/simple_equality.carbon | 2 +- .../fail_alternative_not_type.carbon | 2 +- .../basic_syntax/fail_nested_binding.carbon | 2 +- .../basic_syntax/fail_var_type.carbon | 2 +- ..._choice_multiple_template_arguments.carbon | 2 +- ...ric_choice_nested_in_template_class.carbon | 4 +- .../generic_choice_simple_assignment.carbon | 2 +- explorer/testdata/choice/type_of_type.carbon | 2 +- .../class/fail_extends_non_class.carbon | 2 +- .../fail_member_call_before_typecheck.carbon | 2 +- .../testdata/class/fail_method_deduced.carbon | 2 +- explorer/testdata/class/type_of_type.carbon | 2 +- .../testdata/constraint/binding_self.carbon | 2 +- .../fail_dot_self_after_scope.carbon | 2 +- .../fail_dot_self_after_scope_2.carbon | 2 +- .../constraint/fail_non_type_self.carbon | 2 +- .../fail_where_equals_different_types.carbon | 2 +- .../constraint/fail_where_non_type_is.carbon | 2 +- explorer/testdata/constraint/rewrite.carbon | 2 +- .../constraint/rewrite_compound.carbon | 2 +- .../constraint/rewrite_in_qualifier.carbon | 2 +- .../rewrite_in_qualifier_and_type.carbon | 4 +- .../testdata/constraint/type_of_type.carbon | 2 +- explorer/testdata/constraint/where_is.carbon | 2 +- .../testdata/constraint/where_self.carbon | 4 +- .../convert_run.carbon | 6 +- .../auto_return/modify_arg_type.carbon | 2 +- .../auto_return/modify_return_type.carbon | 2 +- .../testdata/function/auto_return/type.carbon | 2 +- .../function/fail_parameter_type.carbon | 2 +- .../fail_recurse_before_typecheck.carbon | 2 +- .../fail_return_call_has_invalid_body.carbon | 2 +- .../function/fail_var_type_is_call.carbon | 2 +- .../return_convertible_to_type.carbon | 4 +- .../generic_class/convert_from_struct.carbon | 6 +- .../generic_class/fail_args_mismatch.carbon | 2 +- .../fail_argument_deduction.carbon | 6 +- .../fail_bad_parameter_type.carbon | 2 +- .../fail_field_access_on_generic.carbon | 2 +- .../fail_generic_class_arg.carbon | 2 +- .../fail_instantiate_non_generic.carbon | 2 +- .../generic_class/fail_no_args.carbon | 2 +- .../generic_class/fail_point_equal.carbon | 2 +- .../fail_return_type_is_type.carbon | 2 +- .../generic_class/fail_self_with_arg.carbon | 4 +- .../generic_class/fail_two_arg_lists.carbon | 4 +- .../generic_class/generic_point.carbon | 2 +- .../generic_class/impl_with_argument.carbon | 2 +- .../generic_class/impl_with_self.carbon | 2 +- .../instantiation_at_compile_time.carbon | 4 +- .../param_with_dependent_type.carbon | 2 +- .../generic_class/use_at_compile_time.carbon | 10 +- .../testdata/generic_class/use_self.carbon | 2 +- .../testdata/generic_function/apply.carbon | 2 +- .../call_at_compile_time.carbon | 2 +- ...ail_implicit_conversion_extra_field.carbon | 2 +- ...l_implicit_conversion_missing_field.carbon | 2 +- .../fail_missing_exclam.carbon | 2 +- .../generic_function/fail_not_addable.carbon | 2 +- .../generic_function/fail_not_type.carbon | 2 +- .../fail_type_deduction_mismatch.carbon | 4 +- .../fail_type_deduction_unused.carbon | 2 +- .../generic_function/generic_method.carbon | 4 +- .../generic_function/non_generic_param.carbon | 2 +- .../nondeduced_generic_param.carbon | 4 +- .../generic_function/return_val.carbon | 2 +- .../testdata/generic_function/swap.carbon | 2 +- .../generic_function/tuple_map.carbon | 2 +- .../generic_function/type_matching.carbon | 2 +- .../fail_modify_in_constant_expr.carbon | 2 +- .../testdata/impl/deducible_parameter.carbon | 6 +- .../impl/fail_ambiguous_impl_generic.carbon | 8 +- .../testdata/impl/fail_bad_member_kind.carbon | 2 +- .../impl/fail_impl_as_parameterized.carbon | 2 +- .../impl/fail_nondeducible_parameter.carbon | 6 +- .../impl/fail_param_interface_in_impl.carbon | 8 +- .../impl/fail_unambiguous_impl_generic.carbon | 6 +- .../testdata/impl/generic_method_impl.carbon | 4 +- explorer/testdata/impl/impl_constraint.carbon | 2 +- .../impl/impl_in_generic_class.carbon | 6 +- .../impl/param_interface_in_impl.carbon | 8 +- ...assoc_constant_constraints_in_scope.carbon | 6 +- explorer/testdata/interface/extends.carbon | 2 +- .../interface/fail_impl_as_not_type.carbon | 2 +- .../interface/fail_impl_not_type.carbon | 2 +- .../fail_member_lookup_in_definition.carbon | 2 +- .../fail_self_lookup_in_definition.carbon | 2 +- .../interface/fail_use_symbolic_member.carbon | 2 +- explorer/testdata/interface/impl_as.carbon | 2 +- .../impl_self_interface_parameter.carbon | 4 +- .../param_with_dependent_type.carbon | 2 +- .../testdata/interface/parameterized.carbon | 4 +- .../testdata/interface/type_of_type.carbon | 2 +- .../linked_list/typed_linked_list.carbon | 6 +- .../evaluate_type_before_dot.carbon | 10 +- ...ail_class_fn_use_before_declaration.carbon | 4 +- .../name_lookup/fail_fn_use_in_param.carbon | 2 +- .../fail_fn_use_in_return_type.carbon | 2 +- .../testdata/named_constraint/extends.carbon | 4 +- .../fail_associated_constant.carbon | 2 +- .../fail_compound_member_access.carbon | 4 +- .../testdata/named_constraint/impl_as.carbon | 2 +- explorer/testdata/operators/combine.carbon | 2 +- .../operators/fail_combine_lhs.carbon | 2 +- .../operators/fail_combine_rhs.carbon | 2 +- .../struct/field_convertible_to_type.carbon | 4 +- .../tuple/fail_nontype_tuple_as_type.carbon | 2 +- migrate_cpp/cpp_refactoring/for_range.h | 2 +- migrate_cpp/cpp_refactoring/var_decl.h | 2 +- third_party/examples/re2/re2.carbon | 2 +- toolchain/parser/parser.cpp | 2 +- .../testdata/operators/fixity_in_var.carbon | 4 +- .../parser/testdata/operators/postfix.carbon | 4 +- .../operators/postfix_space_after_op.carbon | 4 +- .../operators/recover_postfix_space.carbon | 4 +- .../recover_postfix_space_surrounding.carbon | 4 +- .../testdata/struct/fail_comma_only.carbon | 2 +- .../struct/fail_comma_repeat_in_type.carbon | 2 +- .../struct/fail_identifier_colon.carbon | 2 +- .../struct/fail_identifier_equals.carbon | 2 +- .../struct/fail_identifier_only.carbon | 2 +- .../struct/fail_mix_type_and_value.carbon | 2 +- .../struct/fail_no_colon_or_equals.carbon | 2 +- .../struct/fail_type_no_designator.carbon | 2 +- utils/highlightjs/highlightjs_carbon_lang.js | 3 +- utils/highlightjs/highlightjs_example.html | 6 +- utils/textmate/Samples/main.carbon | 2 +- utils/textmate/Syntaxes/Carbon.plist | 2 +- 193 files changed, 572 insertions(+), 570 deletions(-) diff --git a/common/fuzzing/proto_to_carbon.cpp b/common/fuzzing/proto_to_carbon.cpp index 5a4c53508535..f9c1eb5260f0 100644 --- a/common/fuzzing/proto_to_carbon.cpp +++ b/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: diff --git a/docs/design/README.md b/docs/design/README.md index bbef249bdcf7..85de54663a16 100644 --- a/docs/design/README.md +++ b/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()`: diff --git a/docs/design/classes.md b/docs/design/classes.md index 6f9bc6efdb4a..9c727484d04d 100644 --- a/docs/design/classes.md +++ b/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; } ``` diff --git a/docs/design/expressions/arithmetic.md b/docs/design/expressions/arithmetic.md index f5e99543b283..213cbd5a3825 100644 --- a/docs/design/expressions/arithmetic.md +++ b/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 { diff --git a/docs/design/expressions/as_expressions.md b/docs/design/expressions/as_expressions.md index 83cefe77a581..432a95ca477c 100644 --- a/docs/design/expressions/as_expressions.md +++ b/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 diff --git a/docs/design/expressions/bitwise.md b/docs/design/expressions/bitwise.md index 849cdff52313..5c57f22a7e63 100644 --- a/docs/design/expressions/bitwise.md +++ b/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 { diff --git a/docs/design/expressions/comparison_operators.md b/docs/design/expressions/comparison_operators.md index 42c2ee571e9a..7b899082a5dc 100644 --- a/docs/design/expressions/comparison_operators.md +++ b/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: diff --git a/docs/design/expressions/if.md b/docs/design/expressions/if.md index 7c4e82d0aed7..32124ca6431f 100644 --- a/docs/design/expressions/if.md +++ b/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 {} ``` diff --git a/docs/design/expressions/implicit_conversions.md b/docs/design/expressions/implicit_conversions.md index 8b4bbf497b0b..590878b62f0b 100644 --- a/docs/design/expressions/implicit_conversions.md +++ b/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; diff --git a/docs/design/expressions/indexing.md b/docs/design/expressions/indexing.md index a3c06fd0e0da..b48a0db47aef 100644 --- a/docs/design/expressions/indexing.md +++ b/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*; } } diff --git a/docs/design/expressions/literals.md b/docs/design/expressions/literals.md index 9736c0ece6e2..8bf7b004a615 100644 --- a/docs/design/expressions/literals.md +++ b/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; } diff --git a/docs/design/expressions/member_access.md b/docs/design/expressions/member_access.md index a5a71b7d02d9..17b07624704a 100644 --- a/docs/design/expressions/member_access.md +++ b/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; } ``` diff --git a/docs/design/generics/details.md b/docs/design/generics/details.md index 0d9ee420ab90..199a541774c4 100644 --- a/docs/design/generics/details.md +++ b/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 `= ` 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*)) { ... } diff --git a/docs/design/generics/overview.md b/docs/design/generics/overview.md index e07bf082c54e..4d2a5b9e1ee5 100644 --- a/docs/design/generics/overview.md +++ b/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 diff --git a/docs/design/generics/terminology.md b/docs/design/generics/terminology.md index 5102397b346c..f017521e9109 100644 --- a/docs/design/generics/terminology.md +++ b/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 diff --git a/docs/design/lexical_conventions/words.md b/docs/design/lexical_conventions/words.md index a5c35eaabf43..a290aeefe576 100644 --- a/docs/design/lexical_conventions/words.md +++ b/docs/design/lexical_conventions/words.md @@ -78,6 +78,7 @@ The following words are interpreted as keywords: - `returned` - `Self` - `then` +- `type` - `var` - `virtual` - `where` diff --git a/docs/design/name_lookup.md b/docs/design/name_lookup.md index 1b392f5c96b4..9f22c942d7fb 100644 --- a/docs/design/name_lookup.md +++ b/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". +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. -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`. +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 diff --git a/docs/design/sum_types.md b/docs/design/sum_types.md index c6f959f9d8c6..3254e2a7843d 100644 --- a/docs/design/sum_types.md +++ b/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; diff --git a/docs/design/templates.md b/docs/design/templates.md index 013eef15c7a5..3a848086e143 100644 --- a/docs/design/templates.md +++ b/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; } diff --git a/explorer/ast/declaration.h b/explorer/ast/declaration.h index 310daf39e5b8..a4347015a1fa 100644 --- a/explorer/ast/declaration.h +++ b/explorer/ast/declaration.h @@ -538,7 +538,7 @@ class ConstraintTypeDeclaration : public Declaration { auto params() -> std::optional> { 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 { return self_type_; } diff --git a/explorer/ast/expression.cpp b/explorer/ast/expression.cpp index e57f99c33c93..2b3968d50a63 100644 --- a/explorer/ast/expression.cpp +++ b/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"; diff --git a/explorer/ast/expression.h b/explorer/ast/expression.h index 03fc9fa128d5..e221637ab83c 100644 --- a/explorer/ast/expression.h +++ b/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 diff --git a/explorer/data/prelude.carbon b/explorer/data/prelude.carbon index 8ad8aaae7809..fba3f5e667ac 100644 --- a/explorer/data/prelude.carbon +++ b/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); } } diff --git a/explorer/interpreter/action_stack.cpp b/explorer/interpreter/action_stack.cpp index 06178d774543..47a59d801635 100644 --- a/explorer/interpreter/action_stack.cpp +++ b/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. diff --git a/explorer/interpreter/impl_scope.h b/explorer/interpreter/impl_scope.h index f6066da18bb9..5e1a425df490 100644 --- a/explorer/interpreter/impl_scope.h +++ b/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) // } diff --git a/explorer/interpreter/interpreter.cpp b/explorer/interpreter/interpreter.cpp index f13fd0194aa3..37e497c2e051 100644 --- a/explorer/interpreter/interpreter.cpp +++ b/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 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(); } default: { diff --git a/explorer/interpreter/type_checker.cpp b/explorer/interpreter/type_checker.cpp index 118a94294cc2..1cad4eb37828 100644 --- a/explorer/interpreter/type_checker.cpp +++ b/explorer/interpreter/type_checker.cpp @@ -195,8 +195,8 @@ static auto IsType(Nonnull value) -> bool { // type-of-type. const auto& assoc = cast(*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(destination)) { - // First convert the source expression to type `Type`. + // First convert the source expression to type `type`. CARBON_ASSIGN_OR_RETURN(Nonnull source_as_type, ImplicitlyConvert(context, impl_scope, source, arena_->New())); @@ -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 binding, Nonnull 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 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 self_type = arena_->New( class_decl, Bindings::SymbolicIdentity(arena_, bindings), base_class, diff --git a/explorer/interpreter/value.cpp b/explorer/interpreter/value.cpp index 16c8486b74d7..5a3ab1040632 100644 --- a/explorer/interpreter/value.cpp +++ b/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 "); diff --git a/explorer/interpreter/value.h b/explorer/interpreter/value.h index d120e2845c60..0879fdc8eef6 100644 --- a/explorer/interpreter/value.h +++ b/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 binding; diff --git a/explorer/syntax/lexer.lpp b/explorer/syntax/lexer.lpp index 5735c560f4b9..25f7fd2e8477 100644 --- a/explorer/syntax/lexer.lpp +++ b/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" diff --git a/explorer/testdata/alias/function_alias.carbon b/explorer/testdata/alias/function_alias.carbon index 39f5153a6f38..6578ff0517c3 100644 --- a/explorer/testdata/alias/function_alias.carbon +++ b/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; diff --git a/explorer/testdata/alias/interface_alias.carbon b/explorer/testdata/alias/interface_alias.carbon index 0c9c5f28634b..a297651b09d7 100644 --- a/explorer/testdata/alias/interface_alias.carbon +++ b/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; diff --git a/explorer/testdata/array/element_convertible_to_type.carbon b/explorer/testdata/array/element_convertible_to_type.carbon index f3f0d066e262..3b3fc99ff681 100644 --- a/explorer/testdata/array/element_convertible_to_type.carbon +++ b/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 {}; } } diff --git a/explorer/testdata/as/fail_destination_not_type.carbon b/explorer/testdata/as/fail_destination_not_type.carbon index 87c556952bbd..1869323a6bcc 100644 --- a/explorer/testdata/as/fail_destination_not_type.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/fail_anonymous.carbon b/explorer/testdata/assoc_const/fail_anonymous.carbon index 9eab2a36020a..a26a76355b2c 100644 --- a/explorer/testdata/assoc_const/fail_anonymous.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/fail_different_type.carbon b/explorer/testdata/assoc_const/fail_different_type.carbon index c01c11606556..0b99e778745e 100644 --- a/explorer/testdata/assoc_const/fail_different_type.carbon +++ b/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) {} diff --git a/explorer/testdata/assoc_const/fail_equal_indirectly.carbon b/explorer/testdata/assoc_const/fail_equal_indirectly.carbon index aa9d7ddae4f5..875875573c3c 100644 --- a/explorer/testdata/assoc_const/fail_equal_indirectly.carbon +++ b/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); } diff --git a/explorer/testdata/assoc_const/fail_equal_to_dependent_type.carbon b/explorer/testdata/assoc_const/fail_equal_to_dependent_type.carbon index 9c02b4e5554d..4e786c59e1e0 100644 --- a/explorer/testdata/assoc_const/fail_equal_to_dependent_type.carbon +++ b/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) {} diff --git a/explorer/testdata/assoc_const/fail_implied_constraints.carbon b/explorer/testdata/assoc_const/fail_implied_constraints.carbon index e00540b8d14a..ab0b9f6248c5 100644 --- a/explorer/testdata/assoc_const/fail_implied_constraints.carbon +++ b/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); } diff --git a/explorer/testdata/assoc_const/fail_incomplete_impl_1.carbon b/explorer/testdata/assoc_const/fail_incomplete_impl_1.carbon index db78111711ac..d20748452f27 100644 --- a/explorer/testdata/assoc_const/fail_incomplete_impl_1.carbon +++ b/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 diff --git a/explorer/testdata/assoc_const/fail_incomplete_impl_2.carbon b/explorer/testdata/assoc_const/fail_incomplete_impl_2.carbon index fb2ca97fc8f3..eac37329cf40 100644 --- a/explorer/testdata/assoc_const/fail_incomplete_impl_2.carbon +++ b/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 diff --git a/explorer/testdata/assoc_const/fail_indirectly_equal.carbon b/explorer/testdata/assoc_const/fail_indirectly_equal.carbon index da46821ad5ed..7e6a8206aff5 100644 --- a/explorer/testdata/assoc_const/fail_indirectly_equal.carbon +++ b/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 { diff --git a/explorer/testdata/assoc_const/fail_match_in_deduction.carbon b/explorer/testdata/assoc_const/fail_match_in_deduction.carbon index ad711a953681..27c056dfbceb 100644 --- a/explorer/testdata/assoc_const/fail_match_in_deduction.carbon +++ b/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` diff --git a/explorer/testdata/assoc_const/fail_missing_equal.carbon b/explorer/testdata/assoc_const/fail_missing_equal.carbon index 301dc97cd8b1..0744ee81b601 100644 --- a/explorer/testdata/assoc_const/fail_missing_equal.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/fail_missing_rewrite.carbon b/explorer/testdata/assoc_const/fail_missing_rewrite.carbon index 2397e48443d7..d7f054c44d21 100644 --- a/explorer/testdata/assoc_const/fail_missing_rewrite.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/fail_multi_impl_scoping.carbon b/explorer/testdata/assoc_const/fail_multi_impl_scoping.carbon index e3e8680573a4..eb13f80ff537 100644 --- a/explorer/testdata/assoc_const/fail_multi_impl_scoping.carbon +++ b/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. diff --git a/explorer/testdata/assoc_const/fail_multiple_deduction.carbon b/explorer/testdata/assoc_const/fail_multiple_deduction.carbon index 1021e549b66e..3884a23dfceb 100644 --- a/explorer/testdata/assoc_const/fail_multiple_deduction.carbon +++ b/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()); diff --git a/explorer/testdata/assoc_const/fail_overspecified_impl.carbon b/explorer/testdata/assoc_const/fail_overspecified_impl.carbon index 026e7e64a532..823329535288 100644 --- a/explorer/testdata/assoc_const/fail_overspecified_impl.carbon +++ b/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)`: diff --git a/explorer/testdata/assoc_const/fail_redefined.carbon b/explorer/testdata/assoc_const/fail_redefined.carbon index 3886974aade3..9874dddcdf85 100644 --- a/explorer/testdata/assoc_const/fail_redefined.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/fail_rewrite_creates_infinite_type.carbon b/explorer/testdata/assoc_const/fail_rewrite_creates_infinite_type.carbon index 97c12301a85a..54c22dc9b35b 100644 --- a/explorer/testdata/assoc_const/fail_rewrite_creates_infinite_type.carbon +++ b/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)* diff --git a/explorer/testdata/assoc_const/fail_rewrite_cycle.carbon b/explorer/testdata/assoc_const/fail_rewrite_cycle.carbon index b6b0ab0e05dd..2b0f3ebdf7ec 100644 --- a/explorer/testdata/assoc_const/fail_rewrite_cycle.carbon +++ b/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[ diff --git a/explorer/testdata/assoc_const/fail_rewrite_depends_on_later_rewrite.carbon b/explorer/testdata/assoc_const/fail_rewrite_depends_on_later_rewrite.carbon index f1f99c35457d..bcd10d7c0a03 100644 --- a/explorer/testdata/assoc_const/fail_rewrite_depends_on_later_rewrite.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/fail_simple_rewrite_cycle_1.carbon b/explorer/testdata/assoc_const/fail_simple_rewrite_cycle_1.carbon index 8a64a80b3832..5583e1712de7 100644 --- a/explorer/testdata/assoc_const/fail_simple_rewrite_cycle_1.carbon +++ b/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 diff --git a/explorer/testdata/assoc_const/fail_simple_rewrite_cycle_2.carbon b/explorer/testdata/assoc_const/fail_simple_rewrite_cycle_2.carbon index 04cf6be2b1a9..79734b2ea874 100644 --- a/explorer/testdata/assoc_const/fail_simple_rewrite_cycle_2.carbon +++ b/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 diff --git a/explorer/testdata/assoc_const/fail_unknown_value.carbon b/explorer/testdata/assoc_const/fail_unknown_value.carbon index a9c3eb6e3575..7974c91200c4 100644 --- a/explorer/testdata/assoc_const/fail_unknown_value.carbon +++ b/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 diff --git a/explorer/testdata/assoc_const/fail_unknown_value_specified_in_constraint.carbon b/explorer/testdata/assoc_const/fail_unknown_value_specified_in_constraint.carbon index 1702d9426890..81576eaf2fce 100644 --- a/explorer/testdata/assoc_const/fail_unknown_value_specified_in_constraint.carbon +++ b/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. diff --git a/explorer/testdata/assoc_const/impl_lookup.carbon b/explorer/testdata/assoc_const/impl_lookup.carbon index a3ead62280db..163fad39b43c 100644 --- a/explorer/testdata/assoc_const/impl_lookup.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/impl_used_by_later_rewrite.carbon b/explorer/testdata/assoc_const/impl_used_by_later_rewrite.carbon index d7830712a1ca..78ea7829b21a 100644 --- a/explorer/testdata/assoc_const/impl_used_by_later_rewrite.carbon +++ b/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); } diff --git a/explorer/testdata/assoc_const/pass_equal_to_rewrite.carbon b/explorer/testdata/assoc_const/pass_equal_to_rewrite.carbon index df68c49f5d1b..3b3dea527eb4 100644 --- a/explorer/testdata/assoc_const/pass_equal_to_rewrite.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/pass_rewrite_to_equal.carbon b/explorer/testdata/assoc_const/pass_rewrite_to_equal.carbon index 8f696aedc349..42d612d1b306 100644 --- a/explorer/testdata/assoc_const/pass_rewrite_to_equal.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/resolve_rewrites.carbon b/explorer/testdata/assoc_const/resolve_rewrites.carbon index f35e2bc8c4b9..13fe404a5f78 100644 --- a/explorer/testdata/assoc_const/resolve_rewrites.carbon +++ b/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[ diff --git a/explorer/testdata/assoc_const/rewrite_depends_on_prior_rewrite.carbon b/explorer/testdata/assoc_const/rewrite_depends_on_prior_rewrite.carbon index 4aec35784b38..d6aeeb85a934 100644 --- a/explorer/testdata/assoc_const/rewrite_depends_on_prior_rewrite.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/rewrite_interface_params.carbon b/explorer/testdata/assoc_const/rewrite_interface_params.carbon index 31c3a1558051..9c8421dcf96f 100644 --- a/explorer/testdata/assoc_const/rewrite_interface_params.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/rewrite_large_type.carbon b/explorer/testdata/assoc_const/rewrite_large_type.carbon index a50cf4086525..78bcf9ea38ec 100644 --- a/explorer/testdata/assoc_const/rewrite_large_type.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/simple_constraint.carbon b/explorer/testdata/assoc_const/simple_constraint.carbon index 33e545f337d2..bff930e48438 100644 --- a/explorer/testdata/assoc_const/simple_constraint.carbon +++ b/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; } diff --git a/explorer/testdata/assoc_const/simple_equality.carbon b/explorer/testdata/assoc_const/simple_equality.carbon index d292f72c722d..8f2d583e9ab1 100644 --- a/explorer/testdata/assoc_const/simple_equality.carbon +++ b/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; } diff --git a/explorer/testdata/basic_syntax/fail_alternative_not_type.carbon b/explorer/testdata/basic_syntax/fail_alternative_not_type.carbon index 7dd7d38d0d35..07c8830e409d 100644 --- a/explorer/testdata/basic_syntax/fail_alternative_not_type.carbon +++ b/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 { diff --git a/explorer/testdata/basic_syntax/fail_nested_binding.carbon b/explorer/testdata/basic_syntax/fail_nested_binding.carbon index 8fb2e3167868..5c075f34cffb 100644 --- a/explorer/testdata/basic_syntax/fail_nested_binding.carbon +++ b/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; } diff --git a/explorer/testdata/basic_syntax/fail_var_type.carbon b/explorer/testdata/basic_syntax/fail_var_type.carbon index d65bc70bb074..fdcdd142d9d2 100644 --- a/explorer/testdata/basic_syntax/fail_var_type.carbon +++ b/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; } diff --git a/explorer/testdata/choice/generic_choice_multiple_template_arguments.carbon b/explorer/testdata/choice/generic_choice_multiple_template_arguments.carbon index 7b398c12fcb3..01c6874f3838 100644 --- a/explorer/testdata/choice/generic_choice_multiple_template_arguments.carbon +++ b/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) } diff --git a/explorer/testdata/choice/generic_choice_nested_in_template_class.carbon b/explorer/testdata/choice/generic_choice_nested_in_template_class.carbon index 44f92f1d6ecc..b2c58eb1897a 100644 --- a/explorer/testdata/choice/generic_choice_nested_in_template_class.carbon +++ b/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() }; } diff --git a/explorer/testdata/choice/generic_choice_simple_assignment.carbon b/explorer/testdata/choice/generic_choice_simple_assignment.carbon index b1c1f2f5bdab..04a64ad1d996 100644 --- a/explorer/testdata/choice/generic_choice_simple_assignment.carbon +++ b/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) } diff --git a/explorer/testdata/choice/type_of_type.carbon b/explorer/testdata/choice/type_of_type.carbon index dfb103de7d0d..beba53d09232 100644 --- a/explorer/testdata/choice/type_of_type.carbon +++ b/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; } diff --git a/explorer/testdata/class/fail_extends_non_class.carbon b/explorer/testdata/class/fail_extends_non_class.carbon index f29de898f8ad..d5c7ff0b1dad 100644 --- a/explorer/testdata/class/fail_extends_non_class.carbon +++ b/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; diff --git a/explorer/testdata/class/fail_member_call_before_typecheck.carbon b/explorer/testdata/class/fail_member_call_before_typecheck.carbon index 97a42a0892be..801a6a828573 100644 --- a/explorer/testdata/class/fail_member_call_before_typecheck.carbon +++ b/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 diff --git a/explorer/testdata/class/fail_method_deduced.carbon b/explorer/testdata/class/fail_method_deduced.carbon index 0b6179589aa1..0635c4832566 100644 --- a/explorer/testdata/class/fail_method_deduced.carbon +++ b/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); diff --git a/explorer/testdata/class/type_of_type.carbon b/explorer/testdata/class/type_of_type.carbon index 54a27c83a043..cf315db02bbb 100644 --- a/explorer/testdata/class/type_of_type.carbon +++ b/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; } diff --git a/explorer/testdata/constraint/binding_self.carbon b/explorer/testdata/constraint/binding_self.carbon index 4966c8d42415..42aaaaec06ca 100644 --- a/explorer/testdata/constraint/binding_self.carbon +++ b/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; } diff --git a/explorer/testdata/constraint/fail_dot_self_after_scope.carbon b/explorer/testdata/constraint/fail_dot_self_after_scope.carbon index 180bb7f4529d..8c1ba3a12dff 100644 --- a/explorer/testdata/constraint/fail_dot_self_after_scope.carbon +++ b/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' diff --git a/explorer/testdata/constraint/fail_dot_self_after_scope_2.carbon b/explorer/testdata/constraint/fail_dot_self_after_scope_2.carbon index 641a84738d4b..a7106b3e3e74 100644 --- a/explorer/testdata/constraint/fail_dot_self_after_scope_2.carbon +++ b/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` diff --git a/explorer/testdata/constraint/fail_non_type_self.carbon b/explorer/testdata/constraint/fail_non_type_self.carbon index a5146089efa6..c579560c4f7e 100644 --- a/explorer/testdata/constraint/fail_non_type_self.carbon +++ b/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) {} diff --git a/explorer/testdata/constraint/fail_where_equals_different_types.carbon b/explorer/testdata/constraint/fail_where_equals_different_types.carbon index 96e71f1c99f0..be948c6e9ab6 100644 --- a/explorer/testdata/constraint/fail_where_equals_different_types.carbon +++ b/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; } diff --git a/explorer/testdata/constraint/fail_where_non_type_is.carbon b/explorer/testdata/constraint/fail_where_non_type_is.carbon index a48ac967980f..6628d0368642 100644 --- a/explorer/testdata/constraint/fail_where_non_type_is.carbon +++ b/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; } diff --git a/explorer/testdata/constraint/rewrite.carbon b/explorer/testdata/constraint/rewrite.carbon index 5b03864680bb..9dfda97482da 100644 --- a/explorer/testdata/constraint/rewrite.carbon +++ b/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 { diff --git a/explorer/testdata/constraint/rewrite_compound.carbon b/explorer/testdata/constraint/rewrite_compound.carbon index 0785d67f96b0..bb1d55b26181 100644 --- a/explorer/testdata/constraint/rewrite_compound.carbon +++ b/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 {} diff --git a/explorer/testdata/constraint/rewrite_in_qualifier.carbon b/explorer/testdata/constraint/rewrite_in_qualifier.carbon index 8ee5ae841cd5..e93138b97fc2 100644 --- a/explorer/testdata/constraint/rewrite_in_qualifier.carbon +++ b/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 {} diff --git a/explorer/testdata/constraint/rewrite_in_qualifier_and_type.carbon b/explorer/testdata/constraint/rewrite_in_qualifier_and_type.carbon index e6e9d4ec8563..23ce811aedc7 100644 --- a/explorer/testdata/constraint/rewrite_in_qualifier_and_type.carbon +++ b/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; } diff --git a/explorer/testdata/constraint/type_of_type.carbon b/explorer/testdata/constraint/type_of_type.carbon index a1c4f44cda07..27bf9fb75d36 100644 --- a/explorer/testdata/constraint/type_of_type.carbon +++ b/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; } diff --git a/explorer/testdata/constraint/where_is.carbon b/explorer/testdata/constraint/where_is.carbon index 21a8220113e4..b1010b7ed628 100644 --- a/explorer/testdata/constraint/where_is.carbon +++ b/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)(); } diff --git a/explorer/testdata/constraint/where_self.carbon b/explorer/testdata/constraint/where_self.carbon index 88ad51151025..4a44e973dfc4 100644 --- a/explorer/testdata/constraint/where_self.carbon +++ b/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; } diff --git a/explorer/testdata/experimental_continuation/convert_run.carbon b/explorer/testdata/experimental_continuation/convert_run.carbon index 6af315b59637..2f6376afef23 100644 --- a/explorer/testdata/experimental_continuation/convert_run.carbon +++ b/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; } diff --git a/explorer/testdata/function/auto_return/modify_arg_type.carbon b/explorer/testdata/function/auto_return/modify_arg_type.carbon index d59405cfbf36..adf1cef918c1 100644 --- a/explorer/testdata/function/auto_return/modify_arg_type.carbon +++ b/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. diff --git a/explorer/testdata/function/auto_return/modify_return_type.carbon b/explorer/testdata/function/auto_return/modify_return_type.carbon index ec065f2ef127..e15587e7aa53 100644 --- a/explorer/testdata/function/auto_return/modify_return_type.carbon +++ b/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. diff --git a/explorer/testdata/function/auto_return/type.carbon b/explorer/testdata/function/auto_return/type.carbon index 929abb38ecca..42a2c545d17a 100644 --- a/explorer/testdata/function/auto_return/type.carbon +++ b/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. diff --git a/explorer/testdata/function/fail_parameter_type.carbon b/explorer/testdata/function/fail_parameter_type.carbon index 52b9d1861dd1..1705dd2a4d8c 100644 --- a/explorer/testdata/function/fail_parameter_type.carbon +++ b/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; } diff --git a/explorer/testdata/function/fail_recurse_before_typecheck.carbon b/explorer/testdata/function/fail_recurse_before_typecheck.carbon index 7f0a2db6d67c..60db2d63aaed 100644 --- a/explorer/testdata/function/fail_recurse_before_typecheck.carbon +++ b/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; diff --git a/explorer/testdata/function/fail_return_call_has_invalid_body.carbon b/explorer/testdata/function/fail_return_call_has_invalid_body.carbon index 6415ecdcf1b5..042612991c0e 100644 --- a/explorer/testdata/function/fail_return_call_has_invalid_body.carbon +++ b/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]) {} } diff --git a/explorer/testdata/function/fail_var_type_is_call.carbon b/explorer/testdata/function/fail_var_type_is_call.carbon index e98878db1c9d..721c8465cf90 100644 --- a/explorer/testdata/function/fail_var_type_is_call.carbon +++ b/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; } diff --git a/explorer/testdata/function/return_convertible_to_type.carbon b/explorer/testdata/function/return_convertible_to_type.carbon index 242936d4ae66..a38d1b026988 100644 --- a/explorer/testdata/function/return_convertible_to_type.carbon +++ b/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 {}; } } diff --git a/explorer/testdata/generic_class/convert_from_struct.carbon b/explorer/testdata/generic_class/convert_from_struct.carbon index 9efd84bb80e3..b696eb17efbc 100644 --- a/explorer/testdata/generic_class/convert_from_struct.carbon +++ b/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; } diff --git a/explorer/testdata/generic_class/fail_args_mismatch.carbon b/explorer/testdata/generic_class/fail_args_mismatch.carbon index c846e047b9a3..2eb70e24cf08 100644 --- a/explorer/testdata/generic_class/fail_args_mismatch.carbon +++ b/explorer/testdata/generic_class/fail_args_mismatch.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { // Point(T, T) does not match class declaration // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_args_mismatch.carbon:[[@LINE+1]]: wrong number of arguments in function call, expected 1 but got 2 fn Origin(zero: T) -> Point(T, T) { diff --git a/explorer/testdata/generic_class/fail_argument_deduction.carbon b/explorer/testdata/generic_class/fail_argument_deduction.carbon index e3f39b6b73be..ac3db1872da3 100644 --- a/explorer/testdata/generic_class/fail_argument_deduction.carbon +++ b/explorer/testdata/generic_class/fail_argument_deduction.carbon @@ -8,19 +8,19 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { var x: T; var y: T; } -fn FirstOfTwoPoints[T:! Type](a: Point(T), b: Point(T)) -> Point(T) { +fn FirstOfTwoPoints[T:! type](a: Point(T), b: Point(T)) -> Point(T) { return a; } fn Main() -> i32 { var p: Point(i32) = {.x = 0, .y = 1}; var q: Point(bool) = {.x = true, .y = false}; - // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_argument_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type: + // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_argument_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! type: // CHECK:STDERR: i32 // CHECK:STDERR: bool return FirstOfTwoPoints(p, q).x; diff --git a/explorer/testdata/generic_class/fail_bad_parameter_type.carbon b/explorer/testdata/generic_class/fail_bad_parameter_type.carbon index 8176e080fe53..2a41eb26ae36 100644 --- a/explorer/testdata/generic_class/fail_bad_parameter_type.carbon +++ b/explorer/testdata/generic_class/fail_bad_parameter_type.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; class Point(T:! i32) { - // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_bad_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/generic_class/fail_bad_parameter_type.carbon:[[@LINE+1]]: type error in type of name binding: 'i32' is not implicitly convertible to 'type' fn Origin(zero: T) -> Point(T) { return {.x = zero, .y = zero}; } diff --git a/explorer/testdata/generic_class/fail_field_access_on_generic.carbon b/explorer/testdata/generic_class/fail_field_access_on_generic.carbon index 20449e8b88ac..4e54c72684f9 100644 --- a/explorer/testdata/generic_class/fail_field_access_on_generic.carbon +++ b/explorer/testdata/generic_class/fail_field_access_on_generic.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -fn BadSimpleMemberAccess[T:! Type](a: T) -> T { +fn BadSimpleMemberAccess[T:! type](a: T) -> T { // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_field_access_on_generic.carbon:[[@LINE+1]]: member access in unconstrained type return a.x; } diff --git a/explorer/testdata/generic_class/fail_generic_class_arg.carbon b/explorer/testdata/generic_class/fail_generic_class_arg.carbon index c1343888de39..611ee65d05fb 100644 --- a/explorer/testdata/generic_class/fail_generic_class_arg.carbon +++ b/explorer/testdata/generic_class/fail_generic_class_arg.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { fn Create(x: T, y: T) -> Point(T) { return {.x = x, .y = y}; } diff --git a/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon b/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon index 84a3feecf7ca..d325921a5b1c 100644 --- a/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon +++ b/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon @@ -17,7 +17,7 @@ class Point { } fn Main() -> i32 { - // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon:[[@LINE+1]]: in call `Point(i32)`, expected callee to be a function, found `Type` + // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_instantiate_non_generic.carbon:[[@LINE+1]]: in call `Point(i32)`, expected callee to be a function, found `type` var p: Point(i32) = Point.Origin(); return 0; } diff --git a/explorer/testdata/generic_class/fail_no_args.carbon b/explorer/testdata/generic_class/fail_no_args.carbon index 1952585c93f0..ba089bd3d8c9 100644 --- a/explorer/testdata/generic_class/fail_no_args.carbon +++ b/explorer/testdata/generic_class/fail_no_args.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { fn Origin(zero: T) -> Point(T) { return {.x = zero, .y = zero}; } diff --git a/explorer/testdata/generic_class/fail_point_equal.carbon b/explorer/testdata/generic_class/fail_point_equal.carbon index 8c8fc36ba3c7..5dc6cebde095 100644 --- a/explorer/testdata/generic_class/fail_point_equal.carbon +++ b/explorer/testdata/generic_class/fail_point_equal.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { var x: T; var y: T; } diff --git a/explorer/testdata/generic_class/fail_return_type_is_type.carbon b/explorer/testdata/generic_class/fail_return_type_is_type.carbon index df6518bc7ee3..127527c6c684 100644 --- a/explorer/testdata/generic_class/fail_return_type_is_type.carbon +++ b/explorer/testdata/generic_class/fail_return_type_is_type.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { // The return type should be Point(T). Point by itself is not a type. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_return_type_is_type.carbon:[[@LINE+1]]: 'Point' must be given an argument list fn Create(x: T, y: T) -> Point { diff --git a/explorer/testdata/generic_class/fail_self_with_arg.carbon b/explorer/testdata/generic_class/fail_self_with_arg.carbon index 2e593a70dade..1c16b636738a 100644 --- a/explorer/testdata/generic_class/fail_self_with_arg.carbon +++ b/explorer/testdata/generic_class/fail_self_with_arg.carbon @@ -8,10 +8,10 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { // Error: wrote `Self(T)` instead of `Self`. - // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_self_with_arg.carbon:[[@LINE+1]]: in call `Self(T)`, expected callee to be a function, found `Type` + // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_self_with_arg.carbon:[[@LINE+1]]: in call `Self(T)`, expected callee to be a function, found `type` fn Origin(zero: T) -> Self(T) { return {.x = zero, .y = zero}; } diff --git a/explorer/testdata/generic_class/fail_two_arg_lists.carbon b/explorer/testdata/generic_class/fail_two_arg_lists.carbon index 57df4031541a..79fbaa416cb0 100644 --- a/explorer/testdata/generic_class/fail_two_arg_lists.carbon +++ b/explorer/testdata/generic_class/fail_two_arg_lists.carbon @@ -8,8 +8,8 @@ package ExplorerTest api; -class Point(T:! Type) { - // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_two_arg_lists.carbon:[[@LINE+1]]: in call `Point(T)(T)`, expected callee to be a function, found `Type` +class Point(T:! type) { + // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_two_arg_lists.carbon:[[@LINE+1]]: in call `Point(T)(T)`, expected callee to be a function, found `type` fn Origin(zero: T) -> Point(T)(T) { return {.x = zero, .y = zero}; } diff --git a/explorer/testdata/generic_class/generic_point.carbon b/explorer/testdata/generic_class/generic_point.carbon index c4f8ca66870d..47dea3c1dec5 100644 --- a/explorer/testdata/generic_class/generic_point.carbon +++ b/explorer/testdata/generic_class/generic_point.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { fn Origin(zero: T) -> Point(T) { return {.x = zero, .y = zero}; } diff --git a/explorer/testdata/generic_class/impl_with_argument.carbon b/explorer/testdata/generic_class/impl_with_argument.carbon index 8d00afec38e1..89f5c2e7d362 100644 --- a/explorer/testdata/generic_class/impl_with_argument.carbon +++ b/explorer/testdata/generic_class/impl_with_argument.carbon @@ -15,7 +15,7 @@ interface Vector { fn Scale[self: Self](v: i32) -> Self; } -class Point(T:! Type) { +class Point(T:! type) { var x: T; var y: T; } diff --git a/explorer/testdata/generic_class/impl_with_self.carbon b/explorer/testdata/generic_class/impl_with_self.carbon index 340d8c10423f..dabb3e393a4e 100644 --- a/explorer/testdata/generic_class/impl_with_self.carbon +++ b/explorer/testdata/generic_class/impl_with_self.carbon @@ -15,7 +15,7 @@ interface Vector { fn Scale[self: Self](v: i32) -> Self; } -class Point(T:! Type) { +class Point(T:! type) { var x: T; var y: T; } diff --git a/explorer/testdata/generic_class/instantiation_at_compile_time.carbon b/explorer/testdata/generic_class/instantiation_at_compile_time.carbon index 5d92b1dcfdfc..d1a11b450565 100644 --- a/explorer/testdata/generic_class/instantiation_at_compile_time.carbon +++ b/explorer/testdata/generic_class/instantiation_at_compile_time.carbon @@ -9,9 +9,9 @@ package ExplorerTest api; -class C(T:! Type) {} +class C(T:! type) {} -fn F(T:! Type) -> Type { +fn F(T:! type) -> type { return C(T); } diff --git a/explorer/testdata/generic_class/param_with_dependent_type.carbon b/explorer/testdata/generic_class/param_with_dependent_type.carbon index ad7d5948e726..1b92916d03ba 100644 --- a/explorer/testdata/generic_class/param_with_dependent_type.carbon +++ b/explorer/testdata/generic_class/param_with_dependent_type.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -class Point(T:! Type, V:! T) { +class Point(T:! type, V:! T) { fn Get[self: Self]() -> T { return V; } diff --git a/explorer/testdata/generic_class/use_at_compile_time.carbon b/explorer/testdata/generic_class/use_at_compile_time.carbon index 9e5931ce11c2..21477fb26d51 100644 --- a/explorer/testdata/generic_class/use_at_compile_time.carbon +++ b/explorer/testdata/generic_class/use_at_compile_time.carbon @@ -9,15 +9,15 @@ package ExplorerTest api; -interface Has(T:! Type) { +interface Has(T:! type) { fn Get() -> T; } -impl i32 as Has(Type) { - fn Get() -> Type { return Self; } +impl i32 as Has(type) { + fn Get() -> type { return Self; } } -class WithType(T:! Has(Type)) { - fn Get() -> Type { return T.Get(); } +class WithType(T:! Has(type)) { + fn Get() -> type { return T.Get(); } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_class/use_self.carbon b/explorer/testdata/generic_class/use_self.carbon index 74c1e537c8ba..7bc1584bc719 100644 --- a/explorer/testdata/generic_class/use_self.carbon +++ b/explorer/testdata/generic_class/use_self.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -class Point(T:! Type) { +class Point(T:! type) { // Allowed: `Self` means `Point(T)` here. fn Origin(zero: T) -> Self { return {.x = zero, .y = zero}; diff --git a/explorer/testdata/generic_function/apply.carbon b/explorer/testdata/generic_function/apply.carbon index c57b8d54cedb..b7634d0aff14 100644 --- a/explorer/testdata/generic_function/apply.carbon +++ b/explorer/testdata/generic_function/apply.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -fn apply[T:! Type, U:! Type](f: __Fn (T) -> U, x: T) -> U { +fn apply[T:! type, U:! type](f: __Fn (T) -> U, x: T) -> U { return f(x); } diff --git a/explorer/testdata/generic_function/call_at_compile_time.carbon b/explorer/testdata/generic_function/call_at_compile_time.carbon index 1580c78a5b0c..ea3cdeae89a5 100644 --- a/explorer/testdata/generic_function/call_at_compile_time.carbon +++ b/explorer/testdata/generic_function/call_at_compile_time.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; interface X { fn F(); } impl i32 as X { fn F() {} } -fn G[T:! X](v: T) -> Type { +fn G[T:! X](v: T) -> type { v.F(); return i32; } diff --git a/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon b/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon index 34db36d71fbf..08b146f26a97 100644 --- a/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon +++ b/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -fn Bad[T:! Type](x: {.a: i32, .b: T}) {} +fn Bad[T:! type](x: {.a: i32, .b: T}) {} fn Main() -> i32 { // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon:[[@LINE+1]]: mismatch in field names, source field `c` not in destination type `{.a: i32, .b: T}` diff --git a/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon b/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon index 33ad073c0528..82f139700e05 100644 --- a/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon +++ b/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -fn Bad[T:! Type](x: {.a: i32, .b: T}) {} +fn Bad[T:! type](x: {.a: i32, .b: T}) {} fn Main() -> i32 { // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon:[[@LINE+1]]: mismatch in field names, destination field `b` not in source type `{.a: i32}` diff --git a/explorer/testdata/generic_function/fail_missing_exclam.carbon b/explorer/testdata/generic_function/fail_missing_exclam.carbon index 5753acd8763c..3e3ba1867c41 100644 --- a/explorer/testdata/generic_function/fail_missing_exclam.carbon +++ b/explorer/testdata/generic_function/fail_missing_exclam.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; // CHECK:STDERR: SYNTAX ERROR: {{.*}}/explorer/testdata/generic_function/fail_missing_exclam.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list -fn F[T: Type](); +fn F[T: type](); fn Main() -> i32 { return 0; diff --git a/explorer/testdata/generic_function/fail_not_addable.carbon b/explorer/testdata/generic_function/fail_not_addable.carbon index 9db8cfbab5cb..2a9214cb3262 100644 --- a/explorer/testdata/generic_function/fail_not_addable.carbon +++ b/explorer/testdata/generic_function/fail_not_addable.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -fn id[T:! Type](x: T) -> T { +fn id[T:! type](x: T) -> T { // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+2]]: type error in `+`: // CHECK:STDERR: could not find implementation of interface AddWith(U = i32) for T return x + 0; diff --git a/explorer/testdata/generic_function/fail_not_type.carbon b/explorer/testdata/generic_function/fail_not_type.carbon index 89b3f3f6cb39..470c430ba200 100644 --- a/explorer/testdata/generic_function/fail_not_type.carbon +++ b/explorer/testdata/generic_function/fail_not_type.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'Type' +// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type' fn F[a:! 42](); fn Main() -> i32 { diff --git a/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon b/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon index c10cde3b96d6..ce84d4b904ca 100644 --- a/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon +++ b/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon @@ -8,12 +8,12 @@ package ExplorerTest api; -fn fst[T:! Type](x: T, y: T) -> T { +fn fst[T:! type](x: T, y: T) -> T { return x; } fn Main() -> i32 { - // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type: + // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! type: // CHECK:STDERR: i32 // CHECK:STDERR: bool return fst(0, true); diff --git a/explorer/testdata/generic_function/fail_type_deduction_unused.carbon b/explorer/testdata/generic_function/fail_type_deduction_unused.carbon index d3854a85446a..9a1d3bd56b59 100644 --- a/explorer/testdata/generic_function/fail_type_deduction_unused.carbon +++ b/explorer/testdata/generic_function/fail_type_deduction_unused.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -fn id[T:! Type](x: i32) -> i32 { +fn id[T:! type](x: i32) -> i32 { return x; } diff --git a/explorer/testdata/generic_function/generic_method.carbon b/explorer/testdata/generic_function/generic_method.carbon index ebfc046dd975..8a64f70e1a43 100644 --- a/explorer/testdata/generic_function/generic_method.carbon +++ b/explorer/testdata/generic_function/generic_method.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -class Cell(T:! Type) { +class Cell(T:! type) { fn Create(x: T) -> Cell(T) { return { .data = x }; } fn Get[self: Self]() -> T { @@ -18,7 +18,7 @@ class Cell(T:! Type) { fn Put[addr self: Self*](x: T) { (*self).data = x; } - fn CreateOther[self: Self, U:! Type](x: U) -> Cell(U) { + fn CreateOther[self: Self, U:! type](x: U) -> Cell(U) { return {.data = x}; } var data: T; diff --git a/explorer/testdata/generic_function/non_generic_param.carbon b/explorer/testdata/generic_function/non_generic_param.carbon index 81c21bbfb965..4d69146a7e47 100644 --- a/explorer/testdata/generic_function/non_generic_param.carbon +++ b/explorer/testdata/generic_function/non_generic_param.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -fn snd[T:! Type](x: i32, y: T) -> T { +fn snd[T:! type](x: i32, y: T) -> T { return y; } diff --git a/explorer/testdata/generic_function/nondeduced_generic_param.carbon b/explorer/testdata/generic_function/nondeduced_generic_param.carbon index 7c1f0c8e667a..90e2399d7fd7 100644 --- a/explorer/testdata/generic_function/nondeduced_generic_param.carbon +++ b/explorer/testdata/generic_function/nondeduced_generic_param.carbon @@ -8,10 +8,10 @@ // CHECK:STDOUT: result: 1 package ExplorerTest api; -class A(T:! Type) { +class A(T:! type) { var v: T; } -fn F(T:! Type, x: T) -> T { +fn F(T:! type, x: T) -> T { var v: A(T) = {.v = x}; return v.v; } diff --git a/explorer/testdata/generic_function/return_val.carbon b/explorer/testdata/generic_function/return_val.carbon index 95f1a460bc9b..a4dfab704012 100644 --- a/explorer/testdata/generic_function/return_val.carbon +++ b/explorer/testdata/generic_function/return_val.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -fn id[T:! Type](x: T) -> T { +fn id[T:! type](x: T) -> T { return x; } diff --git a/explorer/testdata/generic_function/swap.carbon b/explorer/testdata/generic_function/swap.carbon index e81da3015b99..3dd7e7961011 100644 --- a/explorer/testdata/generic_function/swap.carbon +++ b/explorer/testdata/generic_function/swap.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -fn swap[T:! Type, U:! Type](tuple: (T, U)) -> (U, T) { +fn swap[T:! type, U:! type](tuple: (T, U)) -> (U, T) { return (tuple[1], tuple[0]); } diff --git a/explorer/testdata/generic_function/tuple_map.carbon b/explorer/testdata/generic_function/tuple_map.carbon index db6b128b455c..5b92d1aced23 100644 --- a/explorer/testdata/generic_function/tuple_map.carbon +++ b/explorer/testdata/generic_function/tuple_map.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -fn map[T:! Type](f: __Fn (T) -> T, tuple: (T, T)) -> (T, T) { +fn map[T:! type](f: __Fn (T) -> T, tuple: (T, T)) -> (T, T) { return (f(tuple[0]), f(tuple[1])); } diff --git a/explorer/testdata/generic_function/type_matching.carbon b/explorer/testdata/generic_function/type_matching.carbon index ae9581ce98dc..48ad8765d003 100644 --- a/explorer/testdata/generic_function/type_matching.carbon +++ b/explorer/testdata/generic_function/type_matching.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -fn fst[T:! Type](x: T, y: T) -> T { +fn fst[T:! type](x: T, y: T) -> T { return x; } diff --git a/explorer/testdata/global_variable/fail_modify_in_constant_expr.carbon b/explorer/testdata/global_variable/fail_modify_in_constant_expr.carbon index baf296d6ec25..05d6921c38f7 100644 --- a/explorer/testdata/global_variable/fail_modify_in_constant_expr.carbon +++ b/explorer/testdata/global_variable/fail_modify_in_constant_expr.carbon @@ -10,7 +10,7 @@ package ExplorerTest api; var n: i32 = 0; -fn F() -> Type { +fn F() -> type { // TODO: This isn't a very good description of the problem, which is that // compile-time evaluation doesn't have a mutable `n` value available. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/global_variable/fail_modify_in_constant_expr.carbon:[[@LINE+1]]: could not find `n: i32` diff --git a/explorer/testdata/impl/deducible_parameter.carbon b/explorer/testdata/impl/deducible_parameter.carbon index 31fdcf44d9b5..54b338b4280c 100644 --- a/explorer/testdata/impl/deducible_parameter.carbon +++ b/explorer/testdata/impl/deducible_parameter.carbon @@ -9,14 +9,14 @@ package ExplorerTest api; -interface A(T:! Type) {} +interface A(T:! type) {} interface B { fn F() -> i32; } -class C(T:! Type) {} +class C(T:! type) {} -external impl forall [T:! Type] C(T) as A(T) & B { +external impl forall [T:! type] C(T) as A(T) & B { fn F() -> i32 { return 1; } } diff --git a/explorer/testdata/impl/fail_ambiguous_impl_generic.carbon b/explorer/testdata/impl/fail_ambiguous_impl_generic.carbon index 367161227d26..928b8d68a28b 100644 --- a/explorer/testdata/impl/fail_ambiguous_impl_generic.carbon +++ b/explorer/testdata/impl/fail_ambiguous_impl_generic.carbon @@ -8,11 +8,11 @@ package ExplorerTest api; -class A(T:! Type) {} -interface B(T:! Type) {} +class A(T:! type) {} +interface B(T:! type) {} -external impl forall [T:! Type] A(T) as B(i32) {} -external impl forall [T:! Type] A(i32) as B(T) {} +external impl forall [T:! type] A(T) as B(i32) {} +external impl forall [T:! type] A(i32) as B(T) {} fn F[T:! B(i32)](x: T) {} fn G[T:! B(bool)](x: T) {} diff --git a/explorer/testdata/impl/fail_bad_member_kind.carbon b/explorer/testdata/impl/fail_bad_member_kind.carbon index 03a240bc50db..b9698d2bfb1e 100644 --- a/explorer/testdata/impl/fail_bad_member_kind.carbon +++ b/explorer/testdata/impl/fail_bad_member_kind.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; interface A { - // TODO: Use `let T:! Type;` here once we support it. + // TODO: Use `let T:! type;` here once we support it. fn T(); } diff --git a/explorer/testdata/impl/fail_impl_as_parameterized.carbon b/explorer/testdata/impl/fail_impl_as_parameterized.carbon index 45a20e0d9a39..c2b71410d8f3 100644 --- a/explorer/testdata/impl/fail_impl_as_parameterized.carbon +++ b/explorer/testdata/impl/fail_impl_as_parameterized.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -interface Vector(Scalar:! Type) { +interface Vector(Scalar:! type) { } // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_impl_as_parameterized.carbon:[[@LINE+1]]: 'Vector' must be given an argument list diff --git a/explorer/testdata/impl/fail_nondeducible_parameter.carbon b/explorer/testdata/impl/fail_nondeducible_parameter.carbon index 9fbb0132e3e7..60d8b9a52b4c 100644 --- a/explorer/testdata/impl/fail_nondeducible_parameter.carbon +++ b/explorer/testdata/impl/fail_nondeducible_parameter.carbon @@ -8,10 +8,10 @@ package ExplorerTest api; -interface A(T:! Type) {} +interface A(T:! type) {} interface B {} -// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_nondeducible_parameter.carbon:[[@LINE+1]]: parameter `T:! Type` is not deducible from `impl i32 as interface B` -external impl forall [T:! Type] i32 as A(T) & B {} +// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_nondeducible_parameter.carbon:[[@LINE+1]]: parameter `T:! type` is not deducible from `impl i32 as interface B` +external impl forall [T:! type] i32 as A(T) & B {} fn Main() -> i32 { return 0; } diff --git a/explorer/testdata/impl/fail_param_interface_in_impl.carbon b/explorer/testdata/impl/fail_param_interface_in_impl.carbon index a7692b1e9212..060ef0a3b2d1 100644 --- a/explorer/testdata/impl/fail_param_interface_in_impl.carbon +++ b/explorer/testdata/impl/fail_param_interface_in_impl.carbon @@ -8,12 +8,12 @@ package ExplorerTest api; -interface Similar(T:! Type) {} +interface Similar(T:! type) {} -impl forall [T:! Type] T as Similar(T) {} -impl forall [T:! Type] i32 as Similar(T) {} +impl forall [T:! type] T as Similar(T) {} +impl forall [T:! type] i32 as Similar(T) {} -fn CheckSimilar[T:! Type, U:! Similar(T)](a: T, b: U) {} +fn CheckSimilar[T:! type, U:! Similar(T)](a: T, b: U) {} fn Main() -> i32 { let n: i32 = 0; diff --git a/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon b/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon index 85ea1f5003eb..ce82628242ff 100644 --- a/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon +++ b/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon @@ -8,12 +8,12 @@ package ExplorerTest api; -interface Vector(T:! Type) { +interface Vector(T:! type) { fn Add[self: Self](b: Self) -> Self; fn Scale[self: Self](v: T) -> Self; } -class Point(T:! Type) { +class Point(T:! type) { var x: T; var y: T; } @@ -27,7 +27,7 @@ external impl Point(i32) as Vector(i32) { } } -external impl forall [T:! Type] Point(T) as Vector(T) { +external impl forall [T:! type] Point(T) as Vector(T) { fn Add[self: Self](b: Self) -> Self { return self; } diff --git a/explorer/testdata/impl/generic_method_impl.carbon b/explorer/testdata/impl/generic_method_impl.carbon index 3b53e29712ce..0af8d87d34aa 100644 --- a/explorer/testdata/impl/generic_method_impl.carbon +++ b/explorer/testdata/impl/generic_method_impl.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -class Cell(T:! Type) { +class Cell(T:! type) { fn Create(x: T) -> Cell(T) { return { .data = x }; } fn Get[self: Self]() -> T { @@ -21,7 +21,7 @@ class Cell(T:! Type) { fn Update[addr self: Self*, U:! ImplicitAs(T)](x: U) { (*self).data = x; } - fn CreateOther[self: Self, U:! Type](x: U) -> Cell(U) { + fn CreateOther[self: Self, U:! type](x: U) -> Cell(U) { return {.data = x}; } var data: T; diff --git a/explorer/testdata/impl/impl_constraint.carbon b/explorer/testdata/impl/impl_constraint.carbon index b7d1952d8df7..de5e509ba8ff 100644 --- a/explorer/testdata/impl/impl_constraint.carbon +++ b/explorer/testdata/impl/impl_constraint.carbon @@ -16,7 +16,7 @@ interface B { fn F() -> i32; fn G() -> i32; } -interface C(T:! Type) { +interface C(T:! type) { fn H() -> T; } diff --git a/explorer/testdata/impl/impl_in_generic_class.carbon b/explorer/testdata/impl/impl_in_generic_class.carbon index b98af14ca2f7..177e4c534a3a 100644 --- a/explorer/testdata/impl/impl_in_generic_class.carbon +++ b/explorer/testdata/impl/impl_in_generic_class.carbon @@ -9,11 +9,11 @@ package ExplorerTest api; -interface I(T:! Type) { +interface I(T:! type) { fn F[self: Self](t: T, o: Self) -> Self; } -class X(U:! Type) { +class X(U:! type) { impl as I(U) { fn F[self: Self](u: U, o: Self) -> Self { return {.m = u, .n = self.n + o.n}; } } @@ -21,7 +21,7 @@ class X(U:! Type) { var n: i32; } -fn Run[V:! Type](x: V) -> (V, V, i32, i32) { +fn Run[V:! type](x: V) -> (V, V, i32, i32) { var v: X(V) = {.m = x, .n = 1}; var w: X(V) = {.m = x, .n = 2}; // OK, know that `X(V)` implements `I(V)` from the `impl` in the class. diff --git a/explorer/testdata/impl/param_interface_in_impl.carbon b/explorer/testdata/impl/param_interface_in_impl.carbon index f81cd9a59cfe..ca118e501b2a 100644 --- a/explorer/testdata/impl/param_interface_in_impl.carbon +++ b/explorer/testdata/impl/param_interface_in_impl.carbon @@ -9,12 +9,12 @@ package ExplorerTest api; -interface Similar(T:! Type) {} +interface Similar(T:! type) {} -impl forall [T:! Type] T as Similar(T) {} -impl forall [T:! Type] i32 as Similar(T) {} +impl forall [T:! type] T as Similar(T) {} +impl forall [T:! type] i32 as Similar(T) {} -fn CheckSimilar[T:! Type, U:! Similar(T)](a: T, b: U) {} +fn CheckSimilar[T:! type, U:! Similar(T)](a: T, b: U) {} fn Main() -> i32 { let n: i32 = 0; diff --git a/explorer/testdata/interface/assoc_constant_constraints_in_scope.carbon b/explorer/testdata/interface/assoc_constant_constraints_in_scope.carbon index 6a395372c0eb..8097d50ba0b9 100644 --- a/explorer/testdata/interface/assoc_constant_constraints_in_scope.carbon +++ b/explorer/testdata/interface/assoc_constant_constraints_in_scope.carbon @@ -9,9 +9,9 @@ package ExplorerTest api; -interface A(T:! Type) { let AResult:! Type; } -interface B(T:! Type) { let BResult:! A(T); } -interface I(T:! Type) { +interface A(T:! type) { let AResult:! type; } +interface B(T:! type) { let BResult:! A(T); } +interface I(T:! type) { let X:! B(T); // The constraints introduced by X should be in scope here. let Y:! X.BResult.AResult; diff --git a/explorer/testdata/interface/extends.carbon b/explorer/testdata/interface/extends.carbon index d16fc8f910b5..f797102fdab3 100644 --- a/explorer/testdata/interface/extends.carbon +++ b/explorer/testdata/interface/extends.carbon @@ -10,7 +10,7 @@ package ExplorerTest api; -interface Apple(T:! Type) { +interface Apple(T:! type) { fn F[self: Self]() -> T; } diff --git a/explorer/testdata/interface/fail_impl_as_not_type.carbon b/explorer/testdata/interface/fail_impl_as_not_type.carbon index 10fc8563b23b..f06ddbd77645 100644 --- a/explorer/testdata/interface/fail_impl_as_not_type.carbon +++ b/explorer/testdata/interface/fail_impl_as_not_type.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; interface A {} interface B { - // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_as_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'Type' + // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_as_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type' impl 5 as A; } diff --git a/explorer/testdata/interface/fail_impl_not_type.carbon b/explorer/testdata/interface/fail_impl_not_type.carbon index 27058f55ad49..bf350e70b8b5 100644 --- a/explorer/testdata/interface/fail_impl_not_type.carbon +++ b/explorer/testdata/interface/fail_impl_not_type.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; interface Vector { fn Zero() -> i32; } -// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_not_type.carbon:[[@LINE+1]]: type error in type expression: 'String' is not implicitly convertible to 'Type' +// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_not_type.carbon:[[@LINE+1]]: type error in type expression: 'String' is not implicitly convertible to 'type' impl "hello" as Vector { fn Zero() -> i32 { return 0; } } diff --git a/explorer/testdata/interface/fail_member_lookup_in_definition.carbon b/explorer/testdata/interface/fail_member_lookup_in_definition.carbon index dbf274540aa5..9f45b6ab6b2a 100644 --- a/explorer/testdata/interface/fail_member_lookup_in_definition.carbon +++ b/explorer/testdata/interface/fail_member_lookup_in_definition.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; interface Vector { // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_member_lookup_in_definition.carbon:[[@LINE+1]]: incomplete type `interface Vector` used in member access fn ScalarZero() -> Vector.ScalarType; - let ScalarType:! Type; + let ScalarType:! type; } fn Main() -> i32 { diff --git a/explorer/testdata/interface/fail_self_lookup_in_definition.carbon b/explorer/testdata/interface/fail_self_lookup_in_definition.carbon index 1d7cbfd1e9ee..34f2137b9097 100644 --- a/explorer/testdata/interface/fail_self_lookup_in_definition.carbon +++ b/explorer/testdata/interface/fail_self_lookup_in_definition.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; interface Vector { // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_self_lookup_in_definition.carbon:[[@LINE+1]]: incomplete type `interface Vector` used in member access fn ScalarZero() -> Self.ScalarType; - let ScalarType:! Type; + let ScalarType:! type; } fn Main() -> i32 { diff --git a/explorer/testdata/interface/fail_use_symbolic_member.carbon b/explorer/testdata/interface/fail_use_symbolic_member.carbon index 71ab6e0d69c5..cd6537a306e3 100644 --- a/explorer/testdata/interface/fail_use_symbolic_member.carbon +++ b/explorer/testdata/interface/fail_use_symbolic_member.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; interface X { - fn F() -> Type; + fn F() -> type; } // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_use_symbolic_member.carbon:[[@LINE+1]]: member lookup for F in symbolic witness 0 of witness for T:! X diff --git a/explorer/testdata/interface/impl_as.carbon b/explorer/testdata/interface/impl_as.carbon index 65e225bbb9e6..138eaec68634 100644 --- a/explorer/testdata/interface/impl_as.carbon +++ b/explorer/testdata/interface/impl_as.carbon @@ -10,7 +10,7 @@ package ExplorerTest api; -interface Apple(T:! Type) { +interface Apple(T:! type) { fn F[self: Self]() -> T; } diff --git a/explorer/testdata/interface/impl_self_interface_parameter.carbon b/explorer/testdata/interface/impl_self_interface_parameter.carbon index a4eb1eb5c226..854b5b6d9822 100644 --- a/explorer/testdata/interface/impl_self_interface_parameter.carbon +++ b/explorer/testdata/interface/impl_self_interface_parameter.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -interface MyAddWith(T:! Type) { +interface MyAddWith(T:! type) { fn Op[self: Self](b: T) -> Self; } @@ -25,7 +25,7 @@ impl Point as MyAddWith(Self) { } } -fn DoAddGeneric[T:! Type, U:! MyAddWith(T)](a: U, b: T) -> U { +fn DoAddGeneric[T:! type, U:! MyAddWith(T)](a: U, b: T) -> U { return a.Op(b); } diff --git a/explorer/testdata/interface/param_with_dependent_type.carbon b/explorer/testdata/interface/param_with_dependent_type.carbon index 0c6be3b890a9..a6364710679f 100644 --- a/explorer/testdata/interface/param_with_dependent_type.carbon +++ b/explorer/testdata/interface/param_with_dependent_type.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -interface HasValueParam(T:! Type, V:! T) { +interface HasValueParam(T:! type, V:! T) { fn Go[self: Self]() -> T; } diff --git a/explorer/testdata/interface/parameterized.carbon b/explorer/testdata/interface/parameterized.carbon index fbcb8c457642..92ad3e486aa7 100644 --- a/explorer/testdata/interface/parameterized.carbon +++ b/explorer/testdata/interface/parameterized.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -interface Vector(Scalar:! Type) { +interface Vector(Scalar:! type) { fn Zero() -> Self; fn Add[self: Self](b: Self) -> Self; fn Scale[self: Self](v: Scalar) -> Self; @@ -31,7 +31,7 @@ class Point { } } -fn AddAndScaleGeneric[T:! Type, U:! Vector(T)](a: U, s: T) -> U { +fn AddAndScaleGeneric[T:! type, U:! Vector(T)](a: U, s: T) -> U { return a.Add(U.Zero()).Scale(s); } diff --git a/explorer/testdata/interface/type_of_type.carbon b/explorer/testdata/interface/type_of_type.carbon index 843a88d16e65..4221e8ec8716 100644 --- a/explorer/testdata/interface/type_of_type.carbon +++ b/explorer/testdata/interface/type_of_type.carbon @@ -13,7 +13,7 @@ interface I {} fn Main() -> i32 { var a: auto = I; - // OK: Type of `I` is `Type`. + // OK: type of `I` is `type`. a = i32; return 0; } diff --git a/explorer/testdata/linked_list/typed_linked_list.carbon b/explorer/testdata/linked_list/typed_linked_list.carbon index 55ed8f307922..468480f1391f 100644 --- a/explorer/testdata/linked_list/typed_linked_list.carbon +++ b/explorer/testdata/linked_list/typed_linked_list.carbon @@ -11,7 +11,7 @@ // CHECK:STDOUT: result: 0 package ExplorerTest api; -class Node(T:! Type) { +class Node(T:! type) { fn Create(value: T)-> Node(T) { return { .value = Optional(T).Create(value), @@ -30,7 +30,7 @@ class Node(T:! Type) { var prev: Optional(Node(T)*); } -class LinkedList(T:! Type) { +class LinkedList(T:! type) { fn Create() -> LinkedList(T) { return { .head = Optional(Node(T)*).CreateEmpty(), @@ -90,7 +90,7 @@ class LinkedList(T:! Type) { // This function exists as a helper the context of this test case specifically and does not represent // the common case for index based lookups in list like structures. -fn GetListEntryByIndex[T:! Type](list: LinkedList(T)*, target_index: i32) -> Optional(T) { +fn GetListEntryByIndex[T:! type](list: LinkedList(T)*, target_index: i32) -> Optional(T) { let list_length: i32 = (*list).Length(); if(target_index > list_length - 1 or target_index < 0) { // Not in possible range diff --git a/explorer/testdata/member_access/evaluate_type_before_dot.carbon b/explorer/testdata/member_access/evaluate_type_before_dot.carbon index 71399162a203..ea022bc1c9f2 100644 --- a/explorer/testdata/member_access/evaluate_type_before_dot.carbon +++ b/explorer/testdata/member_access/evaluate_type_before_dot.carbon @@ -24,11 +24,11 @@ impl i32 as AnotherInterface {} // TODO: These are intended to be called at compile time. Mark them as // constexpr once we have syntax for that. -fn GetStruct() -> Type { return {.n: i32}; } -fn GetChoice() -> Type { return Choice; } -fn GetClass() -> Type { return Class; } -fn GetInterface() -> Type { return Interface; } -fn GetConstraint() -> Type { return Interface & AnotherInterface; } +fn GetStruct() -> type { return {.n: i32}; } +fn GetChoice() -> type { return Choice; } +fn GetClass() -> type { return Class; } +fn GetInterface() -> type { return Interface; } +fn GetConstraint() -> type { return Interface & AnotherInterface; } fn TestStruct() { var s: GetStruct() = {.n = 1}; diff --git a/explorer/testdata/name_lookup/fail_class_fn_use_before_declaration.carbon b/explorer/testdata/name_lookup/fail_class_fn_use_before_declaration.carbon index 44d559a2edee..162b312cca47 100644 --- a/explorer/testdata/name_lookup/fail_class_fn_use_before_declaration.carbon +++ b/explorer/testdata/name_lookup/fail_class_fn_use_before_declaration.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; // The bodies of member functions are processed after all immediately enclosing // classes, impls, and interfaces. class A { - fn F() -> Type { + fn F() -> type { return i32; } // OK, resolves to `A.F`. @@ -23,7 +23,7 @@ class A { fn H() -> I() { return 0; } - fn I() -> Type { + fn I() -> type { return i32; } } diff --git a/explorer/testdata/name_lookup/fail_fn_use_in_param.carbon b/explorer/testdata/name_lookup/fail_fn_use_in_param.carbon index 8e61cb7928ef..ba0b9cb5f0b9 100644 --- a/explorer/testdata/name_lookup/fail_fn_use_in_param.carbon +++ b/explorer/testdata/name_lookup/fail_fn_use_in_param.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/name_lookup/fail_fn_use_in_param.carbon:[[@LINE+1]]: 'F' is not usable until after it has been completely declared -fn F(x: F(0)) -> Type { +fn F(x: F(0)) -> type { return i32; } diff --git a/explorer/testdata/name_lookup/fail_fn_use_in_return_type.carbon b/explorer/testdata/name_lookup/fail_fn_use_in_return_type.carbon index 60ff9fa27dd6..893d85201260 100644 --- a/explorer/testdata/name_lookup/fail_fn_use_in_return_type.carbon +++ b/explorer/testdata/name_lookup/fail_fn_use_in_return_type.carbon @@ -10,7 +10,7 @@ package ExplorerTest api; // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/name_lookup/fail_fn_use_in_return_type.carbon:[[@LINE+1]]: 'F' is not usable until after it has been completely declared fn F() -> F() { - return Type; + return type; } fn Main() -> i32 { diff --git a/explorer/testdata/named_constraint/extends.carbon b/explorer/testdata/named_constraint/extends.carbon index 4e9206d13063..105a6d941d7c 100644 --- a/explorer/testdata/named_constraint/extends.carbon +++ b/explorer/testdata/named_constraint/extends.carbon @@ -14,11 +14,11 @@ package ExplorerTest api; -interface Maker(T:! Type) { +interface Maker(T:! type) { fn Make[self: Self]() -> T; } -constraint IndirectMaker(T:! Type) { +constraint IndirectMaker(T:! type) { extends Maker(T*); } diff --git a/explorer/testdata/named_constraint/fail_associated_constant.carbon b/explorer/testdata/named_constraint/fail_associated_constant.carbon index 77b6e8a72c45..b840ade2a129 100644 --- a/explorer/testdata/named_constraint/fail_associated_constant.carbon +++ b/explorer/testdata/named_constraint/fail_associated_constant.carbon @@ -10,7 +10,7 @@ package ExplorerTest api; constraint X { // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/named_constraint/fail_associated_constant.carbon:[[@LINE+1]]: associated constant not permitted in named constraint - let N:! Type; + let N:! type; } fn Main() -> i32 { return 0; } diff --git a/explorer/testdata/named_constraint/fail_compound_member_access.carbon b/explorer/testdata/named_constraint/fail_compound_member_access.carbon index 65efea6faf5b..684f3f100d77 100644 --- a/explorer/testdata/named_constraint/fail_compound_member_access.carbon +++ b/explorer/testdata/named_constraint/fail_compound_member_access.carbon @@ -8,8 +8,8 @@ package ExplorerTest api; -interface MyAddWith(T:! Type) { - let Result:! Type; +interface MyAddWith(T:! type) { + let Result:! type; fn Op[self: Self](other: T) -> Result; } diff --git a/explorer/testdata/named_constraint/impl_as.carbon b/explorer/testdata/named_constraint/impl_as.carbon index 30a97be12d61..73d11598387d 100644 --- a/explorer/testdata/named_constraint/impl_as.carbon +++ b/explorer/testdata/named_constraint/impl_as.carbon @@ -10,7 +10,7 @@ package ExplorerTest api; interface MyHashable { - let Result:! Type; + let Result:! type; fn Hash[self: Self]() -> Result; } diff --git a/explorer/testdata/operators/combine.carbon b/explorer/testdata/operators/combine.carbon index d2406cedfc2f..c41d88f74f39 100644 --- a/explorer/testdata/operators/combine.carbon +++ b/explorer/testdata/operators/combine.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; -fn F[T:! Type & Type](x: T) {} +fn F[T:! type & type](x: T) {} fn Main() -> i32 { F(0); diff --git a/explorer/testdata/operators/fail_combine_lhs.carbon b/explorer/testdata/operators/fail_combine_lhs.carbon index 3bc71a9c3a1d..75df629854df 100644 --- a/explorer/testdata/operators/fail_combine_lhs.carbon +++ b/explorer/testdata/operators/fail_combine_lhs.carbon @@ -9,7 +9,7 @@ package ExplorerTest api; // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/operators/fail_combine_lhs.carbon:[[@LINE+1]]: expected a constraint in first operand of `&`, found i32 -fn F[T:! i32 & Type](); +fn F[T:! i32 & type](); fn Main() -> i32 { return 0; diff --git a/explorer/testdata/operators/fail_combine_rhs.carbon b/explorer/testdata/operators/fail_combine_rhs.carbon index 57f7e1793ad8..742fc0683dab 100644 --- a/explorer/testdata/operators/fail_combine_rhs.carbon +++ b/explorer/testdata/operators/fail_combine_rhs.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; class C {} // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/operators/fail_combine_rhs.carbon:[[@LINE+1]]: expected a constraint in second operand of `&`, found class C -fn F[T:! Type & C](); +fn F[T:! type & C](); fn Main() -> i32 { return 0; diff --git a/explorer/testdata/struct/field_convertible_to_type.carbon b/explorer/testdata/struct/field_convertible_to_type.carbon index c256fb61b819..009d42b6c37c 100644 --- a/explorer/testdata/struct/field_convertible_to_type.carbon +++ b/explorer/testdata/struct/field_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 {}; } } diff --git a/explorer/testdata/tuple/fail_nontype_tuple_as_type.carbon b/explorer/testdata/tuple/fail_nontype_tuple_as_type.carbon index f1948c24f0a5..80646153b43f 100644 --- a/explorer/testdata/tuple/fail_nontype_tuple_as_type.carbon +++ b/explorer/testdata/tuple/fail_nontype_tuple_as_type.carbon @@ -8,7 +8,7 @@ package ExplorerTest api; -// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/tuple/fail_nontype_tuple_as_type.carbon:[[@LINE+1]]: type error in type of name binding: '(i32, i32)' is not implicitly convertible to 'Type' +// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/tuple/fail_nontype_tuple_as_type.carbon:[[@LINE+1]]: type error in type of name binding: '(i32, i32)' is not implicitly convertible to 'type' fn F[T:! (i32, i32)](x: T); fn Main() -> i32; diff --git a/migrate_cpp/cpp_refactoring/for_range.h b/migrate_cpp/cpp_refactoring/for_range.h index 66302f20d015..50576b89a335 100644 --- a/migrate_cpp/cpp_refactoring/for_range.h +++ b/migrate_cpp/cpp_refactoring/for_range.h @@ -9,7 +9,7 @@ namespace Carbon { -// Updates variable declarations for `var name: Type`. +// Updates variable declarations for `var name: type`. class ForRange : public Matcher { public: using Matcher::Matcher; diff --git a/migrate_cpp/cpp_refactoring/var_decl.h b/migrate_cpp/cpp_refactoring/var_decl.h index 45d29c5673f8..abe0d33ec01d 100644 --- a/migrate_cpp/cpp_refactoring/var_decl.h +++ b/migrate_cpp/cpp_refactoring/var_decl.h @@ -9,7 +9,7 @@ namespace Carbon { -// Updates variable declarations for `var name: Type`. +// Updates variable declarations for `var name: type`. class VarDecl : public Matcher { public: using Matcher::Matcher; diff --git a/third_party/examples/re2/re2.carbon b/third_party/examples/re2/re2.carbon index f82e9004bcf8..8a87ddb7c44b 100644 --- a/third_party/examples/re2/re2.carbon +++ b/third_party/examples/re2/re2.carbon @@ -353,7 +353,7 @@ class RE2 { fn FindAndConsumeN(input: StringPiece*, re: RE2, args: Array(const Arg*), n: i32) -> bool; - private fn Apply[template F:! Type, SP:! Type](f: F, sp: SP, re: Self) { + private fn Apply[template F:! type, SP:! type](f: F, sp: SP, re: Self) { return f(sp, re, nullptr, 0); } diff --git a/toolchain/parser/parser.cpp b/toolchain/parser/parser.cpp index 95af22c49216..d582070311e8 100644 --- a/toolchain/parser/parser.cpp +++ b/toolchain/parser/parser.cpp @@ -491,7 +491,7 @@ auto Parser::HandleBraceExpressionParameterError(StateStackEntry state, bool can_be_type = kind != BraceExpressionKind::Value; bool can_be_value = kind != BraceExpressionKind::Type; emitter_->Emit(*position_, ExpectedStructLiteralField, - can_be_type ? "`.field: type`" : "", + can_be_type ? "`.field: field_type`" : "", (can_be_type && can_be_value) ? " or " : "", can_be_value ? "`.field = value`" : ""); diff --git a/toolchain/parser/testdata/operators/fixity_in_var.carbon b/toolchain/parser/testdata/operators/fixity_in_var.carbon index 0eaa545804c5..b54ea4b85b9b 100644 --- a/toolchain/parser/testdata/operators/fixity_in_var.carbon +++ b/toolchain/parser/testdata/operators/fixity_in_var.carbon @@ -20,7 +20,7 @@ // CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8}, // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'DeclaredName', text: 't'}, -// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'}, +// CHECK:STDOUT: {kind: 'NameReference', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i32'}, @@ -32,5 +32,5 @@ fn F() { var q: i32* = p; - var t: Type = i32*; + var t: type = i32*; } diff --git a/toolchain/parser/testdata/operators/postfix.carbon b/toolchain/parser/testdata/operators/postfix.carbon index 8cb331b888f6..5e8c58d1ac9c 100644 --- a/toolchain/parser/testdata/operators/postfix.carbon +++ b/toolchain/parser/testdata/operators/postfix.carbon @@ -7,7 +7,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'}, +// CHECK:STDOUT: {kind: 'NameReference', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'}, @@ -16,4 +16,4 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -var v: Type = i8*; +var v: type = i8*; diff --git a/toolchain/parser/testdata/operators/postfix_space_after_op.carbon b/toolchain/parser/testdata/operators/postfix_space_after_op.carbon index c74b84d11707..4e797f2d5b79 100644 --- a/toolchain/parser/testdata/operators/postfix_space_after_op.carbon +++ b/toolchain/parser/testdata/operators/postfix_space_after_op.carbon @@ -7,7 +7,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'}, +// CHECK:STDOUT: {kind: 'NameReference', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'}, @@ -16,4 +16,4 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -var v: Type = i8* ; +var v: type = i8* ; diff --git a/toolchain/parser/testdata/operators/recover_postfix_space.carbon b/toolchain/parser/testdata/operators/recover_postfix_space.carbon index 59fd8457e506..93accd196347 100644 --- a/toolchain/parser/testdata/operators/recover_postfix_space.carbon +++ b/toolchain/parser/testdata/operators/recover_postfix_space.carbon @@ -7,7 +7,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'}, +// CHECK:STDOUT: {kind: 'NameReference', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'}, @@ -17,4 +17,4 @@ // CHECK:STDOUT: ] // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator. -var v: Type = i8 *; +var v: type = i8 *; diff --git a/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon b/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon index 59ff38131301..a3b535fdd9af 100644 --- a/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon +++ b/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon @@ -7,7 +7,7 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'}, // CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'}, -// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'}, +// CHECK:STDOUT: {kind: 'NameReference', text: 'type'}, // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3}, // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='}, // CHECK:STDOUT: {kind: 'Literal', text: 'i8'}, @@ -18,4 +18,4 @@ // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+2]]:18: Whitespace is not allowed before this unary operator. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+1]]:18: Whitespace is required after this unary operator. -var v: Type = i8 * ; +var v: type = i8 * ; diff --git a/toolchain/parser/testdata/struct/fail_comma_only.carbon b/toolchain/parser/testdata/struct/fail_comma_only.carbon index 7aa31e240e20..bfbb0115def5 100644 --- a/toolchain/parser/testdata/struct/fail_comma_only.carbon +++ b/toolchain/parser/testdata/struct/fail_comma_only.carbon @@ -19,5 +19,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_comma_only.carbon:[[@LINE+1]]:9: Expected `.field: type` or `.field = value`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_comma_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`. var x: {,} = {}; diff --git a/toolchain/parser/testdata/struct/fail_comma_repeat_in_type.carbon b/toolchain/parser/testdata/struct/fail_comma_repeat_in_type.carbon index 14194cc1449c..213bd95b4c1c 100644 --- a/toolchain/parser/testdata/struct/fail_comma_repeat_in_type.carbon +++ b/toolchain/parser/testdata/struct/fail_comma_repeat_in_type.carbon @@ -24,5 +24,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_comma_repeat_in_type.carbon:[[@LINE+1]]:17: Expected `.field: type`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_comma_repeat_in_type.carbon:[[@LINE+1]]:17: Expected `.field: field_type`. var x: {.a: i32,,} = {}; diff --git a/toolchain/parser/testdata/struct/fail_identifier_colon.carbon b/toolchain/parser/testdata/struct/fail_identifier_colon.carbon index fc9a6ede6349..3bf338b9b8f8 100644 --- a/toolchain/parser/testdata/struct/fail_identifier_colon.carbon +++ b/toolchain/parser/testdata/struct/fail_identifier_colon.carbon @@ -18,5 +18,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_identifier_colon.carbon:[[@LINE+1]]:9: Expected `.field: type` or `.field = value`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_identifier_colon.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`. var x: {a:} = {}; diff --git a/toolchain/parser/testdata/struct/fail_identifier_equals.carbon b/toolchain/parser/testdata/struct/fail_identifier_equals.carbon index b2a77a300cdc..0a593a89e7a6 100644 --- a/toolchain/parser/testdata/struct/fail_identifier_equals.carbon +++ b/toolchain/parser/testdata/struct/fail_identifier_equals.carbon @@ -18,5 +18,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_identifier_equals.carbon:[[@LINE+1]]:9: Expected `.field: type` or `.field = value`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_identifier_equals.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`. var x: {a=} = {}; diff --git a/toolchain/parser/testdata/struct/fail_identifier_only.carbon b/toolchain/parser/testdata/struct/fail_identifier_only.carbon index 28b4f2efa8e1..12275ff05590 100644 --- a/toolchain/parser/testdata/struct/fail_identifier_only.carbon +++ b/toolchain/parser/testdata/struct/fail_identifier_only.carbon @@ -18,5 +18,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_identifier_only.carbon:[[@LINE+1]]:9: Expected `.field: type` or `.field = value`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_identifier_only.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`. var x: {a} = {}; diff --git a/toolchain/parser/testdata/struct/fail_mix_type_and_value.carbon b/toolchain/parser/testdata/struct/fail_mix_type_and_value.carbon index 54cddc59d01c..9efa1497b80f 100644 --- a/toolchain/parser/testdata/struct/fail_mix_type_and_value.carbon +++ b/toolchain/parser/testdata/struct/fail_mix_type_and_value.carbon @@ -25,5 +25,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_mix_type_and_value.carbon:[[@LINE+1]]:21: Expected `.field: type`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_mix_type_and_value.carbon:[[@LINE+1]]:21: Expected `.field: field_type`. var x: {.a: i32, .b = 0} = {}; diff --git a/toolchain/parser/testdata/struct/fail_no_colon_or_equals.carbon b/toolchain/parser/testdata/struct/fail_no_colon_or_equals.carbon index b384009fcdac..070a7fb5aefc 100644 --- a/toolchain/parser/testdata/struct/fail_no_colon_or_equals.carbon +++ b/toolchain/parser/testdata/struct/fail_no_colon_or_equals.carbon @@ -20,5 +20,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_no_colon_or_equals.carbon:[[@LINE+1]]:11: Expected `.field: type` or `.field = value`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_no_colon_or_equals.carbon:[[@LINE+1]]:11: Expected `.field: field_type` or `.field = value`. var x: {.a} = {}; diff --git a/toolchain/parser/testdata/struct/fail_type_no_designator.carbon b/toolchain/parser/testdata/struct/fail_type_no_designator.carbon index 0a62c76ff23b..d1085fa888f0 100644 --- a/toolchain/parser/testdata/struct/fail_type_no_designator.carbon +++ b/toolchain/parser/testdata/struct/fail_type_no_designator.carbon @@ -18,5 +18,5 @@ // CHECK:STDOUT: {kind: 'FileEnd', text: ''}, // CHECK:STDOUT: ] -// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_type_no_designator.carbon:[[@LINE+1]]:9: Expected `.field: type` or `.field = value`. +// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_type_no_designator.carbon:[[@LINE+1]]:9: Expected `.field: field_type` or `.field = value`. var x: {i32} = {}; diff --git a/utils/highlightjs/highlightjs_carbon_lang.js b/utils/highlightjs/highlightjs_carbon_lang.js index 8c7d54965616..e345602d614a 100644 --- a/utils/highlightjs/highlightjs_carbon_lang.js +++ b/utils/highlightjs/highlightjs_carbon_lang.js @@ -69,6 +69,7 @@ export default function (hljs) { 'return', 'returned', 'then', + 'type', '_', 'var', 'virtual', @@ -77,7 +78,7 @@ export default function (hljs) { ], literal: ['false', 'true'], type: ['bool'], - built_in: ['Type', 'As'], + built_in: ['As'], }; // Punctuation and operator regex lists that are expanded into the expression diff --git a/utils/highlightjs/highlightjs_example.html b/utils/highlightjs/highlightjs_example.html index 3df0e87f40e1..4c9f4fabf77d 100644 --- a/utils/highlightjs/highlightjs_example.html +++ b/utils/highlightjs/highlightjs_example.html @@ -71,7 +71,7 @@ fn Widget.Print[addr self: Self*](var i: i64, x: f32, _: bool, 47) { """); } -class FancyWidget(T:! Type) extends Widget { +class FancyWidget(T:! type) extends Widget { impl fn Print[self: Self](); impl as Add(T) { @@ -79,11 +79,11 @@ class FancyWidget(T:! Type) extends Widget { } } -fn FancyWidget(T:! Type).Print[self: Self]() { +fn FancyWidget(T:! type).Print[self: Self]() { Carbon.Print("more test"); } -impl forall [T:! Type] FancyWidget(T) as Printable { +impl forall [T:! type] FancyWidget(T) as Printable { alias Print = FancyWidget(T).Print; } diff --git a/utils/textmate/Samples/main.carbon b/utils/textmate/Samples/main.carbon index 838ca9a411d0..fe1a2d711437 100644 --- a/utils/textmate/Samples/main.carbon +++ b/utils/textmate/Samples/main.carbon @@ -6,7 +6,7 @@ package Carbon api; -interface HasValueParam(T:! Type, V:! T) { +interface HasValueParam(T:! type, V:! T) { fn Go[self: Self]() -> T; } diff --git a/utils/textmate/Syntaxes/Carbon.plist b/utils/textmate/Syntaxes/Carbon.plist index 284bf98eb3d4..4f1c9a4a5bb6 100644 --- a/utils/textmate/Syntaxes/Carbon.plist +++ b/utils/textmate/Syntaxes/Carbon.plist @@ -68,7 +68,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception name storage.type.carbon match - \b(As|bool|Carbon\.Int|Carbon\.UInt|f16|f32|f64|f128|i8|i16|i32|i64|i128|i256|Slice|String|StringView|Type|u8|u16|u32|u64|u128|u256)\b + \b(As|bool|Carbon\.Int|Carbon\.UInt|f16|f32|f64|f128|i8|i16|i32|i64|i128|i256|Slice|String|StringView|type|u8|u16|u32|u64|u128|u256)\b