mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Added tests from 'captureArguments' branch.
This commit is contained in:
parent
3b74503898
commit
fc7be363f1
@ -1,4 +1,4 @@
|
||||
// @target: es6
|
||||
// @target: es5
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
// @target: es5
|
||||
|
||||
var a = () => arguments;
|
||||
@ -0,0 +1,3 @@
|
||||
// @target: es6
|
||||
|
||||
var a = () => arguments;
|
||||
@ -0,0 +1,4 @@
|
||||
// @target: es5
|
||||
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
@ -0,0 +1,4 @@
|
||||
// @target: es6
|
||||
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es6
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es6
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
|
||||
function f(arguments) {
|
||||
var a = (arguments) => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es6
|
||||
|
||||
function f(arguments) {
|
||||
var a = (arguments) => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => (arguments) => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es6
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => (arguments) => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
|
||||
function f(_arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
// @target: es6
|
||||
|
||||
function f(_arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
|
||||
function f(arguments) {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
|
||||
function f(arguments) {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
// @target: es5
|
||||
|
||||
class C {
|
||||
f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
// @target: es6
|
||||
|
||||
class C {
|
||||
f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = (arguments) => () => _arguments;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = (arguments) => () => _arguments;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
if (Math.random()) {
|
||||
let arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
var { arguments } = { arguments: "hello" };
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
var { arguments } = { arguments: "hello" };
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
var { arguments: args } = { arguments };
|
||||
if (Math.random()) {
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
var { arguments: args } = { arguments };
|
||||
if (Math.random()) {
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
// @target: es5
|
||||
|
||||
function f() {
|
||||
function g() {
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
function h() {
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: any) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
// @target: es6
|
||||
|
||||
function f() {
|
||||
function g() {
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
function h() {
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: any) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user