Skip to content

Changed default from ES3 to ES5 #15466

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

Conversation

perlun
Copy link

@perlun perlun commented Apr 29, 2017

Fixes #10117

The fix was easy, but then I had to get the tests passing:

$ gulp runtests # loads of failures, more than 1000 actually.
$ gulp baseline-accept
$ gulp runtests # to make sure they now passed

...and then git add . to add all the changes. (There were a bunch of new files created when I did it like this; is that correct?)


(Regarding the unrelated changes in compileOnSave.ts: I happened to see a few typing mistakes there very close to the changes I were making to that files, so I bundled that change along at the same time. Since the tests are passing I think it should be fine.)

@msftclas
Copy link

@perlun,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by Microsoft. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@perlun
Copy link
Author

perlun commented May 10, 2017

Argh, because of the delay the PR has gotten into merge conflicts. 😛 Will rebase and let you know once this is reviewable again.

@perlun perlun force-pushed the fix/change-default-target-to-es5 branch from 3a70332 to 9971d88 Compare May 10, 2017 17:29
@perlun
Copy link
Author

perlun commented May 10, 2017

@RyanCavanaugh or @ahejlsberg - this one is rebased again on top of the current master, and seems to build cleanly.

Would highly appreciate it we could get someone to look at it; because of the huge number of files affected (1450...), it is highly likely that it will run into merge conflicts over and over again if we leave it for a long time. Thanks in advance.

@DanielRosenwasser
Copy link
Member

Hi @perlun, sorry for the delay. I'm currently a little wary of which files were intended to be compiled on ES3 vs which files just happen to have minor output baselines changed. @mhegazy and @RyanCavanaugh may have some better guidance here.

@saschanaz
Copy link
Contributor

saschanaz commented May 29, 2017

I think adding @target: es3 for all compiler tests is one of the safest option here. (This will give no baseline change)

@perlun
Copy link
Author

perlun commented May 30, 2017

@saschanaz Sounds doable. I am not an expert in this codebase, so please give some more details and I'll see if I can get it sorted out. Where should this be added more specifically?

@saschanaz
Copy link
Contributor

@perlun It should be added as // @target: es3 on the top of each compiler test file. For example, tests/cases/compiler/2dArrays.ts will become:

// @target: es3
class Cell {
}

class Ship {
    isSunk: boolean;
}

class Board {
    ships: Ship[];
    cells: Cell[];

    private allShipsSunk() {
        return this.ships.every(function (val) { return val.isSunk; });
    }    
}

I would use some automated script to do this.

(Regarding the unrelated changes in `compileOnSave.ts`: I happened to see a few typing mistakes there very close to the changes I were making to that files, so I bundled that change along at the same time. Since the tests are passing I think it should be fine.)
@perlun perlun force-pushed the fix/change-default-target-to-es5 branch from 9971d88 to 151963d Compare May 31, 2017 12:32
@perlun
Copy link
Author

perlun commented May 31, 2017

Thanks a lot @saschanaz, that sounds doable. I couldn't find tests/cases/compiler/2dArrays.ts though, only ./tests/baselines/reference/2dArrays.js

Would the @target stuff come before or after the four slashes - I guess after of course? But then that makes it a lot harder to automate unfortunately...

@saschanaz
Copy link
Contributor

saschanaz commented May 31, 2017

I couldn't find tests/cases/compiler/2dArrays.ts though

The file is here: https://github.com/Microsoft/TypeScript/blob/master/tests/cases/compiler/2dArrays.ts

Would the @target stuff come before or after the four slashes - I guess after of course?

Compiler tests does not use four slashes, you can just add one on the top of the file. Fourslash tests don't support @lib directive yet. (17b5efb adds the support.) Anyway the answer is fortunately 'before'. 😄

@perlun
Copy link
Author

perlun commented May 31, 2017

The file is here: https://github.com/Microsoft/TypeScript/blob/master/tests/cases/compiler/2dArrays.ts

Argh! I searched for it, but for whatever reason did a find -name 2dArrays.js instead of .ts... 🤦‍♂️

Thanks a lot! Will try to get this one sorted out within the next week or so.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 2, 2017

Had a discussion about this change in the design meeting today, you can find more details in #10117 (comment).

as noted in #10117 (comment), we will not be taking this change in the time being. sorry for the delay, and the miss labeling of the issue as committed.

@mhegazy mhegazy closed this Jun 2, 2017
@perlun perlun deleted the fix/change-default-target-to-es5 branch June 2, 2017 22:14
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider changing default target to ES5
5 participants