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

Task: Generics (part 1) #23

Closed
12 tasks done
AdrianBajraktari opened this issue Dec 10, 2021 · 1 comment · Fixed by #856
Closed
12 tasks done

Task: Generics (part 1) #23

AdrianBajraktari opened this issue Dec 10, 2021 · 1 comment · Fixed by #856
Assignees
Labels
dsl 🗒️ Issues regarding the domain specific programming language enhancement 💡 New feature or request released Included in a release
Milestone

Comments

@AdrianBajraktari
Copy link

AdrianBajraktari commented Dec 10, 2021

Tasks

  • Compute type parameters for NamedType
  • Compute type parameters for List
  • Compute type parameters for Map
  • Update type computation for IndexedAccess
  • Update type checking for index of indexed access on map
  • Add new type "TypeParameterType"
  • Add methods substituteTypeParameters(substitutions: TypeParameterSubstitutions) to all types
  • classTypeIsAssignableTo must handle type parameters (+variance)
  • ClassType.equals needs to check type parameter substitutions
  • ClassType.toString should show type parameter substitutions
  • Type arguments & type parameters should no longer be experimental.
  • IndexedAccess should no longer be experimental
@AdrianBajraktari AdrianBajraktari self-assigned this Dec 10, 2021
@lars-reimann lars-reimann added the enhancement 💡 New feature or request label Dec 17, 2021
@lars-reimann lars-reimann transferred this issue from another repository Jun 7, 2022
@lars-reimann lars-reimann removed the status in Safe-DS Nov 9, 2022
@lars-reimann lars-reimann removed this from Safe-DS Nov 9, 2022
@lars-reimann lars-reimann added the dsl 🗒️ Issues regarding the domain specific programming language label Feb 7, 2023
@lars-reimann lars-reimann moved this to Backlog in DSL Mar 7, 2023
@lars-reimann lars-reimann added this to DSL Mar 7, 2023
lars-reimann added a commit that referenced this issue Oct 9, 2023
Closes #615
Closes #616

### Summary of Changes

Add list and map literals. The computation of the element & key/value
types will happen in a later pull request, together with type
computation of other type parameters
(#23).

This PR also removes `vararg` parameters in favor of a parameter with
list types. This simplifies the graphical view and gets rid of a bunch
of validation rules.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
@lars-reimann lars-reimann added this to the v0.6.0 milestone Nov 24, 2023
@lars-reimann lars-reimann self-assigned this Jan 15, 2024
@lars-reimann lars-reimann moved this from Backlog to Todo in DSL Jan 15, 2024
@lars-reimann lars-reimann linked a pull request Feb 5, 2024 that will close this issue
lars-reimann added a commit that referenced this issue Feb 5, 2024
Closes partially #23

### Summary of Changes

* New kind of type `TypeParameterType` to represent usages of type
parameter references as types.
* Store substitutions for type parameters in `ClassType` and take them
into account for serialization and equality checks.
* Compute element types for list literals.
* Compute key/value types for map literals.
* Compute type of indexed accesses on lists/maps.
* Type checking for the indexed passed to an indexed access on maps (it
already worked for lists).
* Consider type parameter values when checking the assignability of
class types.

### Deferred to future PRs

There are additional features needed to fully handle type parameters,
including

* Inference of type parameter values for calls.
* Substitution of type parameters for types of class members (e.g. for
member access on an attribute).
* Finding the lowest common superclass of class types with type
parameters.

These features will be added later in separate PRs.
lars-reimann added a commit that referenced this issue Feb 6, 2024
…accesses (#859)

Closes partially #23

### Summary of Changes

Let's look at the following example:

```
class C<T> {
    attr member: T
}

segment mySegment(p: C<Int>) {
    val a = p.member;
```

Previously, the type of the placeholder `a` was computed as `T` (type
parameter type). Now, the type parameter substitutions that were
computed for the receiver get applied, so `a` now gets the correct type
`Int`.
@lars-reimann lars-reimann changed the title Task: Generics Task: Generics (part 1) Feb 6, 2024
@lars-reimann
Copy link
Member

I've moved the remaining tasks into separate issues due to their size.

@github-project-automation github-project-automation bot moved this from Todo to ✔️ Done in DSL Feb 6, 2024
@lars-reimann lars-reimann linked a pull request Feb 7, 2024 that will close this issue
lars-reimann pushed a commit that referenced this issue Feb 12, 2024
## [0.7.0](v0.6.0...v0.7.0) (2024-02-12)

### Features

* apply type parameter substitutions of receiver type for member accesses ([#859](#859)) ([5780ed7](5780ed7)), closes [#23](#23)
* check position of usages of variant type parameters ([#852](#852)) ([a2672d7](a2672d7)), closes [#743](#743)
* check whether lower and upper bounds of a type parameter are compatible ([#885](#885)) ([2fc7fe6](2fc7fe6)), closes [#875](#875)
* check whether type parameter bounds are acyclic ([#886](#886)) ([bcf1a4b](bcf1a4b)), closes [#874](#874)
* check whether type parameter bounds are named types ([#878](#878)) ([d8b4168](d8b4168)), closes [#876](#876)
* error if type parameter has multiple lower/upper bounds ([#870](#870)) ([6035b76](6035b76)), closes [#867](#867)
* error if type parameter of class is used in static context ([#830](#830)) ([d5cf420](d5cf420)), closes [#809](#809)
* error if type parameters of functions are variant ([#869](#869)) ([9bf5fec](9bf5fec))
* handle type parameter types in type checker ([#884](#884)) ([6b6f738](6b6f738)), closes [#877](#877)
* handle type parameters (part 1) ([#856](#856)) ([8a35558](8a35558)), closes [#23](#23)
* improve type simplification ([#871](#871)) ([0daafb9](0daafb9))
* Memoization ([#827](#827)) ([d0a6c71](d0a6c71))
* null-safe call & indexed access ([#872](#872)) ([f1420a2](f1420a2)), closes [#857](#857) [#858](#858)
* optional type parameters ([#829](#829)) ([0e9f67a](0e9f67a)), closes [#739](#739)
* optionally generate code without runner integration ([#836](#836)) ([0ed9d6e](0ed9d6e)), closes [#831](#831)
* pre-load all relevant workspace files before executing pipeline ([#822](#822)) ([67ab766](67ab766))
* simplify computed types ([#866](#866)) ([bde3274](bde3274))
* simplify substitutions passed to `computeType` ([#873](#873)) ([aa444d4](aa444d4))
* substitute type parameters when checking assignability of overriding members ([#865](#865)) ([a1f24e0](a1f24e0)), closes [#862](#862)
* substitute type parameters when computing type of inherited members ([#864](#864)) ([33de1e8](33de1e8)), closes [#863](#863)
* support placeholder queries that only request a subset of data ([#826](#826)) ([1e39300](1e39300))
* type casts ([#838](#838)) ([66c3666](66c3666)), closes [#835](#835)

### Bug Fixes

* allow usage of covariant type parameters in own constructor ([#854](#854)) ([4ebae94](4ebae94))
* check for duplicate bounds if type parameters occur as right operand ([#882](#882)) ([8776ce0](8776ce0)), closes [#881](#881)
* generation of static class functions ([#832](#832)) ([57eac45](57eac45))
@lars-reimann lars-reimann added the released Included in a release label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dsl 🗒️ Issues regarding the domain specific programming language enhancement 💡 New feature or request released Included in a release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants