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

Port scoping to Langium #540

Closed
68 tasks done
Tracked by #433
lars-reimann opened this issue Aug 4, 2023 · 0 comments · Fixed by #708
Closed
68 tasks done
Tracked by #433

Port scoping to Langium #540

lars-reimann opened this issue Aug 4, 2023 · 0 comments · Fixed by #708
Assignees
Labels
released Included in a release

Comments

@lars-reimann
Copy link
Member

lars-reimann commented Aug 4, 2023

  • Data-driven test system (test: data-driven scope testing #546)
    • Specify source and target using comments (link them using a common name) and test markers
    • Ability to load multiple files at once
    • Ability to test that some cross-references cannot be resolved
    • Document how to add more tests
  • Scoping for imports
    • Qualified imports
    • Qualified import with alias
    • Wildcard imports
    • Default import of safeds.**.*
    • Default import of everything in same package
    • Explicit import shadows implicit import of declaration in same package
    • Declaration in own file shadows implicit import of safeds declarations
    • Declaration in own file shadows implicit import of declaration in same package
    • Declaration in own file shadows explicit import (?)
  • Scoping for annotation calls
    • Annotations in other files
  • Scoping for type parameter constraints
    • Target: Type parameter of class
    • Target: Type parameter of enum variant
    • Target: Type parameter of function
    • Enables references to type parameters of outer layers
  • Scoping for yield
  • Scoping for arguments
    • Arguments of calls
    • Arguments of annotation calls
  • Scoping for references
    • Target: Local variable
      • Prevent forward references to local variables
      • Enable closures (access to local variables of outer layers)
    • Target: Parameter
      • Enable closures (access to parameters of outer layers)
    • Target: Class
    • Target: Enum
    • Target: Global function
    • Target: Schema
    • Target: Pipeline
    • Target: Segment
      • Take visibility modifiers into account
    • Target: Instance attribute
    • Target: Static attribute
    • Target: Nested class (in another class)
    • Target: Nested enum (in another class)
    • Target: Instance method
    • Target: Static method
    • Target: Result
    • Target: Enum variant
    • Target: Parameter of enum variant
    • Target: Members of containing class from default value (?)
    • Target: Containing classes from default value (?)
    • Target: Members of containing class from annotation call argument (?)
    • Target: Containing classes from annotation call argument (?)
    • Target: Previous parameter from default value (?)
    • Prevent references to following parameters from default values: fun f(p: Int = q, q: Int = p)
    • Prevent references to type parameters
    • Inheritance
    • Overriding
    • Shadowing
    • Hiding of static members
  • Scoping for named types
    • Target: Class
    • Target: Enum
    • Target: Enum variant
    • Target: Type parameter
    • In parent type lists + Test scoping within class #29
    • Named type declarations in other files
  • Scoping for type arguments
    • Type arguments of named type
@lars-reimann lars-reimann mentioned this issue Aug 4, 2023
8 tasks
@lars-reimann lars-reimann changed the title Port scoping Port scoping to Langium Aug 4, 2023
@lars-reimann lars-reimann self-assigned this Aug 4, 2023
lars-reimann added a commit that referenced this issue Aug 9, 2023
Closes partially #540.

### Summary of Changes

* Data-driven creation of scope tests
* Clean up of creation of grammar and formatter tests

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Sep 18, 2023
#561)

Closes partially #540

### Summary of Changes

* Implement scoping for
  * annotation calls (_annotation_)
  * type parameter constraints (_left operand_) 
  * yields (_result_)
lars-reimann added a commit that referenced this issue Sep 19, 2023
Closes partially #540

### Summary of Changes

* Implement scoping for named types

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Sep 28, 2023
Closes partially #540

### Summary of Changes

Resolve the target of references if
* it is in the same file as the declaration
* the reference is not the member of a member access.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Sep 29, 2023
Closes partially #540

### Summary of Changes

Member accesses to
* own static attributes,
* own nested classes,
* own nested enums,
* own static methods,
* enum variants

are now resolved properly.
lars-reimann added a commit that referenced this issue Sep 30, 2023
Closes #29
Closes partially #540

### Summary of Changes

Test that containing classes can be referenced from the parent type
list.
lars-reimann added a commit that referenced this issue Sep 30, 2023
Closes partially #540

### Summary of Changes

Implement scoping rules for the `typeParameter` property of a type
argument.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Sep 30, 2023
Closes partially #540

### Summary of Changes

References to declarations in other files now get resolved properly if
they
1. are explicitly imported,
2. reside in the same package,
3. are part of the builtin library.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Oct 1, 2023
…her files (#587)

Closes partially #540

### Summary of Changes

Add tests to ensure that annotation calls and named types can reference
declarations in other files. No changes to the implementation of the
scope provider were needed.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Oct 5, 2023
Closes partially #540.

### Summary of Changes

Named arguments now correctly point to their corresponding parameter.
lars-reimann added a commit that referenced this issue Oct 6, 2023
Closes partially #543
Closes partially #540

### Summary of Changes

Show a warning if deprecated or experimental declarations are used. To
implement this, I've also added scoping for member accesses to results.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Oct 7, 2023
Closes partially #540

### Summary of Changes

Implement scoping for own instance members, namely to
* instance attributes of classes,
* instance methods of classes,
* parameters of enum variants.
lars-reimann pushed a commit that referenced this issue 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 added a commit that referenced this issue Oct 30, 2023
Closes #540

### Summary of Changes

Implement reference resolution to inherited class members.
@lars-reimann lars-reimann reopened this Oct 30, 2023
lars-reimann added a commit that referenced this issue Oct 30, 2023
…707)

Closes partially #540

### Summary of Changes

References to parameters that are defined later in the parameter list
are no longer resolved from default values. Example:

```txt
fun f(p: Int = q, q: Int = p)
```

The reference to `q` does not get resolved anymore. The reference to `p`
is still possible.
lars-reimann added a commit that referenced this issue Oct 30, 2023
Closes #540

### Summary of Changes

Implement the same scoping rules for references to containing
declarations as for named types.
lars-reimann pushed a commit that referenced this issue Nov 12, 2023
## [0.3.0](v0.2.0...v0.3.0) (2023-11-12)

### Features

* annotations for the purity of functions ([#709](#709)) ([9d342e4](9d342e4)), closes [#559](#559)
* call hierarchy provider ([#735](#735)) ([168d098](168d098)), closes [#680](#680)
* compute type of elvis operators with nullable left operand ([#715](#715)) ([376b083](376b083)), closes [#541](#541)
* customize rendering of `[@param](https://github.com/param)`, `[@Result](https://github.com/result)`, and `[@type](https://github.com/type)Param` tags ([#764](#764)) ([e049148](e049148)), closes [#669](#669)
* ensure an overriding member matches the overridden one ([#758](#758)) ([a698a6a](a698a6a)), closes [#639](#639)
* error if callable type is used in wrong context ([#763](#763)) ([9b1522f](9b1522f)), closes [#713](#713)
* error if type parameter is used in nested named type declaration ([#750](#750)) ([52374aa](52374aa)), closes [#748](#748)
* info if overriding member is not needed ([#759](#759)) ([23b340e](23b340e)), closes [#25](#25)
* mark constraint lists as experimental ([#752](#752)) ([d48e1e0](d48e1e0)), closes [#18](#18)
* mark type parameter lists and type argument lists as experimental ([#755](#755)) ([f1a052a](f1a052a)), closes [#753](#753)
* mark unused internal/private segments as unnecessary ([#710](#710)) ([3ba8698](3ba8698)), closes [#682](#682)
* minor improvements for purity info ([#728](#728)) ([8d59607](8d59607))
* partially evaluate lambdas and segments ([#734](#734)) ([c40347c](c40347c)), closes [#603](#603)
* scoping for inherited members ([#706](#706)) ([4518aee](4518aee)), closes [#540](#540)
* scoping for member access on literals and literal types ([#754](#754)) ([e60e456](e60e456)), closes [#80](#80)
* scoping for references to containing declarations ([#708](#708)) ([3762c36](3762c36)), closes [#540](#540)
* show an error if a pure parameter does not have a callable type ([#736](#736)) ([6c52868](6c52868)), closes [#729](#729)
* show error if own declaration has same name as core one ([#762](#762)) ([8cb2120](8cb2120)), closes [#760](#760)
* signature help ([#724](#724)) ([ed33676](ed33676)), closes [#24](#24)
* Source Maps for Code Generation ([#714](#714)) ([64b9e07](64b9e07)), closes [#30](#30)
* tooltips for inlay hints ([#721](#721)) ([3e71cad](3e71cad))
* type checker service ([#722](#722)) ([daad5c4](daad5c4)), closes [#666](#666)
* type checking ([#723](#723)) ([a9eb3bb](a9eb3bb)), closes [#666](#666)
* type checking for list & map literals ([#751](#751)) ([dc14223](dc14223)), closes [#712](#712)
* type hierarchy provider ([#737](#737)) ([9fd5f0c](9fd5f0c)), closes [#681](#681)
* VS Code snippets ([#757](#757)) ([fd6f432](fd6f432)), closes [#756](#756)

### Bug Fixes

* assignability of static type to callable type ([#725](#725)) ([1d17900](1d17900))
* NPEs during validation ([#727](#727)) ([4b8196f](4b8196f))
* prevent overwriting core declarations ([#761](#761)) ([36663ca](36663ca))
* prevent references to following parameters from default values ([#707](#707)) ([182d64b](182d64b)), closes [#540](#540)
* setup of CLI ([#698](#698)) ([0b5d90d](0b5d90d))
@lars-reimann lars-reimann added the released Included in a release label Nov 12, 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
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant