Skip to content

TypeScript compiler hangs case #4604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
falsandtru opened this issue Sep 2, 2015 · 7 comments
Closed

TypeScript compiler hangs case #4604

falsandtru opened this issue Sep 2, 2015 · 7 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@falsandtru
Copy link
Contributor

Hangs on 06e2537

Reproduction

  1. checkout https://github.com/falsandtru/one-liner-stream/commit/7804f9125f1b5040f3a8c85b599dc57df125c578
  2. checkout and build 06e2537
  3. $ cd one-liner-stream
  4. $ node ../TypeScript/built/local/tsc.js src/ts/*.ts typings/*.ts --module commonjs --noEmit

Node 0.12.7

@falsandtru falsandtru changed the title Case of TypeScript compilation hangs TypeScript compiler hangs case Sep 2, 2015
@DanielRosenwasser DanielRosenwasser self-assigned this Sep 3, 2015
@DanielRosenwasser DanielRosenwasser added the Needs More Info The issue still hasn't been fully clarified label Sep 3, 2015
@DanielRosenwasser
Copy link
Member

@falsandtru can you please provide us with a simple tsconfig.json to compile your project? Ideally a more minimal reproduction of the issue would be better as well. Otherwise it's difficult for me to verify that this is indeed a problem with the TypeScript and figure out what could be causing it.

@falsandtru
Copy link
Contributor Author

I do not use tsconfig.json to this project. I'll try to minimize. I want to make sure in advance, were you able to reproduce this hangs? Thanks.

@falsandtru
Copy link
Contributor Author

Please compile this code.

run $ node built/local/tsc.js export.ts

// export.ts
export class ReadableLiner<T> {
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T>) => TransformLiner<U, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T>) => TransformLiner<T, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, U>) => TransformLiner<U, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T|U>) => TransformLiner<T|U, any>|PassThroughLiner<U>) {
    return composer(this);
  }
}

export class TransformLiner<T, U> {
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T>) => TransformLiner<U, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T>) => TransformLiner<T, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, U>) => TransformLiner<U, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T|U>) => TransformLiner<T|U, any>|PassThroughLiner<U>) {
    return composer(this);
  }
}

export class PassThroughLiner<T> {
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T>) => TransformLiner<U, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T>) => TransformLiner<T, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, U>) => TransformLiner<U, U>|PassThroughLiner<U>): TransformLiner<U, any>|PassThroughLiner<U>
  compose<U>(composer: (stream: ReadableLiner<T>|TransformLiner<T, T|U>) => TransformLiner<T|U, any>|PassThroughLiner<U>) {
    return composer(this);
  }
}

new ReadableLiner<number>()
  .compose(stream => stream);

@falsandtru
Copy link
Contributor Author

More info:

Compile failed without error messages

My original code compile finished without errors after a few hours, but compiled code is empty(output the empty file when I specified --outFile option). TS compiler must be show the error in this case because compile is failed.

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript and removed in progress Needs More Info The issue still hasn't been fully clarified labels Sep 3, 2015
@DanielRosenwasser
Copy link
Member

We're going to need to investigate; in the mean time, this will avoid the issue you're running into:

interface Liner<T> {
    compose<U>(composer: (stream: ReadableLiner<T> | TransformLiner<T, T>) => TransformLiner<U, U> | PassThroughLiner<U>): TransformLiner<U, any> | PassThroughLiner<U>
    compose<U>(composer: (stream: ReadableLiner<T> | TransformLiner<T, T>) => TransformLiner<T, U> | PassThroughLiner<U>): TransformLiner<U, any> | PassThroughLiner<U>
    compose<U>(composer: (stream: ReadableLiner<T> | TransformLiner<T, U>) => TransformLiner<U, U> | PassThroughLiner<U>): TransformLiner<U, any> | PassThroughLiner<U>
}

export class ReadableLiner<T> implements Liner<T> {
    compose<U>(composer: (stream: ReadableLiner<T> | TransformLiner<T, T | U>) => TransformLiner<T | U, any> | PassThroughLiner<U>) {
        return composer(this);
    }
}

export class TransformLiner<T, Z> implements Liner<T> {
    compose<U>(composer: (stream: ReadableLiner<T> | TransformLiner<T, T | U>) => TransformLiner<T | U, any> | PassThroughLiner<U>) {
        return composer(this);
    }
}

export class PassThroughLiner<T> implements Liner<T> {
    compose<U>(composer: (stream: ReadableLiner<T> | TransformLiner<T, T | U>) => TransformLiner<T | U, any> | PassThroughLiner<U>) {
        return composer(this);
    }
}

var x = new ReadableLiner().compose(stream => stream)

new ReadableLiner<number>()
    .compose(stream => stream);

@falsandtru
Copy link
Contributor Author

I confirmed, thank you. Another question. Are you accepted the another bug about error messages? I must be open the new issue?

@mhegazy mhegazy added this to the TypeScript 1.8 milestone Sep 18, 2015
@mhegazy mhegazy modified the milestones: TypeScript 1.7, TypeScript 1.8 Oct 9, 2015
@ahejlsberg
Copy link
Member

Fixed in #5738 and #5942.

@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Dec 7, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants