Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanCavanaugh committed Jan 23, 2025
1 parent af6ab8d commit be992fa
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 28 deletions.
26 changes: 22 additions & 4 deletions tests/baselines/reference/erasableSyntaxOnly.errors.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
erasableSyntaxOnly.ts(3,17): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(6,11): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(10,11): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(16,6): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(20,1): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(22,12): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(16,11): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(17,12): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(22,6): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(26,1): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
erasableSyntaxOnly.ts(28,12): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.


==== erasableSyntaxOnly.ts (6 errors) ====
==== erasableSyntaxOnly.ts (8 errors) ====
class MyClassErr {
// No parameter properties
constructor(public foo: string) { }
Expand All @@ -28,6 +30,16 @@ erasableSyntaxOnly.ts(22,12): error TS1294: This syntax is not allowed when 'era
}
}

namespace IllegalBecauseNestedInstantiated {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
namespace Nested {
~~~~~~
!!! error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
export const m = 1;
}
}

enum NotLegalEnum {
~~~~~~~~~~~~
!!! error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
Expand All @@ -49,9 +61,15 @@ erasableSyntaxOnly.ts(22,12): error TS1294: This syntax is not allowed when 'era
// Not a parameter property, ok
constructor(foo: string) { }
}

// Note for implementors: This should not be an error
// as this entire namespace block is fully erased
namespace NotInstantiated {
export interface JustAType { }
export type ATypeInANamespace = {};
namespace Nested {
export type ATypeInANamespace = {};
}
}
declare namespace AmbientIsNotInstantiated {
export const stillOk = 12;
Expand Down
69 changes: 45 additions & 24 deletions tests/baselines/reference/erasableSyntaxOnly.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -25,75 +25,96 @@ namespace AlsoIllegalBecauseInstantiated {
}
}

namespace IllegalBecauseNestedInstantiated {
>IllegalBecauseNestedInstantiated : Symbol(IllegalBecauseNestedInstantiated, Decl(erasableSyntaxOnly.ts, 13, 1))

namespace Nested {
>Nested : Symbol(Nested, Decl(erasableSyntaxOnly.ts, 15, 44))

export const m = 1;
>m : Symbol(m, Decl(erasableSyntaxOnly.ts, 17, 14))
}
}

enum NotLegalEnum {
>NotLegalEnum : Symbol(NotLegalEnum, Decl(erasableSyntaxOnly.ts, 13, 1))
>NotLegalEnum : Symbol(NotLegalEnum, Decl(erasableSyntaxOnly.ts, 19, 1))

B = 1
>B : Symbol(NoGoodAlias, Decl(erasableSyntaxOnly.ts, 15, 19))
>B : Symbol(NoGoodAlias, Decl(erasableSyntaxOnly.ts, 21, 19))
}

import NoGoodAlias = NotLegalEnum.B;
>NoGoodAlias : Symbol(NoGoodAlias, Decl(erasableSyntaxOnly.ts, 17, 1))
>NotLegalEnum : Symbol(NotLegalEnum, Decl(erasableSyntaxOnly.ts, 13, 1))
>B : Symbol(NoGoodAlias, Decl(erasableSyntaxOnly.ts, 15, 19))
>NoGoodAlias : Symbol(NoGoodAlias, Decl(erasableSyntaxOnly.ts, 23, 1))
>NotLegalEnum : Symbol(NotLegalEnum, Decl(erasableSyntaxOnly.ts, 19, 1))
>B : Symbol(NoGoodAlias, Decl(erasableSyntaxOnly.ts, 21, 19))

const enum NotLegalConstEnum {
>NotLegalConstEnum : Symbol(NotLegalConstEnum, Decl(erasableSyntaxOnly.ts, 19, 36))
>NotLegalConstEnum : Symbol(NotLegalConstEnum, Decl(erasableSyntaxOnly.ts, 25, 36))

C = 2
>C : Symbol(NotLegalConstEnum.C, Decl(erasableSyntaxOnly.ts, 21, 30))
>C : Symbol(NotLegalConstEnum.C, Decl(erasableSyntaxOnly.ts, 27, 30))
}

// No errors after this point
class MyClassOk {
>MyClassOk : Symbol(MyClassOk, Decl(erasableSyntaxOnly.ts, 23, 1))
>MyClassOk : Symbol(MyClassOk, Decl(erasableSyntaxOnly.ts, 29, 1))

// Not a parameter property, ok
constructor(foo: string) { }
>foo : Symbol(foo, Decl(erasableSyntaxOnly.ts, 28, 16))
>foo : Symbol(foo, Decl(erasableSyntaxOnly.ts, 34, 16))
}

// Note for implementors: This should not be an error
// as this entire namespace block is fully erased
namespace NotInstantiated {
>NotInstantiated : Symbol(NotInstantiated, Decl(erasableSyntaxOnly.ts, 29, 1))
>NotInstantiated : Symbol(NotInstantiated, Decl(erasableSyntaxOnly.ts, 35, 1))

export interface JustAType { }
>JustAType : Symbol(JustAType, Decl(erasableSyntaxOnly.ts, 30, 27))
>JustAType : Symbol(JustAType, Decl(erasableSyntaxOnly.ts, 39, 27))

export type ATypeInANamespace = {};
>ATypeInANamespace : Symbol(ATypeInANamespace, Decl(erasableSyntaxOnly.ts, 31, 34))
>ATypeInANamespace : Symbol(ATypeInANamespace, Decl(erasableSyntaxOnly.ts, 40, 34))

namespace Nested {
>Nested : Symbol(Nested, Decl(erasableSyntaxOnly.ts, 41, 39))

export type ATypeInANamespace = {};
>ATypeInANamespace : Symbol(ATypeInANamespace, Decl(erasableSyntaxOnly.ts, 42, 22))
}
}
declare namespace AmbientIsNotInstantiated {
>AmbientIsNotInstantiated : Symbol(AmbientIsNotInstantiated, Decl(erasableSyntaxOnly.ts, 33, 1))
>AmbientIsNotInstantiated : Symbol(AmbientIsNotInstantiated, Decl(erasableSyntaxOnly.ts, 45, 1))

export const stillOk = 12;
>stillOk : Symbol(stillOk, Decl(erasableSyntaxOnly.ts, 35, 16))
>stillOk : Symbol(stillOk, Decl(erasableSyntaxOnly.ts, 47, 16))
}

declare enum LegalEnum {
>LegalEnum : Symbol(LegalEnum, Decl(erasableSyntaxOnly.ts, 36, 1))
>LegalEnum : Symbol(LegalEnum, Decl(erasableSyntaxOnly.ts, 48, 1))

A = 1
>A : Symbol(LegalEnum.A, Decl(erasableSyntaxOnly.ts, 38, 24))
>A : Symbol(LegalEnum.A, Decl(erasableSyntaxOnly.ts, 50, 24))
}

declare namespace AmbientStuff {
>AmbientStuff : Symbol(AmbientStuff, Decl(erasableSyntaxOnly.ts, 40, 1))
>AmbientStuff : Symbol(AmbientStuff, Decl(erasableSyntaxOnly.ts, 52, 1))

namespace Nested {
>Nested : Symbol(Nested, Decl(erasableSyntaxOnly.ts, 42, 32))
>Nested : Symbol(Nested, Decl(erasableSyntaxOnly.ts, 54, 32))

export const stillOk = 12;
>stillOk : Symbol(stillOk, Decl(erasableSyntaxOnly.ts, 44, 20))
>stillOk : Symbol(stillOk, Decl(erasableSyntaxOnly.ts, 56, 20))
}
enum EnumInAmbientContext {
>EnumInAmbientContext : Symbol(EnumInAmbientContext, Decl(erasableSyntaxOnly.ts, 45, 5))
>EnumInAmbientContext : Symbol(EnumInAmbientContext, Decl(erasableSyntaxOnly.ts, 57, 5))

B = 1
>B : Symbol(FineAlias, Decl(erasableSyntaxOnly.ts, 46, 31))
>B : Symbol(FineAlias, Decl(erasableSyntaxOnly.ts, 58, 31))
}

import FineAlias = EnumInAmbientContext.B;
>FineAlias : Symbol(FineAlias, Decl(erasableSyntaxOnly.ts, 48, 5))
>EnumInAmbientContext : Symbol(EnumInAmbientContext, Decl(erasableSyntaxOnly.ts, 45, 5))
>B : Symbol(FineAlias, Decl(erasableSyntaxOnly.ts, 46, 31))
>FineAlias : Symbol(FineAlias, Decl(erasableSyntaxOnly.ts, 60, 5))
>EnumInAmbientContext : Symbol(EnumInAmbientContext, Decl(erasableSyntaxOnly.ts, 57, 5))
>B : Symbol(FineAlias, Decl(erasableSyntaxOnly.ts, 58, 31))
}

25 changes: 25 additions & 0 deletions tests/baselines/reference/erasableSyntaxOnly.types
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ namespace AlsoIllegalBecauseInstantiated {
}
}

namespace IllegalBecauseNestedInstantiated {
>IllegalBecauseNestedInstantiated : typeof IllegalBecauseNestedInstantiated
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

namespace Nested {
>Nested : typeof Nested
> : ^^^^^^^^^^^^^

export const m = 1;
>m : 1
> : ^
>1 : 1
> : ^
}
}

enum NotLegalEnum {
>NotLegalEnum : NotLegalEnum
> : ^^^^^^^^^^^^
Expand Down Expand Up @@ -73,11 +89,20 @@ class MyClassOk {
>foo : string
> : ^^^^^^
}

// Note for implementors: This should not be an error
// as this entire namespace block is fully erased
namespace NotInstantiated {
export interface JustAType { }
export type ATypeInANamespace = {};
>ATypeInANamespace : ATypeInANamespace
> : ^^^^^^^^^^^^^^^^^

namespace Nested {
export type ATypeInANamespace = {};
>ATypeInANamespace : ATypeInANamespace
> : ^^^^^^^^^^^^^^^^^
}
}
declare namespace AmbientIsNotInstantiated {
>AmbientIsNotInstantiated : typeof AmbientIsNotInstantiated
Expand Down
3 changes: 3 additions & 0 deletions tests/cases/compiler/erasableSyntaxOnly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class MyClassOk {
// Not a parameter property, ok
constructor(foo: string) { }
}

// Note for implementors: This should not be an error
// as this entire namespace block is fully erased
namespace NotInstantiated {
export interface JustAType { }
export type ATypeInANamespace = {};
Expand Down

0 comments on commit be992fa

Please sign in to comment.