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 validation to Langium #543

Closed
73 tasks done
Tracked by #433
lars-reimann opened this issue Aug 4, 2023 · 1 comment · Fixed by #670
Closed
73 tasks done
Tracked by #433

Port validation to Langium #543

lars-reimann opened this issue Aug 4, 2023 · 1 comment · Fixed by #670
Assignees
Labels
released Included in a release validation ✔️ Improved or new static checks

Comments

@lars-reimann
Copy link
Member

lars-reimann commented Aug 4, 2023

Infos

Unnecessary syntax

  • UnnecessaryAssignment
  • UnnecessaryArgumentList
  • UnnecessaryBody
  • UnnecessarySafeAccess
  • UnnecessaryParameterList
  • UnnecessaryResultList
  • UnnecessaryTypeArgumentList
  • UnnecessaryTypeParameterList
  • UnnecessaryUnionType
  • UnnecessaryElvisOperator (needs partial evaluation)

Annotations

  • IdenticalPythonModule (needs partial evaluation)
  • IdenticalPythonName (needs partial evaluation)

Warnings

Deprecation

  • AssignedDeclarationIsDeprecated
  • CorrespondingParameterIsDeprecated
  • CalledAnnotationIsDeprecated
  • ReferencedDeclarationIsDeprecated

Experimental

  • AssignedDeclarationIsExperimental
  • CorrespondingParameterIsExperimental
  • CalledAnnotationIsExperimental
  • ReferencedDeclarationIsExperimental

Name conventions

  • NameShouldBeLowerCamelCase
  • NameShouldBeUpperCamelCase
  • SegmentsShouldBeLowerCamelCase

Unused declarations

  • UnusedParameter
  • UnusedPlaceholder

Other

  • ImplicitlyIgnoredResultOfCall
  • PlaceholderIsRenamingOfDeclaration (becomes error)
  • DuplicateTarget (needs partial evaluation)

Errors

  • AttributeMustHaveType
  • ParameterMustHaveType
  • ResultMustHaveType
  • FileMustDeclarePackage
  • StubFileMustNotDeclarePipelinesSchemasOrSteps
  • PipelineFileMustOnlyDeclarePipelinesAndSteps
  • DEPRECATED_REQUIRED_PARAMETER
  • WILDCARD_IMPORT_WITH_ALIAS
  • NoRequiredParametersAfterFirstOptionalParameter
  • NoYieldInPipeline
  • NO_POSITIONAL_ARGUMENTS_AFTER_FIRST_NAMED_ARGUMENT
  • NO_POSITIONAL_TYPE_ARGUMENTS_AFTER_FIRST_NAMED_TYPE_ARGUMENT
  • UNION_TYPE_WITHOUT_TYPE_ARGUMENTS
  • MissingTemplateExpression
  • UnassignedResult
  • DuplicateResultAssignment
  • NoOptionalParametersInCallableType
  • BlockLambdaPrefix
  • ExpertMustBeOptional
  • MissingSafeAccess
  • UNRESOLVED_IMPORTED_NAMESPACE
  • INSTANCE_METHOD_MUST_BE_CALLED
  • ASSIGNEE_WITHOUT_VALUE
  • ANNOTATION_IS_SINGLE_USE
  • TooManyTypeArguments
  • MISSING_TYPE_ARGUMENT_LIST
  • MISSING_REQUIRED_TYPE_PARAMETER
  • UniqueTypeParameters
  • CLASS_MUST_INHERIT_ONLY_CLASSES
  • CLASS_MUST_NOT_BE_SUBTYPE_OF_ITSELF
  • RECEIVER_MUST_BE_CALLABLE
  • CALLED_CLASS_MUST_HAVE_CONSTRUCTOR
  • REDECLARATION
  • REDECLARATION_IN_OTHER_FILE
  • MISSING_ARGUMENT_LIST (for annotations)
  • ENUM_VARIANT_MUST_BE_INSTANTIATED
  • MustNotStaticallyReferenceEnum (must be used in member access)
  • MustNotStaticallyReferenceClass (must be used in member access/instantiated - if it has constructor)
  • DivisionByZero (needs partial evaluation)
  • MustBeConstant (needs partial evaluation)
  • LambdaMustBeTypedArgumentOrYielded (Allow lambdas only as arguments or default values of parameters #409)
  • UNIQUE_PARAMETERS
  • TOO_MANY_ARGUMENTS
  • MISSING_REQUIRED_PARAMETER
  • WRONG_TARGET (needs partial evaluation)
@lars-reimann lars-reimann mentioned this issue Aug 4, 2023
8 tasks
@lars-reimann lars-reimann changed the title Port validation Port validation to Langium Aug 4, 2023
lars-reimann added a commit that referenced this issue Sep 7, 2023
Closes partially #543.
Closes partially #433.

### Summary of Changes

* Port the data-driven framework for validation tests from the old Xtext
implementation to Langium.
* Document how to write validation tests.

---------

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

### Summary of Changes

Show an info if one of the following can be removed:
* assignment (only wildcards as assignees)
* body of class/enum
* parameter list of annotation/enum variant
* result list of function/segment
* type parameter list of class/enum variant/function
* union type (singular type argument)

---------

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

### Summary of Changes

Port additional checks from old Xtext version:
* Template string without expression between string parts
* Yield in pipeline
* Missing type hints
* Missing package in module with declarations
* Declarations in module that are not allowed by the file type

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
@lars-reimann lars-reimann added the validation ✔️ Improved or new static checks label Sep 20, 2023
lars-reimann added a commit that referenced this issue Sep 21, 2023
Closes partially #543.

### Summary of Changes

Show an error if a parameter list:
* has more parameters after a variadic one,
* has optional parameters and a variadic one, or
* has required parameters after optional ones.
lars-reimann added a commit that referenced this issue Sep 21, 2023
Closes partially #543

### Summary of Changes

Show an error if a wildcard import has an alias.

---------

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

### Summary of Changes

Ensure that names are unique within declarations. I'll port the checks
for uniqueness on the file level in a future PR.

---------

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

### Summary of Changes

Show an error if:
* A union type has no type arguments
* A callable type has optional parameters
* Positional type arguments occur after named type arguments
* Positional arguments occur after named arguments
* A parameter is variadic and optional

---------

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

Closes partially #543.

### Summary of Changes

Show an info if
* an argument list can be removed,
* a type argument list can be removed,
* a safe access can be removed.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
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 8, 2023
Closes partially #543

### Summary of Changes

Show a warning if a parameter or placeholder is unused and suggest
removing it.

---------

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

### Summary of Changes

Ensure that a segment yields exactly one value for each result.

---------

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

### Summary of Changes

* Annotations must not be used on parameters of callable types
* Annotations must not be used on results of callable types
* Annotations must not be used on parameters of lambdas
* `@Deprecated` must not be used on required parameters
* `@Expert` must not be used on required parameters
lars-reimann added a commit that referenced this issue Oct 10, 2023
Closes partially #543

### Summary of Changes

* If a member access is not null safe, but the receiver is nullable, an
error is shown now.
* The scope provider is now more relaxed and points to the correct class
members, even if the member access is missing null safety.

---------

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

### Summary of Changes

Show an error if
* the entire type argument list is missing
* a type argument is missing
* a type parameter is set multiple times
* too many type arguments are given.

---------

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

### Summary of Changes

Show an error if a class
* inherits from multiple types,
* inherits from something that is not a class, or
* inherits from itself.

---------

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

### Summary of Changes

* Warn if results of a call are ignored implicitly in an assignment
* Error if receiver of a call is not callable
* Error if receiver of a call points to a class without a constructor

---------

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

### Summary of Changes

Show an error if
* module members in the same file have duplicate names,
* module members in the same package, but different files have duplicate
names,
* schema columns have duplicate names.

---------

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

### Summary of Changes

Show an info if
* `@PythonName` is identical to the Safe-DS name of a declaration,
* `@PythonModule` is identical to the Safe-DS package.

In those cases, the annotations could be removed.

---------

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

### Summary of Changes

Show an error if
* an annotation call is missing an argument list,
* a reference to an enum variant is missing an argument list.

---------

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

### Summary of Changes

Show an error if a class or enum is statically referenced. They must
only be referenced to access one of their members/variants or to call
them¹.

-----

¹ If they are not callable, we already show another error.

---------

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

### Summary of Changes

Show an error if we know that the divisor of a division is zero. Once
the partial evaluator gets fully implemented, this will work in more
cases.

---------

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

### Summary of Changes

Show an info if an elvis operator can be removed.

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Oct 17, 2023
…646)

Closes partially #543

### Summary of Changes

Show an error if default values of constant parameters or arguments
assigned to constant parameters are not constant.

---------

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

### Summary of Changes

Show an error if a lambda is used in the wrong context. They must be
assigned to a type parameter, either as its default value or an
argument.

---------

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

### Summary of Changes

Show an error if an argument list of an annotation call or a call
* does not set required parameters,
* sets a parameter multiple times,
* passes too many arguments.

---------

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

### Summary of Changes

* Show an error if an annotation is called on an incorrect target
* Show a warning if the target list of an annotation has duplicate
entries
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
Copy link
Member Author

🎉 This issue has been resolved 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 validation ✔️ Improved or new static checks
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant