Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference1.ts] ////

=== contextualParamTypeVsNestedReturnTypeInference1.ts ===
interface Effect<A> {
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 17))

_A: A;
>_A : Symbol(Effect._A, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 21))
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 17))
}

declare function effectGen<AEff>(f: () => AEff): Effect<AEff>;
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 2, 1))
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 27))
>f : Symbol(f, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 33))
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 27))
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 27))

declare function effectFn<AEff, Args extends Array<any>>(
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 62))
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 26))
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 31))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more)

body: (...args: Args) => unknown,
>body : Symbol(body, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 57))
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 7, 9))
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 31))

): (...args: Args) => Effect<AEff>;
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 8, 4))
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 31))
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 26))

declare function layerEffect<S>(tag: Tag<S>, effect: Effect<S>): unknown;
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 8, 35))
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 29))
>tag : Symbol(tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 32))
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 73))
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 29))
>effect : Symbol(effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 44))
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 29))

interface Tag<Type> {
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 73))
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 12, 14))

_Type: Type;
>_Type : Symbol(Tag._Type, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 12, 21))
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 12, 14))
}

declare const Foo: Tag<{
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 16, 13))
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 73))

fn: (a: string) => unknown;
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 16, 24))
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 17, 7))

}>;

layerEffect(
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 8, 35))

Foo,
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 16, 13))

effectGen(function () {
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 2, 1))

return {
fn: effectFn(function (a) {
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 23, 12))
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 62))
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 24, 29))

a; // string
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 24, 29))

}),
};
}),
);

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference1.ts] ////

=== contextualParamTypeVsNestedReturnTypeInference1.ts ===
interface Effect<A> {
_A: A;
>_A : A
> : ^
}

declare function effectGen<AEff>(f: () => AEff): Effect<AEff>;
>effectGen : <AEff>(f: () => AEff) => Effect<AEff>
> : ^ ^^ ^^ ^^^^^
>f : () => AEff
> : ^^^^^^

declare function effectFn<AEff, Args extends Array<any>>(
>effectFn : <AEff, Args extends Array<any>>(body: (...args: Args) => unknown) => (...args: Args) => Effect<AEff>
> : ^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^

body: (...args: Args) => unknown,
>body : (...args: Args) => unknown
> : ^^^^ ^^ ^^^^^
>args : Args
> : ^^^^

): (...args: Args) => Effect<AEff>;
>args : Args
> : ^^^^

declare function layerEffect<S>(tag: Tag<S>, effect: Effect<S>): unknown;
>layerEffect : <S>(tag: Tag<S>, effect: Effect<S>) => unknown
> : ^ ^^ ^^ ^^ ^^ ^^^^^
>tag : Tag<S>
> : ^^^^^^
>effect : Effect<S>
> : ^^^^^^^^^

interface Tag<Type> {
_Type: Type;
>_Type : Type
> : ^^^^
}

declare const Foo: Tag<{
>Foo : Tag<{ fn: (a: string) => unknown; }>
> : ^^^^^^^^^^ ^^^^

fn: (a: string) => unknown;
>fn : (a: string) => unknown
> : ^ ^^ ^^^^^
>a : string
> : ^^^^^^

}>;

layerEffect(
>layerEffect( Foo, effectGen(function () { return { fn: effectFn(function (a) { a; // string }), }; }),) : unknown
> : ^^^^^^^
>layerEffect : <S>(tag: Tag<S>, effect: Effect<S>) => unknown
> : ^ ^^ ^^ ^^ ^^ ^^^^^

Foo,
>Foo : Tag<{ fn: (a: string) => unknown; }>
> : ^^^^^^^^^^ ^^^^

effectGen(function () {
>effectGen(function () { return { fn: effectFn(function (a) { a; // string }), }; }) : Effect<{ fn: (a: string) => Effect<unknown>; }>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>effectGen : <AEff>(f: () => AEff) => Effect<AEff>
> : ^ ^^ ^^ ^^^^^
>function () { return { fn: effectFn(function (a) { a; // string }), }; } : () => { fn: (a: string) => Effect<unknown>; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

return {
>{ fn: effectFn(function (a) { a; // string }), } : { fn: (a: string) => Effect<unknown>; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

fn: effectFn(function (a) {
>fn : (a: string) => Effect<unknown>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>effectFn(function (a) { a; // string }) : (a: string) => Effect<unknown>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>effectFn : <AEff, Args extends Array<any>>(body: (...args: Args) => unknown) => (...args: Args) => Effect<AEff>
> : ^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
>function (a) { a; // string } : (a: string) => void
> : ^ ^^^^^^^^^^^^^^^^^
>a : string
> : ^^^^^^

a; // string
>a : string
> : ^^^^^^

}),
};
}),
);

Loading
Loading