Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AssemblyScript/assemblyscript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.27.17
Choose a base ref
...
head repository: AssemblyScript/assemblyscript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.27.18
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 15, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    aa54a2b View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4f15024 View commit details
Showing with 21 additions and 0 deletions.
  1. 0 bin/asinit.js
  2. +1 −0 src/diagnosticMessages.json
  3. +4 −0 src/program.ts
  4. +7 −0 tests/compiler/interface-with-initializer.json
  5. +9 −0 tests/compiler/interface-with-initializer.ts
Empty file modified bin/asinit.js
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions src/diagnosticMessages.json
Original file line number Diff line number Diff line change
@@ -119,6 +119,7 @@
"Decorators are not valid here.": 1206,
"'abstract' modifier can only appear on a class, method, or property declaration.": 1242,
"Method '{0}' cannot have an implementation because it is marked abstract.": 1245,
"An interface property cannot have an initializer.": 1246,
"A definite assignment assertion '!' is not permitted in this context.": 1255,
"A class may only extend another class.": 1311,
"A parameter property cannot be declared using a rest parameter.": 1317,
4 changes: 4 additions & 0 deletions src/program.ts
Original file line number Diff line number Diff line change
@@ -2671,6 +2671,10 @@ export class Program extends DiagnosticEmitter {
/** Parent interface. */
parent: InterfacePrototype
): void {
let initializer = declaration.initializer;
if (initializer) {
this.error(DiagnosticCode.An_interface_property_cannot_have_an_initializer, initializer.range);
}
let typeNode = declaration.type;
if (!typeNode) typeNode = Node.createOmittedType(declaration.name.range.atEnd);
this.initializeProperty(
7 changes: 7 additions & 0 deletions tests/compiler/interface-with-initializer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"asc_flags": [
],
"stderr": [
"TS1246: An interface property cannot have an initializer."
]
}
9 changes: 9 additions & 0 deletions tests/compiler/interface-with-initializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
interface I {
v: string = "";
}

class C implements I {
v: string = "";
}

new C();