Skip to content

Commit

Permalink
feat: validate impurity reasons of overriding methods (#774)
Browse files Browse the repository at this point in the history
Closes #665

### Summary of Changes

Show an error if the impurity reasons of an overriding method are not a
subset of the impurity reasons of the overridden method.
  • Loading branch information
lars-reimann committed Nov 14, 2023
1 parent 8344356 commit 71fc5bd
Show file tree
Hide file tree
Showing 20 changed files with 539 additions and 186 deletions.
198 changes: 177 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^11.0.0",
"@semantic-release/npm": "^11.0.1",
"@vitest/coverage-v8": "^0.34.6",
"@vitest/ui": "^0.34.6",
"concurrently": "^8.2.2",
"conventional-changelog-conventionalcommits": "^7.0.2",
"esbuild": "^0.19.5",
"esbuild-plugin-copy": "^2.1.1",
"semantic-release": "^22.0.6",
"semantic-release": "^22.0.7",
"shx": "^0.3.4",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"@safe-ds/lang": ">=0.3.0",
"chalk": "^5.3.0",
"commander": "^11.1.0",
"langium": "^2.1.0"
"langium": "^2.1.2"
},
"devDependencies": {
"@types/node": "^18.18.8"
"@types/node": "^18.18.9"
},
"engines": {
"node": ">=18.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-ds-lang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
"dependencies": {
"chevrotain": "^11.0.3",
"glob": "^10.3.10",
"langium": "^2.1.0",
"langium": "^2.1.2",
"source-map": "^0.7.4",
"vscode-languageserver": "^9.0.1",
"vscode-languageserver-textdocument": "^1.0.11"
},
"devDependencies": {
"@types/node": "^18.18.8",
"@types/node": "^18.18.9",
"langium-cli": "^2.1.0",
"true-myth": "^7.1.0"
},
Expand Down
19 changes: 19 additions & 0 deletions packages/safe-ds-lang/src/helpers/collectionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ export const isEmpty = (iterable: Iterable<unknown>): boolean => {
return iterable[Symbol.iterator]().next().done === true;
};

/**
* Returns whether `set1` and `set2` contain the same values.
*/
export const isEqualSet = <T>(set1: Set<T>, set2: Set<T>): boolean => {
return set1.size === set2.size && isSubset(set1, set2);
};

/**
* Returns whether `set1` is a subset of `set2`.
*/
export const isSubset = <T>(set1: Set<T>, set2: Set<T>): boolean => {
for (const value of set1) {
if (!set2.has(value)) {
return false;
}
}
return true;
};

/**
* Returns the last element of the array, or `undefined` if the array is empty.
*/
Expand Down
Loading

0 comments on commit 71fc5bd

Please sign in to comment.