Fix explorer crash - Assign different struct types (#2345)

* fix issue-1392

* run pre-commit

* run pre-commit

* Update explorer/interpreter/type_checker.cpp

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>

* change test file

* change test file

* remove size check

* Update explorer/interpreter/type_checker.cpp

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>

Co-authored-by: m new <michael.burzan@outlook.de>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
pmqtt
2022-10-25 20:35:48 +02:00
committed by GitHub
co-authored by Jon Ross-Perkins m new
parent 158a29cba7
commit c68cced1fb
2 changed files with 23 additions and 2 deletions
@@ -0,0 +1,16 @@
// 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;
fn Main() -> i32 {
var p: auto = {.x = 0, .y = 0};
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/struct/fail_assign_different_types.carbon:[[@LINE+1]]: type error in assignment: '{.y: i32}' is not implicitly convertible to '{.x: i32, .y: i32}'
p = {.y = 0};
return 0;
}