{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4158","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4158/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4158/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4158/events","html_url":"https://github.com/Microsoft/TypeScript/issues/4158","id":99142897,"number":4158,"title":"TypeScript compilation hangs on this code","user":{"login":"falsandtru","id":3143368,"avatar_url":"https://avatars.githubusercontent.com/u/3143368?v=3","gravatar_id":"","url":"https://api.github.com/users/falsandtru","html_url":"https://github.com/falsandtru","followers_url":"https://api.github.com/users/falsandtru/followers","following_url":"https://api.github.com/users/falsandtru/following{/other_user}","gists_url":"https://api.github.com/users/falsandtru/gists{/gist_id}","starred_url":"https://api.github.com/users/falsandtru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falsandtru/subscriptions","organizations_url":"https://api.github.com/users/falsandtru/orgs","repos_url":"https://api.github.com/users/falsandtru/repos","events_url":"https://api.github.com/users/falsandtru/events{/privacy}","received_events_url":"https://api.github.com/users/falsandtru/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Fixed","name":"Fixed","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/8","html_url":"https://github.com/Microsoft/TypeScript/milestones/TypeScript%201.6","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/8/labels","id":900034,"number":8,"title":"TypeScript 1.6","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"open_issues":71,"closed_issues":187,"state":"open","created_at":"2014-12-11T05:46:12Z","updated_at":"2015-08-06T19:59:07Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-08-05T07:36:20Z","updated_at":"2015-08-06T20:38:28Z","closed_at":"2015-08-06T18:35:48Z","body":"This code does not end the compilation on Windows 7 using master branch of TypeScript.\r\n\r\n```\r\n$ node built/local/tsc.js hang.ts\r\n```\r\n\r\nAnd VS2013 was hangup. `devenv.exe` consume memory about 3.5GB.\r\n\r\n```ts\r\n// hang.ts\r\ninterface LazyChain<T> extends LAZYCHAIN.Stream<T> {\r\n}\r\n\r\ninterface LazyMonad<T, M> extends LAZYCHAIN.MonadStream<T, M> {\r\n}\r\n\r\ninterface Array<T> extends LAZYCHAIN.StreamMethod<T> {\r\n}\r\n\r\ndeclare module LAZYCHAIN {\r\n\r\n  interface Callback<T, U, V> {\r\n    (value?: T, index?: number, array?: T[], env?: V): U\r\n  }\r\n\r\n  interface CallbackAsync<T, U, V> {\r\n    (value?: T, index?: number, array?: T[], env?: V, deferred?): any\r\n  }\r\n\r\n  interface StreamMethod<T> {\r\n    // lazy\r\n    //  - basic\r\n    lazy(onmessage: CallbackAsync<T, T, {}>): LazyChain<T>\r\n    lazy(onmessage: CallbackAsync<T, T, {}>, sequential: boolean): LazyChain<T[]>\r\n  }\r\n\r\n  interface Stream<T> extends StreamMethod<T> {\r\n    // pattern\r\n    pattern(...patterns: Array<[T|Function]|[T|Function, (...args: T[]) => T]|[T|Function, (...args: T[]) => boolean, (...args: T[]) => T]>): LazyChain<T>\r\n    // monad\r\n    monad<M>(monad: Monad<T, M>, convert?: boolean): LazyMonad<T, M>\r\n    monad<M>(monad: Monad<T, M>, type: T|((...args: any[]) => T)): LazyMonad<T, M>\r\n    // array\r\n    array(): T[]\r\n  }\r\n\r\n  interface MonadStream<T, M> {\r\n    // pattern\r\n    pattern(...patterns: Array<[M]|[M, (...args: M[]) => M]|[M, (...args: M[]) => boolean, (...args: M[]) => M]>): LazyMonad<T, M>\r\n    // monadic\r\n    monadic(...patterns: Array<[M]|[M, (...args: T[]) => M]|[M, (...args: T[]) => boolean, (...args: T[]) => M]>): LazyMonad<T, M>\r\n    // lazy\r\n    //  - basic\r\n    lazy(onmessage: CallbackAsync<M, M, {}>): LazyMonad<T, M>\r\n    lazy(onmessage: CallbackAsync<M, M, {}>, sequential: boolean): LazyMonad<T, M[]>\r\n    // array\r\n    array(): T[]\r\n  }\r\n\r\n  interface Monad<T, M> extends Monoid<M> {\r\n    return(arg: T): M\r\n    bind(m: M, f: (arg: T) => M): M\r\n    fail?(arg: any): M\r\n  }\r\n\r\n  interface Monoid<M> {\r\n    mempty?(): M\r\n    mappend?(m1: M, m2: M): M\r\n    mconcat?(ms: M[]): M\r\n  }\r\n\r\n}\r\n\r\nfunction f<T, U>(): LazyChain<T|U> {\r\n  return <LazyChain<T|T[]|U|U[]>>null;\r\n}\r\n```\r\n\r\nUpdate:\r\nI was able to get the error message after 3 hours.\r\n```\r\n$ node built/local/tsc.js hang.ts\r\nFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory\r\n```"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/128500977","html_url":"https://github.com/Microsoft/TypeScript/issues/4158#issuecomment-128500977","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4158","id":128500977,"user":{"login":"falsandtru","id":3143368,"avatar_url":"https://avatars.githubusercontent.com/u/3143368?v=3","gravatar_id":"","url":"https://api.github.com/users/falsandtru","html_url":"https://github.com/falsandtru","followers_url":"https://api.github.com/users/falsandtru/followers","following_url":"https://api.github.com/users/falsandtru/following{/other_user}","gists_url":"https://api.github.com/users/falsandtru/gists{/gist_id}","starred_url":"https://api.github.com/users/falsandtru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falsandtru/subscriptions","organizations_url":"https://api.github.com/users/falsandtru/orgs","repos_url":"https://api.github.com/users/falsandtru/repos","events_url":"https://api.github.com/users/falsandtru/events{/privacy}","received_events_url":"https://api.github.com/users/falsandtru/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T20:38:28Z","updated_at":"2015-08-06T20:38:28Z","body":"I still do not know the reason for the other hang. But some of the hang reported until now. I have experienced hang for another reason in the past. It does not hang anymore? Really does not take measures? I do not want to restart anymore."}}