Skip to content
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

feat: generation #634

Merged
merged 64 commits into from
Oct 21, 2023
Merged

feat: generation #634

merged 64 commits into from
Oct 21, 2023

Conversation

WinPlay02
Copy link
Contributor

@WinPlay02 WinPlay02 commented Oct 12, 2023

Closes partially #542

Summary of Changes

  • added an implementation of the generator
  • enabled tests for the generator (and removed the dummy test)
  • fixed an error related to constant expressions of integers being interpreted as floats
  • fixed an error where test files were read in an incorrect order
  • added a generation test for lists and maps
  • removed varargs from existing tests

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Merging #634 (28481d4) into main (fe0c8d5) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              main      #634    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           63        63            
  Lines         8234      8797   +563     
  Branches      1596      1753   +157     
==========================================
+ Hits          8234      8797   +563     
Files Coverage Δ
src/cli/generator.ts 100.00% <100.00%> (ø)
src/language/validation/names.ts 100.00% <100.00%> (ø)
src/language/validation/safe-ds-validator.ts 100.00% <100.00%> (ø)

@github-actions
Copy link

github-actions bot commented Oct 12, 2023

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ REPOSITORY git_diff yes no 0.07s
✅ TYPESCRIPT eslint 12 0 0 5.62s
✅ TYPESCRIPT prettier 12 0 0 1.51s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

feat: wildcard assignments are now removed, if the assignment only contains wildcards

test: enable generation/"member access" test that passes
… information

fix: Temporarily revert loading all documents for tests, as duplicate definitions will occur
…arations/parameter with python name" and enable
… enable (as this will be implemented with memoization)
test: test generation of lists and maps
…tain expressions, use null-assertion instead of null-checking, where null is not possible
@WinPlay02
Copy link
Contributor Author

@lars-reimann There are still some uncovered lines or branches left. They are fallback code (e.g. throwing exceptions for unknown nodes) and should not be hit in the normal code generation flow, and therefore can not be tested with generation tests.
What would you suggest, to solve that problem?

@WinPlay02 WinPlay02 marked this pull request as ready for review October 21, 2023 16:04
@lars-reimann
Copy link
Member

@lars-reimann There are still some uncovered lines or branches left. They are fallback code (e.g. throwing exceptions for unknown nodes) and should not be hit in the normal code generation flow, and therefore can not be tested with generation tests. What would you suggest, to solve that problem?

Add comments to those lines to selectively ignore them for coverage computation:

/* c8 ignore next */
const a = 1;

/* c8 ignore next 2 */
const b = 2;
const c = 3;

/* c8 ignore start */
if (false) {
    // ...
}
/* c8 ignore stop*/

Copy link
Member

@lars-reimann lars-reimann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@lars-reimann lars-reimann merged commit c52b5e6 into main Oct 21, 2023
7 checks passed
@lars-reimann lars-reimann deleted the generation branch October 21, 2023 20:48
lars-reimann pushed a commit that referenced this pull request Oct 25, 2023
## [0.2.0](v0.1.0...v0.2.0) (2023-10-25)

### Features

* `const` modifier to replace `@Constant` annotation ([#618](#618)) ([ea4a9ba](ea4a9ba)), closes [#558](#558)
* allow instance and static members of classes to have the same name ([#583](#583)) ([1b04905](1b04905))
* automatic formatting in Langium ([#526](#526)) ([922af22](922af22)), closes [#31](#31) [#33](#33) [#513](#513) [#433](#433)
* basic implementation of partial evaluator service ([#649](#649)) ([10ed8bf](10ed8bf)), closes [#603](#603)
* built-in library ([#557](#557)) ([7998eb1](7998eb1)), closes [#433](#433)
* check `@PythonName` and `@PythonModule` ([#641](#641)) ([5a9dcbb](5a9dcbb)), closes [#543](#543)
* check context of union types ([#677](#677)) ([e846b59](e846b59)), closes [#675](#675)
* check template expressions inside `@PythonCall` ([#686](#686)) ([09bfb38](09bfb38))
* comment provider ([#688](#688)) ([e4a1b35](e4a1b35)), closes [#669](#669)
* compute types of lambdas that are passed as arguments ([#604](#604)) ([25c8707](25c8707)), closes [#541](#541)
* document symbol provider ([#659](#659)) ([fe0c8d5](fe0c8d5))
* documentation provider ([#689](#689)) ([ff70b07](ff70b07)), closes [#669](#669)
* ensure that all assignees get a value ([#630](#630)) ([e8e2bf6](e8e2bf6)), closes [#543](#543)
* error if @pythonName and @PythonCall are set on a function ([#685](#685)) ([d22c446](d22c446))
* error if argument lists are missing ([#642](#642)) ([f5ee1bd](f5ee1bd)), closes [#543](#543)
* error if class or enum are statically referenced ([#643](#643)) ([8b076e7](8b076e7)), closes [#543](#543)
* error if divisor is zero ([#644](#644)) ([9af3b81](9af3b81)), closes [#543](#543)
* error if function pointers are used ([#629](#629)) ([01933b9](01933b9)), closes [#565](#565) [#543](#543)
* error if lambda is used in wrong context ([#647](#647)) ([2d2ccc6](2d2ccc6)), closes [#409](#409) [#543](#543)
* error if left operand of type parameter constraint does not belong to declaration with constraint ([#571](#571)) ([cba3abf](cba3abf)), closes [#562](#562)
* error if member access must be null safe but isn't ([#626](#626)) ([077daff](077daff)), closes [#543](#543)
* error if names are not unique (part 2) ([#640](#640)) ([38d1181](38d1181)), closes [#543](#543)
* error if pipeline file is in a `safeds.xy` package ([#673](#673)) ([867bae3](867bae3)), closes [#671](#671)
* error if placeholder is alias for parameter or placeholder ([#628](#628)) ([b99ab25](b99ab25)), closes [#564](#564) [#543](#543)
* error if simple names of builtin declarations collide ([#678](#678)) ([275ad5e](275ad5e)), closes [#672](#672)
* error if single use annotations are used multiple times ([#631](#631)) ([17a5b7a](17a5b7a)), closes [#543](#543)
* error if type parameters don't have sufficient context ([#687](#687)) ([ea8fe29](ea8fe29))
* error if value assigned to constant parameters is not constant ([#646](#646)) ([097764d](097764d)), closes [#543](#543)
* error if wildcard import has alias ([#574](#574)) ([4ba7873](4ba7873)), closes [#543](#543)
* extensions for the `NodeMapper` ([#606](#606)) ([4fd8d86](4fd8d86))
* generation ([#634](#634)) ([c52b5e6](c52b5e6)), closes [#542](#542)
* handle backticks surrounding IDs ([#622](#622)) ([608e470](608e470)), closes [#579](#579)
* improved TextMate grammar ([#623](#623)) ([d7ff0e2](d7ff0e2))
* info if elvis operator is unnecessary ([#645](#645)) ([dcc05ce](dcc05ce)), closes [#543](#543)
* info if import alias can be removed ([#637](#637)) ([83936b8](83936b8)), closes [#636](#636)
* inlay hint provider ([#683](#683)) ([f23fa29](f23fa29)), closes [#679](#679)
* intermediate type computer ([#600](#600)) ([8d68a42](8d68a42)), closes [#541](#541)
* Langium grammar ([#470](#470)) ([c439c19](c439c19)), closes [#433](#433)
* list & map literals ([#619](#619)) ([e3b2870](e3b2870)), closes [#615](#615) [#616](#616)
* mark union types as experimental ([#676](#676)) ([4656c25](4656c25)), closes [#674](#674)
* node mapper ([#602](#602)) ([a13e5b5](a13e5b5))
* port additional checks ([#567](#567)) ([2803305](2803305)), closes [#543](#543)
* port additional validation checks to `Langium ([#576](#576)) ([8f5d57a](8f5d57a)), closes [#543](#543)
* port remaining validation infos that don't need partial evaluation ([#607](#607)) ([d53bda3](d53bda3)), closes [#543](#543)
* port validation of parameter lists ([#573](#573)) ([bd73bc5](bd73bc5)), closes [#543](#543)
* Python-like import syntax ([#598](#598)) ([4c61b8c](4c61b8c))
* PythonCall annotation ([#684](#684)) ([15114df](15114df)), closes [#617](#617)
* remove star projection and use-site variance ([#597](#597)) ([928f487](928f487))
* remove type arguments from calls ([#581](#581)) ([3e88f02](3e88f02))
* resolve references to declarations in other files ([#586](#586)) ([6b30de5](6b30de5)), closes [#540](#540)
* scoping for named types ([#563](#563)) ([a877f4c](a877f4c)), closes [#540](#540)
* scoping for own members ([#611](#611)) ([43b276f](43b276f)), closes [#540](#540)
* scoping for references to own static members ([#582](#582)) ([38afc07](38afc07)), closes [#540](#540)
* scoping for type arguments ([#585](#585)) ([3da8dd0](3da8dd0)), closes [#540](#540)
* scoping of annotation calls, type parameter constraints & yields ([#561](#561)) ([a510f2b](a510f2b)), closes [#540](#540)
* scoping of arguments ([#601](#601)) ([6b486cd](6b486cd)), closes [#540](#540)
* scoping of direct references to declarations in same file ([#580](#580)) ([491d7b0](491d7b0)), closes [#540](#540)
* semantic highlighting ([#653](#653)) ([fe8c602](fe8c602)), closes [#27](#27)
* show info if unnecessary syntax is used ([#566](#566)) ([c26d33a](c26d33a)), closes [#543](#543)
* show info that empty constraint lists can be removed ([#572](#572)) ([af13e28](af13e28)), closes [#570](#570)
* stop validation after lexing/parsing errors ([#662](#662)) ([ba1e9a8](ba1e9a8))
* syntax and formatting for literal types ([#529](#529)) ([32aca34](32aca34)), closes [#80](#80)
* syntax highlighting in documentation comments ([#690](#690)) ([83364d3](83364d3)), closes [#669](#669)
* unique names withing declarations ([#575](#575)) ([47ce782](47ce782)), closes [#543](#543)
* validate package of imports ([#627](#627)) ([18641de](18641de)), closes [#543](#543)
* validation for annotation target ([#670](#670)) ([fa7631d](fa7631d)), closes [#543](#543)
* validation for results of segments ([#613](#613)) ([bf20c7c](bf20c7c)), closes [#543](#543)
* validation for type arguments of named types ([#632](#632)) ([b72768c](b72768c)), closes [#543](#543)
* value converter for strings & ints ([#655](#655)) ([aafa2e3](aafa2e3))
* various checks for annotations on parameters and results ([#625](#625)) ([e77037e](e77037e)), closes [#543](#543)
* various checks for argument lists ([#648](#648)) ([d76e597](d76e597)), closes [#543](#543)
* various checks for calls ([#638](#638)) ([e0fa032](e0fa032)), closes [#543](#543)
* various checks related to inheritance ([#633](#633)) ([7ec746a](7ec746a)), closes [#543](#543)
* various features related to literal types ([#657](#657)) ([1775705](1775705)), closes [#80](#80)
* very basic type computer ([#596](#596)) ([b3d786c](b3d786c)), closes [#541](#541)
* warn if deprecated/experimental declarations are used ([#608](#608)) ([9b5287c](9b5287c)), closes [#543](#543) [#540](#540)
* warn if experimental language features are used ([#624](#624)) ([090fcc3](090fcc3)), closes [#108](#108)
* warn if parameters or placeholders are unused ([#612](#612)) ([3a2e9cc](3a2e9cc)), closes [#543](#543)
* warning if literal types or union types have duplicate entries ([#658](#658)) ([9ba9d20](9ba9d20))

### Bug Fixes

* CLI startup ([#560](#560)) ([4bde898](4bde898))
* duplicate error if annotation call has no argument list and lacks required parameters ([#650](#650)) ([4ba2c2c](4ba2c2c))
* mark map literals as experimental ([#656](#656)) ([ca47870](ca47870))
* resolution of references to declarations of wrong node type ([#599](#599)) ([6ae387a](6ae387a))
@lars-reimann
Copy link
Member

🎉 This PR is included in version 0.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Included in a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants