-
Notifications
You must be signed in to change notification settings - Fork 10
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
TypeScript Compiler Testing Support #47
Open
alexisthedev
wants to merge
81
commits into
hephaestus-compiler-project:main
Choose a base branch
from
alexisthedev:merge-with-central-repo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
TypeScript Compiler Testing Support #47
alexisthedev
wants to merge
81
commits into
hephaestus-compiler-project:main
from
alexisthedev:merge-with-central-repo
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…lt values in typescript params.
…ype of UndefinedType in typescript
… language specific features
… typescript features
…ication algorithm
alexisthedev
force-pushed
the
merge-with-central-repo
branch
from
December 7, 2022 13:49
86bab20
to
101d787
Compare
@StefanosChaliasos The conflicts mentioned do not appear on my end (probably because they are rebase conflicts and not merge conflicts). |
theosotr
requested review from
theosotr and
StefanosChaliasos
and removed request for
theosotr
December 7, 2022 14:48
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TypeScript + Hephaestus
This pull request consists of the required modules and additions to test the TypeScript compiler with Hephaestus.
Important additions include:
AST-to-TypeScript Translator
Core API extension to allow generation of programs with native types of any language (eg. TypeScript's unique union types)
Null and Undefined Types
Null Constant
Literal Types (Native TypeScript)
Type Aliases (Native TypeScript)
Union Types (Native TypeScript)
A more detailed overview is available here.
How to use Hephaestus to test the compiler of TypeScript
Here is a typical command used to test Typescript with Hephaestus.
Key differences from testing other languages:
-t 0
) because transformations are not currently supported for TypeScript.-P
flag, so Hephaestus only runs correctness-preserving transformations (which are zero).-disable-use-site-variance
because TypeScript doesn't support use-site variance.Afterward, it is the typical Hephaestus process! (Check in the bugs folder to see the reported faults).
Expected result after running the above command:
Ubuntu 22.04 LTS
Had there been an error, a
Main.ts
file would have been stored atbugs/{name}/generator/iter_{i}
(in the previous case the name isw0zy2
).Ignoring certain error messages
When testing TypeScript, it can be helpful to instruct Hephaestus to ignore certain error messages when they come up. For example, in the above image, the comparison
((77.79) !== (70.238))
has resulted in an error:This is working as intended (these two number literals are considered
literal types
in TypeScript), however knowing that this error might come up in a lot of our programs with TypeScript, we might want to tell Hephaestus to ignore this error message and not report the test program as failed.For this, we use the flag
--error-filter-patterns FILE
, where each line in FILE contains a regex pattern that matches the error message we'd like to ignore.For example in my own patterns file, I have the regex
.*This condition will always return.*
to ignore the above error.