mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge branch 'master' into conformanceDestructuringAssignment
This commit is contained in:
commit
aef3b3e662
5206 files changed
+249790
-91704
No files matched your search
@@ -0,0 +1,2 @@
|
||||
var tuple: [string, number];
|
||||
[...c] = tupel; // intentionally misspelled
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
x = 0;
|
||||
}
|
||||
|
||||
var { x } = new C;
|
||||
@@ -0,0 +1 @@
|
||||
var { toExponential } = 0;
|
||||
@@ -0,0 +1 @@
|
||||
function a(...{a, b}) { }
|
||||
@@ -0,0 +1 @@
|
||||
function a(...[a, b]) { }
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict"
|
||||
var as = 0;
|
||||
function foo(as: string) { }
|
||||
class C {
|
||||
public as() { }
|
||||
}
|
||||
function F() {
|
||||
function as() { }
|
||||
}
|
||||
function H() {
|
||||
let {as} = { as: 1 };
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
function diamondTop<Top>() {
|
||||
function diamondMiddle<T extends Top, U extends Top>() {
|
||||
function diamondBottom<Bottom extends T | U>() {
|
||||
var top: Top;
|
||||
var middle: T | U;
|
||||
var bottom: Bottom;
|
||||
|
||||
top = middle;
|
||||
middle = bottom;
|
||||
top = bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
function diamondTop<Top>() {
|
||||
function diamondMiddle<T extends Top, U>() {
|
||||
function diamondBottom<Bottom extends T | U>() {
|
||||
var top: Top;
|
||||
var middle: T | U;
|
||||
var bottom: Bottom;
|
||||
|
||||
top = middle;
|
||||
middle = bottom;
|
||||
top = bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
function diamondTop<Top>() {
|
||||
function diamondMiddle<T, U>() {
|
||||
function diamondBottom<Bottom extends Top | T | U>() {
|
||||
var top: Top;
|
||||
var middle: T | U;
|
||||
var bottom: Bottom;
|
||||
|
||||
top = middle;
|
||||
middle = bottom;
|
||||
top = bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
function diamondTop<Top>() {
|
||||
function diamondMiddle<T, U>() {
|
||||
function diamondBottom<Bottom extends Top | T | U>() {
|
||||
var top: Top;
|
||||
var middle: Top | T | U;
|
||||
var bottom: Bottom;
|
||||
|
||||
top = middle;
|
||||
middle = bottom;
|
||||
top = bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Animal { run() { } }
|
||||
class Cat extends Animal { meow }
|
||||
class Dog extends Animal { woof }
|
||||
|
||||
function run(a: Animal) {
|
||||
a.run();
|
||||
}
|
||||
|
||||
function f<T extends Cat | Dog>(a: T) {
|
||||
a.run();
|
||||
run(a);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Animal { run() { } }
|
||||
class Cat extends Animal { meow }
|
||||
class Dog extends Animal { woof }
|
||||
|
||||
function run(a: Cat | Dog) {
|
||||
a.run();
|
||||
}
|
||||
|
||||
function f<T extends Cat | Dog>(a: T) {
|
||||
a.run();
|
||||
run(a);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// @target: es6
|
||||
// @target: es5
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
}
|
||||
File renamed without changes.
@@ -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;
|
||||
}
|
||||
}
|
||||
+15
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
var a: any;
|
||||
var x: string;
|
||||
[x] = a;
|
||||
@@ -0,0 +1,2 @@
|
||||
var c = {};
|
||||
[...c] = ["", 0];
|
||||
@@ -0,0 +1,3 @@
|
||||
//@target: ES6
|
||||
var c = {};
|
||||
[...c] = ["", 0];
|
||||
@@ -0,0 +1,2 @@
|
||||
var c = { bogus: 0 };
|
||||
[...c] = ["", 0];
|
||||
@@ -0,0 +1,3 @@
|
||||
//@target: ES6
|
||||
var a: string, b: number;
|
||||
[...[a, b = 0]] = ["", 1];
|
||||
@@ -0,0 +1,3 @@
|
||||
//@target: ES6
|
||||
var a: string, b: number;
|
||||
[...{ 0: a = "", b }] = ["", 1];
|
||||
@@ -0,0 +1,3 @@
|
||||
var a: string, b: number;
|
||||
var tuple: [string, number] = ["", 1];
|
||||
[...[a, b = 0]] = tuple;
|
||||
@@ -0,0 +1,3 @@
|
||||
var a: string, b: number;
|
||||
var tuple: [string, number] = ["", 1];
|
||||
[...{ 0: a = "", b }] = tuple;
|
||||
@@ -0,0 +1,2 @@
|
||||
var s: string, s2: string;
|
||||
[...[s, s2]] = ["", ""];
|
||||
@@ -0,0 +1 @@
|
||||
var [...[a, b]] = [0, 1];
|
||||
@@ -0,0 +1 @@
|
||||
var [...{0: a, b }] = [0, 1];
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
var a = `hello\world`;
|
||||
var b = `hello\\world`;
|
||||
var c = `hello\\\world`;
|
||||
var d = `hello\\\\world`;
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
|
||||
var a = `hello\world`;
|
||||
var b = `hello\\world`;
|
||||
var c = `hello\\\world`;
|
||||
var d = `hello\\\\world`;
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// @target: ES6
|
||||
// @filename: class.ts
|
||||
module X.Y {
|
||||
export class Point {
|
||||
constructor(x: number, y: number) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: module.ts
|
||||
module X.Y {
|
||||
export module Point {
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: test.ts
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
|
||||
|
||||
// @filename: simple.ts
|
||||
class A {
|
||||
id: string;
|
||||
}
|
||||
|
||||
module A {
|
||||
export var Instance = new A();
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
var a = new A();
|
||||
var a: { id: string };
|
||||
@@ -0,0 +1,16 @@
|
||||
interface I2 {
|
||||
(): number;
|
||||
(q): boolean;
|
||||
}
|
||||
|
||||
interface I3 {
|
||||
(): number;
|
||||
}
|
||||
|
||||
var i2: I2, i3: I3;
|
||||
|
||||
var e1: I2 | I3;
|
||||
var e2 = i2 || i3; // Type of e2 immediately reduced to I3
|
||||
|
||||
var r1 = e1(); // Type of e1 reduced to I3 upon accessing property or signature
|
||||
var r2 = e2();
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
////module E {
|
||||
//// export var n = 1;
|
||||
//// export var x = 0;
|
||||
////}
|
||||
////module F {
|
||||
//// export var n = 1;
|
||||
//// export var y = 0;
|
||||
////}
|
||||
////var q: typeof E | typeof F;
|
||||
////var j = q./*1*/
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
////}
|
||||
////var enumMember = e./*1*/thirdMember;
|
||||
|
||||
debugger;
|
||||
goTo.marker("1");
|
||||
verify.verifyDefinitionsName("thirdMember", "e");
|
||||
@@ -19,8 +19,8 @@
|
||||
goTo.marker("propertyReference");
|
||||
verify.definitionCountIs(2);
|
||||
goTo.definition(0);
|
||||
verify.caretAtMarker("propertyDefinition2");
|
||||
verify.caretAtMarker("propertyDefinition1");
|
||||
|
||||
goTo.marker("propertyReference");
|
||||
goTo.definition(1);
|
||||
verify.caretAtMarker("propertyDefinition1");
|
||||
verify.caretAtMarker("propertyDefinition2");
|
||||
@@ -8,5 +8,5 @@
|
||||
////interface I {
|
||||
//// interfaceMethodSignature(b: boolean): boolean;
|
||||
////}
|
||||
|
||||
debugger;
|
||||
verify.navigationItemsListCount(2, "interfaceMethodSignature", "exact");
|
||||
@@ -4,7 +4,7 @@
|
||||
////function overload1(b: boolean): boolean;
|
||||
////function overload1(b: number): boolean;
|
||||
////
|
||||
////var heyImNotInterruptingAnythingAmI = '?';
|
||||
////var x= '?';
|
||||
////
|
||||
////function overload1(f: typeof overload): boolean;
|
||||
////function overload1(x: any, b = (function overload() { return false })): boolean {
|
||||
@@ -15,7 +15,7 @@
|
||||
////function overload2(b: boolean): boolean;
|
||||
////function overload2(b: number): boolean;
|
||||
////
|
||||
////function iJustRuinEverything(x: any, b = (function overload() { return false })): boolean {
|
||||
////function y(x: any, b = (function overload() { return false })): boolean {
|
||||
//// throw overload;
|
||||
////}
|
||||
////
|
||||
@@ -24,6 +24,6 @@
|
||||
//// throw overload;
|
||||
////}
|
||||
|
||||
verify.navigationItemsListCount(2, "overload1", "exact");
|
||||
verify.navigationItemsListCount(2, "overload2", "exact");
|
||||
verify.navigationItemsListCount(4, "overload", "prefix");
|
||||
verify.navigationItemsListCount(1, "overload1", "exact");
|
||||
verify.navigationItemsListCount(1, "overload2", "exact");
|
||||
verify.navigationItemsListCount(2, "overload", "prefix");
|
||||
Reference in new issue
Block a user