mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-26 21:01:21 +00:00
Modifies the core package and literal handling to use factory functions for standard type literals. Updates function/builtin/import.carbon to stop depending on the prelude, since it would list all the impls in the core file. Updates alias/builtins.carbon to be failing (the type values cannot be aliased).
65 lines
2.5 KiB
Plaintext
65 lines
2.5 KiB
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
|
|
|
|
// --- implicit.carbon
|
|
|
|
package Implicit;
|
|
|
|
let T:! type = i32;
|
|
|
|
// --- fail_implicit.impl.carbon
|
|
|
|
impl package Implicit;
|
|
|
|
// TODO: Should this be valid?
|
|
// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `i32` to `T`.
|
|
// CHECK:STDERR: let a: T = 0;
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~
|
|
let a: T = 0;
|
|
|
|
// CHECK:STDOUT: --- implicit.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
|
|
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
|
|
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32]
|
|
// CHECK:STDOUT: %.loc4_19.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
|
// CHECK:STDOUT: %.loc4_19.2: type = converted %int.make_type_32, %.loc4_19.1 [template = i32]
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc4_19.2 [symbolic = constants.%T]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_implicit.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
|
|
// CHECK:STDOUT: %.1: i32 = int_literal 0 [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .T = %import_ref
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %import_ref: type = import_ref ir0, inst+2, loaded [symbolic = constants.%T]
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %T.ref: type = name_ref T, %import_ref [symbolic = constants.%T]
|
|
// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1]
|
|
// CHECK:STDOUT: %a: T = bind_name a, <error>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|