mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Refactor pre-merge redeclaration checking for sharing. (#3884)
I'm poking at adding similar validation for `class` merging; this refactors support so that it can easily be shared.
This commit is contained in:
@@ -15,7 +15,7 @@ extern fn F();
|
||||
library "redecl" api;
|
||||
|
||||
extern fn F();
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redundant redeclaration of function F.
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn F` is redundant.
|
||||
// CHECK:STDERR: extern fn F();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: Previously declared here.
|
||||
@@ -29,7 +29,7 @@ extern fn F();
|
||||
library "redecl_extern" api;
|
||||
|
||||
extern fn F();
|
||||
// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE+7]]:1: ERROR: Redundant redeclaration of function F.
|
||||
// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn F` is redundant.
|
||||
// CHECK:STDERR: fn F();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE-4]]:1: Previously declared here.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// AUTOUPDATE
|
||||
|
||||
fn A();
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redundant redeclaration of function A.
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn A` is redundant.
|
||||
// CHECK:STDERR: fn A();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: Previously declared here.
|
||||
@@ -15,7 +15,7 @@ fn A();
|
||||
fn A();
|
||||
|
||||
fn B(x: i32);
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redundant redeclaration of function B.
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn B` is redundant.
|
||||
// CHECK:STDERR: fn B(x: i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: Previously declared here.
|
||||
@@ -35,7 +35,7 @@ fn C();
|
||||
fn C(x: i32);
|
||||
|
||||
fn D() {}
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redundant redeclaration of function D.
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn D` is redundant.
|
||||
// CHECK:STDERR: fn D();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: Previously declared here.
|
||||
@@ -45,7 +45,7 @@ fn D() {}
|
||||
fn D();
|
||||
|
||||
fn E() {}
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+6]]:1: ERROR: Redefinition of function E.
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE+6]]:1: ERROR: Redefinition of `fn E`.
|
||||
// CHECK:STDERR: fn E() {}
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_redecl.carbon:[[@LINE-4]]:1: Previously defined here.
|
||||
|
||||
@@ -26,7 +26,7 @@ extern fn A();
|
||||
|
||||
library "extern_api" impl;
|
||||
|
||||
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+10]]:1: ERROR: Redeclarations in the same library must match use of `extern`.
|
||||
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+10]]:1: ERROR: Redeclarations of `fn A` in the same library must match use of `extern`.
|
||||
// CHECK:STDERR: fn A();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE-5]]:1: In import.
|
||||
@@ -48,7 +48,7 @@ fn A();
|
||||
|
||||
library "extern_impl" impl;
|
||||
|
||||
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+9]]:1: ERROR: Redeclarations in the same library must match use of `extern`.
|
||||
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+9]]:1: ERROR: Redeclarations of `fn A` in the same library must match use of `extern`.
|
||||
// CHECK:STDERR: extern fn A();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE-5]]:1: In import.
|
||||
|
||||
Reference in New Issue
Block a user