forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
error on set accessor without get accessor
Fixes: microsoft#11596
- Loading branch information
Showing
114 changed files
with
3,239 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/MemberAccessorDeclaration15.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(2,9): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(2,11): error TS2369: A parameter property is only allowed in a constructor implementation. | ||
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,16): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,18): error TS2369: A parameter property is only allowed in a constructor implementation. | ||
|
||
|
||
==== tests/cases/compiler/accessorParameterAccessibilityModifier.ts (2 errors) ==== | ||
==== tests/cases/compiler/accessorParameterAccessibilityModifier.ts (4 errors) ==== | ||
class C { | ||
set X(public v) { } | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~~~~~~~~ | ||
!!! error TS2369: A parameter property is only allowed in a constructor implementation. | ||
static set X(public v2) { } | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~~~~~~~~~ | ||
!!! error TS2369: A parameter property is only allowed in a constructor implementation. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts(8,9): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts(17,9): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
|
||
|
||
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts (2 errors) ==== | ||
class C { | ||
get x() { | ||
return 1; | ||
} | ||
} | ||
|
||
class D { | ||
set x(v) { | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
} | ||
} | ||
|
||
var x = { | ||
get a() { return 1 } | ||
} | ||
|
||
var y = { | ||
set b(v) { } | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
tests/cases/compiler/accessorWithInitializer.ts(2,9): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/compiler/accessorWithInitializer.ts(2,9): error TS1052: A 'set' accessor parameter cannot have an initializer. | ||
tests/cases/compiler/accessorWithInitializer.ts(3,16): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/compiler/accessorWithInitializer.ts(3,16): error TS1052: A 'set' accessor parameter cannot have an initializer. | ||
|
||
|
||
==== tests/cases/compiler/accessorWithInitializer.ts (2 errors) ==== | ||
==== tests/cases/compiler/accessorWithInitializer.ts (4 errors) ==== | ||
class C { | ||
set X(v = 0) { } | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~ | ||
!!! error TS1052: A 'set' accessor parameter cannot have an initializer. | ||
static set X(v2 = 0) { } | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~ | ||
!!! error TS1052: A 'set' accessor parameter cannot have an initializer. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
tests/cases/compiler/accessorWithRestParam.ts(2,9): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/compiler/accessorWithRestParam.ts(2,11): error TS1053: A 'set' accessor cannot have rest parameter. | ||
tests/cases/compiler/accessorWithRestParam.ts(3,16): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/compiler/accessorWithRestParam.ts(3,18): error TS1053: A 'set' accessor cannot have rest parameter. | ||
|
||
|
||
==== tests/cases/compiler/accessorWithRestParam.ts (2 errors) ==== | ||
==== tests/cases/compiler/accessorWithRestParam.ts (4 errors) ==== | ||
class C { | ||
set X(...v) { } | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~~~ | ||
!!! error TS1053: A 'set' accessor cannot have rest parameter. | ||
static set X(...v2) { } | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~~~ | ||
!!! error TS1053: A 'set' accessor cannot have rest parameter. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
tests/cases/compiler/accessorWithoutBody2.ts(1,15): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/compiler/accessorWithoutBody2.ts(1,20): error TS1005: '{' expected. | ||
|
||
|
||
==== tests/cases/compiler/accessorWithoutBody2.ts (1 errors) ==== | ||
==== tests/cases/compiler/accessorWithoutBody2.ts (2 errors) ==== | ||
var v = { set foo(a) } | ||
~~~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~ | ||
!!! error TS1005: '{' expected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
tests/cases/conformance/async/es5/asyncSetter_es5.ts(2,3): error TS1042: 'async' modifier cannot be used here. | ||
tests/cases/conformance/async/es5/asyncSetter_es5.ts(2,13): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
|
||
|
||
==== tests/cases/conformance/async/es5/asyncSetter_es5.ts (1 errors) ==== | ||
==== tests/cases/conformance/async/es5/asyncSetter_es5.ts (2 errors) ==== | ||
class C { | ||
async set foo(value) { | ||
~~~~~ | ||
!!! error TS1042: 'async' modifier cannot be used here. | ||
~~~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
tests/cases/conformance/async/es6/asyncSetter_es6.ts(2,3): error TS1042: 'async' modifier cannot be used here. | ||
tests/cases/conformance/async/es6/asyncSetter_es6.ts(2,13): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
|
||
|
||
==== tests/cases/conformance/async/es6/asyncSetter_es6.ts (1 errors) ==== | ||
==== tests/cases/conformance/async/es6/asyncSetter_es6.ts (2 errors) ==== | ||
class C { | ||
async set foo(value) { | ||
~~~~~ | ||
!!! error TS1042: 'async' modifier cannot be used here. | ||
~~~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(3,17): error TS1318: An abstract accessor cannot have an implementation. | ||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(4,17): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(5,17): error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(5,17): error TS1318: An abstract accessor cannot have an implementation. | ||
|
||
|
||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts (2 errors) ==== | ||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts (4 errors) ==== | ||
abstract class A { | ||
abstract get a(); | ||
abstract get aa() { return 1; } // error | ||
~~ | ||
!!! error TS1318: An abstract accessor cannot have an implementation. | ||
abstract set b(x: string); | ||
~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
abstract set bb(x: string) {} // error | ||
~~ | ||
!!! error TS1050: A 'set' accessor must have a corresponding 'get' accessor. | ||
~~ | ||
!!! error TS1318: An abstract accessor cannot have an implementation. | ||
} | ||
|
Oops, something went wrong.