mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Revert condition inside shouldWriteTypeOfFunctionSymbol
This commit is contained in:
parent
44c2453ec6
commit
088ca88bfd
@ -1036,10 +1036,8 @@ module ts {
|
||||
(type.symbol.parent || // is exported function symbol
|
||||
ts.forEach(type.symbol.declarations, declaration =>
|
||||
declaration.parent.kind === SyntaxKind.SourceFile || declaration.parent.kind === SyntaxKind.ModuleBlock));
|
||||
if (isStaticMethodSymbol) {
|
||||
return false;
|
||||
}
|
||||
if (isNonLocalFunctionSymbol) {
|
||||
|
||||
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
||||
// typeof is allowed only for static/non local functions
|
||||
return !!(flags & TypeFormatFlags.UseTypeOfFunction) || // use typeof if format flags specify it
|
||||
(typeStack && contains(typeStack, type)); // it is type of the symbol uses itself recursively
|
||||
|
||||
@ -557,11 +557,11 @@ declare var i1_ncf: (b: number) => number;
|
||||
declare var i1_ncr: number;
|
||||
declare var i1_ncprop: number;
|
||||
declare var i1_s_p: number;
|
||||
declare var i1_s_f: (b: number) => number;
|
||||
declare var i1_s_f: typeof s2;
|
||||
declare var i1_s_r: number;
|
||||
declare var i1_s_prop: number;
|
||||
declare var i1_s_nc_p: number;
|
||||
declare var i1_s_ncf: (b: number) => number;
|
||||
declare var i1_s_ncf: typeof nc_s2;
|
||||
declare var i1_s_ncr: number;
|
||||
declare var i1_s_ncprop: number;
|
||||
declare var i1_c: typeof c1;
|
||||
@ -577,3 +577,111 @@ declare class cProperties {
|
||||
private y;
|
||||
}
|
||||
declare var cProperties_i: cProperties;
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
==== tests/cases/compiler/commentsClassMembers.d.ts (2 errors) ====
|
||||
/** This is comment for c1*/
|
||||
declare class c1 {
|
||||
/** p1 is property of c1*/
|
||||
p1: number;
|
||||
/** sum with property*/
|
||||
p2(/** number to add*/ b: number): number;
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
p3: number;
|
||||
/** pp1 is property of c1*/
|
||||
private pp1;
|
||||
/** sum with property*/
|
||||
private pp2(/** number to add*/ b);
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
private pp3;
|
||||
/** Constructor method*/
|
||||
constructor();
|
||||
/** s1 is static property of c1*/
|
||||
static s1: number;
|
||||
/** static sum with property*/
|
||||
static s2(/** number to add*/ b: number): number;
|
||||
/** static getter property*/
|
||||
/** setter property*/
|
||||
static s3: number;
|
||||
nc_p1: number;
|
||||
nc_p2(b: number): number;
|
||||
nc_p3: number;
|
||||
private nc_pp1;
|
||||
private nc_pp2(b);
|
||||
private nc_pp3;
|
||||
static nc_s1: number;
|
||||
static nc_s2(b: number): number;
|
||||
static nc_s3: number;
|
||||
a_p1: number;
|
||||
a_p2(b: number): number;
|
||||
a_p3: number;
|
||||
private a_pp1;
|
||||
private a_pp2(b);
|
||||
private a_pp3;
|
||||
static a_s1: number;
|
||||
static a_s2(b: number): number;
|
||||
static a_s3: number;
|
||||
/** p1 is property of c1 */
|
||||
b_p1: number;
|
||||
/** sum with property */
|
||||
b_p2(b: number): number;
|
||||
/** getter property */
|
||||
/** setter property */
|
||||
b_p3: number;
|
||||
/** pp1 is property of c1 */
|
||||
private b_pp1;
|
||||
/** sum with property */
|
||||
private b_pp2(b);
|
||||
/** getter property */
|
||||
/** setter property */
|
||||
private b_pp3;
|
||||
/** s1 is static property of c1 */
|
||||
static b_s1: number;
|
||||
/** static sum with property */
|
||||
static b_s2(b: number): number;
|
||||
/** static getter property
|
||||
*/
|
||||
/** setter property
|
||||
*/
|
||||
static b_s3: number;
|
||||
}
|
||||
declare var i1: c1;
|
||||
declare var i1_p: number;
|
||||
declare var i1_f: (b: number) => number;
|
||||
declare var i1_r: number;
|
||||
declare var i1_prop: number;
|
||||
declare var i1_nc_p: number;
|
||||
declare var i1_ncf: (b: number) => number;
|
||||
declare var i1_ncr: number;
|
||||
declare var i1_ncprop: number;
|
||||
declare var i1_s_p: number;
|
||||
declare var i1_s_f: typeof s2;
|
||||
~~
|
||||
!!! Cannot find name 's2'.
|
||||
declare var i1_s_r: number;
|
||||
declare var i1_s_prop: number;
|
||||
declare var i1_s_nc_p: number;
|
||||
declare var i1_s_ncf: typeof nc_s2;
|
||||
~~~~~
|
||||
!!! Cannot find name 'nc_s2'.
|
||||
declare var i1_s_ncr: number;
|
||||
declare var i1_s_ncprop: number;
|
||||
declare var i1_c: typeof c1;
|
||||
declare class cProperties {
|
||||
private val;
|
||||
/** getter only property*/
|
||||
p1: number;
|
||||
nc_p1: number;
|
||||
/**setter only property*/
|
||||
p2: number;
|
||||
nc_p2: number;
|
||||
x: number;
|
||||
private y;
|
||||
}
|
||||
declare var cProperties_i: cProperties;
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
}
|
||||
C.g(3); // error
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type '(t: any) => void'.
|
||||
!!! Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'.
|
||||
|
||||
var f4: () => typeof f4;
|
||||
f4 = 3; // error
|
||||
|
||||
@ -3,8 +3,8 @@ class C {
|
||||
>C : C
|
||||
|
||||
static g(t: typeof C.g){ }
|
||||
>g : (t: any) => void
|
||||
>t : (t: any) => void
|
||||
>g : (t: typeof g) => void
|
||||
>t : (t: typeof g) => void
|
||||
>C : typeof C
|
||||
>g : (t: any) => void
|
||||
>g : (t: typeof g) => void
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user