Skip to content

Commit 70e42c3

Browse files
Fix review
1 parent 9a504f3 commit 70e42c3

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/compiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7194,8 +7194,8 @@ export class Compiler extends DiagnosticEmitter {
71947194
let existingLocal = flow.getScopedLocal(declaration.name.text);
71957195
if (existingLocal) {
71967196
this.error(
7197-
DiagnosticCode.Duplicate_identifier_0,
7198-
declaration.name.range, declaration.name.text
7197+
DiagnosticCode.Duplicate_function_implementation,
7198+
declaration.name.range
71997199
);
72007200
return this.module.unreachable();
72017201
}

tests/compiler/duplicate-function-in-scope.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"asc_flags": [],
33
"stderr": [
44
"EOF",
5-
"TS2300: Duplicate identifier 'inner'."
5+
"TS2393: Duplicate function implementation."
66
]
77
}

tests/compiler/duplicate-function-in-scope.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
// produce a diagnostic instead of crashing the compiler.
33

44
export function test(): void {
5-
function inner(): i32 {
6-
let x: i32 = 0;
7-
return x;
8-
}
9-
function inner(): i32 {
10-
let x: i32 = 0;
11-
return x + 1;
12-
}
5+
function inner(): void {}
6+
function inner(): void {}
137
inner();
148
}
159

0 commit comments

Comments
 (0)