mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
We don't seem to have any need for `TypeOf*Type` types, and having them introduces the temptation to use them during type-checking, which would lead to types having different behavior when their type-of-type is `Type` versus when it's a more precise type. Remove these types for now. If we later decide that we want each type literal to have a unique type, as we do for value literals, we can introduce a single value kind for that rather than one for each kind of type. No changes to `TypeOfMemberName`, `TypeOfParameterizedEntityName`, and `TypeOfMixinPseudoType`, which are placeholders, not real types.
32 lines
845 B
Plaintext
32 lines
845 B
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
// RUN: %{not} %{explorer-run}
|
|
// RUN: %{not} %{explorer-run-trace}
|
|
|
|
package ExplorerTest api;
|
|
|
|
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`
|
|
fn Origin(zero: T) -> Self(T) {
|
|
return {.x = zero, .y = zero};
|
|
}
|
|
|
|
// Error: wrote `Self(T)` instead of `Self`.
|
|
fn GetX[me: Self(T)]() -> T {
|
|
return me.x;
|
|
}
|
|
|
|
var x: T;
|
|
var y: T;
|
|
}
|
|
|
|
fn Main() -> i32 {
|
|
var p: Point(i32) = Point(i32).Origin(0);
|
|
return p.GetX();
|
|
}
|