diff --git a/.eslintignore b/.eslintignore index 07d3b29d5..604da79e9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,3 +2,6 @@ build/ dist/ out/ + +# DSL +/DSL/vitest.config.ts diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 168b990cb..99a5bbd67 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,12 +22,8 @@ updates: interval: 'monthly' # DSL - - package-ecosystem: 'gradle' - directory: '/DSL' - schedule: - interval: 'monthly' - package-ecosystem: 'npm' - directory: '/DSL/com.larsreimann.safeds.vscode' + directory: '/DSL' schedule: interval: 'monthly' diff --git a/.github/linters/.ruff.toml b/.github/linters/.ruff.toml index 10aeeccbd..03b79e181 100644 --- a/.github/linters/.ruff.toml +++ b/.github/linters/.ruff.toml @@ -61,6 +61,8 @@ ignore = [ "FBT002", # builtin-attribute-shadowing (not an issue) "A003", + # implicit-return (can add a return even though all cases are covered) + "RET503", # superfluous-else-return (sometimes it's more readable) "RET505", # superfluous-else-raise (sometimes it's more readable) diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml index 88633b43d..4663ee31c 100644 --- a/.github/workflows/issue.yml +++ b/.github/workflows/issue.yml @@ -9,7 +9,7 @@ jobs: add-to-project: runs-on: ubuntu-latest steps: - - uses: actions/add-to-project@v0.4.1 + - uses: actions/add-to-project@v0.5.0 with: project-url: https://github.com/orgs/Safe-DS/projects/3 github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 023dd7e33..fac62da7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,40 +4,47 @@ on: branches: [ main ] jobs: - # Build and test DSL component + # Build and test the DSL component build-dsl: runs-on: ubuntu-latest defaults: run: working-directory: ./DSL + strategy: matrix: - java-version: [ 17 ] + node-version: [ 18.x ] steps: - - name: Checkout repository + - name: Checkout source uses: actions/checkout@v3 - - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 with: - distribution: adopt - java-version: ${{ matrix.java-version }} - cache: gradle + node-version: ${{ matrix.node-version }} + cache: npm + cache-dependency-path: DSL/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Generate Langium files + run: npm run langium:generate - # See https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 + - name: Compile TypeScript + run: npm run build - - name: Test with Gradle - run: ./gradlew check koverMergedXmlReport + - name: Test with Vitest + run: npm run test-with-coverage - name: Upload coverage to Codecov + if: ${{ github.actor != 'dependabot[bot]' }} uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - directory: DSL/build/reports/kover/merged/xml - files: report.xml + directory: DSL/coverage + files: coverage-final.json # Build and test Runner component build-runner: @@ -54,39 +61,3 @@ jobs: coverage: ${{ matrix.python-version == '3.10' }} secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - # Build and test the DSL port to Langium - build-dsl-langium: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./DSL-langium - - strategy: - matrix: - node-version: [ 18.x ] - - steps: - - name: Checkout source - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: npm - cache-dependency-path: DSL-langium/package-lock.json - - - name: Install dependencies - run: npm ci - - - name: Test with Vitest - run: npm run test-with-coverage - - - name: Upload coverage to Codecov - if: ${{ github.actor != 'dependabot[bot]' }} - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - directory: DSL-langium/coverage - files: clover.xml diff --git a/.github/workflows/megalinter.yml b/.github/workflows/megalinter.yml index 9c004b9a8..599a7e878 100644 --- a/.github/workflows/megalinter.yml +++ b/.github/workflows/megalinter.yml @@ -2,10 +2,14 @@ name: MegaLinter on: pull_request: - branches: [main] + branches: [ main ] jobs: megalinter: uses: lars-reimann/.github/.github/workflows/megalinter-reusable.yml@main + permissions: + contents: write + issues: write + pull-requests: write secrets: PAT: ${{ secrets.PAT }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 57566472f..9b23dea8a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,45 +15,41 @@ jobs: defaults: run: working-directory: ./DSL + strategy: matrix: - java-version: [17] + node-version: [ 18.x ] steps: - - name: Checkout repository + - name: Checkout source uses: actions/checkout@v3 - - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 with: - distribution: adopt - java-version: ${{ matrix.java-version }} - cache: gradle + node-version: ${{ matrix.node-version }} + cache: npm + cache-dependency-path: DSL/package-lock.json - # See https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 + - name: Install dependencies + run: npm ci - - name: Test with Gradle - run: ./gradlew build koverMergedXmlReport + - name: Generate Langium files + run: npm run langium:generate - - name: Upload test report - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: Test report - # upload-artifact does not use working-directory - path: | - DSL/com.larsreimann.safeds/build/reports/tests/test/ - DSL/com.larsreimann.safeds.ide/build/reports/tests/test/ + - name: Compile TypeScript + run: npm run build + + - name: Test with Vitest + run: npm run test-with-coverage - name: Upload coverage to Codecov if: ${{ github.actor != 'dependabot[bot]' }} uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - directory: DSL/build/reports/kover/merged/xml - files: report.xml + directory: DSL/coverage + files: coverage-final.json # Build and test Runner component build-runner: @@ -70,39 +66,3 @@ jobs: coverage: ${{ matrix.python-version == '3.10' }} secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - # Build and test the DSL port to Langium - build-dsl-langium: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./DSL-langium - - strategy: - matrix: - node-version: [ 18.x ] - - steps: - - name: Checkout source - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: npm - cache-dependency-path: DSL-langium/package-lock.json - - - name: Install dependencies - run: npm ci - - - name: Test with Vitest - run: npm run test-with-coverage - - - name: Upload coverage to Codecov - if: ${{ github.actor != 'dependabot[bot]' }} - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - directory: DSL-langium/coverage - files: clover.xml diff --git a/.gitignore b/.gitignore index 37c62f0e1..3d5006540 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,3 @@ -# Eclipse (also used by Gradle support in VS Code) -.settings/ -.classpath -.project - # IntelliJ .idea/ *.iml @@ -12,16 +7,13 @@ # Compilation/build outputs /DSL/**/bin/ -/DSL-langium/**/generated/ +/DSL/**/generated/ build/ coverage/ dist/ dist-ssr/ out/ -# Gradle -.gradle/ - # Node .npm/ node_modules/ @@ -48,5 +40,5 @@ report/ megalinter-reports/ # Other -.DS_Store/ +.DS_Store *.log diff --git a/.mega-linter.yml b/.mega-linter.yml index c972ee65f..941ca1fcb 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -3,7 +3,7 @@ EXTENDS: https://raw.githubusercontent.com/lars-reimann/.github/main/.mega-linter.yml # Config -FILTER_REGEX_EXCLUDE: (\.github/workflows/|DSL/com\.larsreimann\.safeds/src/test/resources/|mkdocs.yml) +FILTER_REGEX_EXCLUDE: (\.github/workflows/|DSL/syntaxes/|DSL/tests/resources/|mkdocs.yml) # Workaround to also run prettier on other supported file types. We deactivate it for Markdown compared to the extended # configuration since it breaks admonitions of Material for MkDocs. @@ -17,5 +17,4 @@ JSON_PRETTIER_FILE_EXTENSIONS: # Commands PRE_COMMANDS: - - command: npm install @lars-reimann/eslint-config @lars-reimann/prettier-config - cwd: workspace + - command: npm i @lars-reimann/eslint-config @lars-reimann/prettier-config diff --git a/DSL-langium/bin/cli b/DSL-langium/bin/cli deleted file mode 100644 index f0a525864..000000000 --- a/DSL-langium/bin/cli +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node - -require("../out/cli").default(); \ No newline at end of file diff --git a/DSL-langium/language-configuration.json b/DSL-langium/language-configuration.json deleted file mode 100644 index b5e3d7dc2..000000000 --- a/DSL-langium/language-configuration.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "comments": { - "lineComment": "//", - "blockComment": ["/*", "*/"] - }, - "brackets": [ - ["{", "}"], - ["[", "]"], - ["(", ")"] - ], - "autoClosingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""], - ["'", "'"] - ], - "surroundingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""], - ["'", "'"] - ] -} diff --git a/DSL-langium/package-lock.json b/DSL-langium/package-lock.json deleted file mode 100644 index 3bef1d241..000000000 --- a/DSL-langium/package-lock.json +++ /dev/null @@ -1,2336 +0,0 @@ -{ - "name": "safe-ds", - "version": "0.0.1", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "safe-ds", - "version": "0.0.1", - "dependencies": { - "chalk": "~4.1.2", - "chevrotain": "~10.4.2", - "commander": "~10.0.0", - "glob": "^9.3.4", - "langium": "~1.1.0", - "radash": "^10.8.1", - "true-myth": "^6.2.0", - "vscode-languageclient": "~8.0.2", - "vscode-languageserver": "~8.0.2", - "vscode-uri": "~3.0.7" - }, - "bin": { - "safe-ds-cli": "bin/cli" - }, - "devDependencies": { - "@types/node": "~16.18.11", - "@types/vscode": "~1.67.0", - "@vitest/coverage-c8": "^0.29.8", - "langium-cli": "~1.1.0", - "typescript": "~4.9.5", - "vitest": "^0.29.8" - }, - "engines": { - "vscode": "^1.67.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "node_modules/@chevrotain/cst-dts-gen": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.4.2.tgz", - "integrity": "sha512-0+4bNjlndNWMoVLH/+y4uHnf6GrTipsC+YTppJxelVJo+xeRVQ0s2PpkdDCVTsu7efyj+8r1gFiwVXsp6JZ0iQ==", - "dependencies": { - "@chevrotain/gast": "10.4.2", - "@chevrotain/types": "10.4.2", - "lodash": "4.17.21" - } - }, - "node_modules/@chevrotain/gast": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-10.4.2.tgz", - "integrity": "sha512-4ZAn8/mjkmYonilSJ60gGj1tAF0cVWYUMlIGA0e4ATAc3a648aCnvpBw7zlPHDQjFp50XC13iyWEgWAKiRKTOA==", - "dependencies": { - "@chevrotain/types": "10.4.2", - "lodash": "4.17.21" - } - }, - "node_modules/@chevrotain/types": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-10.4.2.tgz", - "integrity": "sha512-QzSCjg6G4MvIoLeIgOiMR0IgzkGEQqrNJJIr3T5ETRa7l4Av4AMIiEctV99mvDr57iXwwk0/kr3RJxiU36Nevw==" - }, - "node_modules/@chevrotain/utils": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-10.4.2.tgz", - "integrity": "sha512-V34dacxWLwKcvcy32dx96ADJVdB7kOJLm7LyBkBQw5u5HC9WdEFw2G17zml+U3ivavGTrGPJHl8o9/UJm0PlUw==" - }, - "node_modules/@esbuild/android-arm": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.15.tgz", - "integrity": "sha512-sRSOVlLawAktpMvDyJIkdLI/c/kdRTOqo8t6ImVxg8yT7LQDUYV5Rp2FKeEosLr6ZCja9UjYAzyRSxGteSJPYg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.15.tgz", - "integrity": "sha512-0kOB6Y7Br3KDVgHeg8PRcvfLkq+AccreK///B4Z6fNZGr/tNHX0z2VywCc7PTeWp+bPvjA5WMvNXltHw5QjAIA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.15.tgz", - "integrity": "sha512-MzDqnNajQZ63YkaUWVl9uuhcWyEyh69HGpMIrf+acR4otMkfLJ4sUCxqwbCyPGicE9dVlrysI3lMcDBjGiBBcQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.15.tgz", - "integrity": "sha512-7siLjBc88Z4+6qkMDxPT2juf2e8SJxmsbNVKFY2ifWCDT72v5YJz9arlvBw5oB4W/e61H1+HDB/jnu8nNg0rLA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.15.tgz", - "integrity": "sha512-NbImBas2rXwYI52BOKTW342Tm3LTeVlaOQ4QPZ7XuWNKiO226DisFk/RyPk3T0CKZkKMuU69yOvlapJEmax7cg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.15.tgz", - "integrity": "sha512-Xk9xMDjBVG6CfgoqlVczHAdJnCs0/oeFOspFap5NkYAmRCT2qTn1vJWA2f419iMtsHSLm+O8B6SLV/HlY5cYKg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.15.tgz", - "integrity": "sha512-3TWAnnEOdclvb2pnfsTWtdwthPfOz7qAfcwDLcfZyGJwm1SRZIMOeB5FODVhnM93mFSPsHB9b/PmxNNbSnd0RQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.15.tgz", - "integrity": "sha512-MLTgiXWEMAMr8nmS9Gigx43zPRmEfeBfGCwxFQEMgJ5MC53QKajaclW6XDPjwJvhbebv+RzK05TQjvH3/aM4Xw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.15.tgz", - "integrity": "sha512-T0MVnYw9KT6b83/SqyznTs/3Jg2ODWrZfNccg11XjDehIved2oQfrX/wVuev9N936BpMRaTR9I1J0tdGgUgpJA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.15.tgz", - "integrity": "sha512-wp02sHs015T23zsQtU4Cj57WiteiuASHlD7rXjKUyAGYzlOKDAjqK6bk5dMi2QEl/KVOcsjwL36kD+WW7vJt8Q==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.15.tgz", - "integrity": "sha512-k7FsUJjGGSxwnBmMh8d7IbObWu+sF/qbwc+xKZkBe/lTAF16RqxRCnNHA7QTd3oS2AfGBAnHlXL67shV5bBThQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.15.tgz", - "integrity": "sha512-ZLWk6czDdog+Q9kE/Jfbilu24vEe/iW/Sj2d8EVsmiixQ1rM2RKH2n36qfxK4e8tVcaXkvuV3mU5zTZviE+NVQ==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.15.tgz", - "integrity": "sha512-mY6dPkIRAiFHRsGfOYZC8Q9rmr8vOBZBme0/j15zFUKM99d4ILY4WpOC7i/LqoY+RE7KaMaSfvY8CqjJtuO4xg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.15.tgz", - "integrity": "sha512-EcyUtxffdDtWjjwIH8sKzpDRLcVtqANooMNASO59y+xmqqRYBBM7xVLQhqF7nksIbm2yHABptoioS9RAbVMWVA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.15.tgz", - "integrity": "sha512-BuS6Jx/ezxFuHxgsfvz7T4g4YlVrmCmg7UAwboeyNNg0OzNzKsIZXpr3Sb/ZREDXWgt48RO4UQRDBxJN3B9Rbg==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.15.tgz", - "integrity": "sha512-JsdS0EgEViwuKsw5tiJQo9UdQdUJYuB+Mf6HxtJSPN35vez1hlrNb1KajvKWF5Sa35j17+rW1ECEO9iNrIXbNg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.15.tgz", - "integrity": "sha512-R6fKjtUysYGym6uXf6qyNephVUQAGtf3n2RCsOST/neIwPqRWcnc3ogcielOd6pT+J0RDR1RGcy0ZY7d3uHVLA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.15.tgz", - "integrity": "sha512-mVD4PGc26b8PI60QaPUltYKeSX0wxuy0AltC+WCTFwvKCq2+OgLP4+fFd+hZXzO2xW1HPKcytZBdjqL6FQFa7w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.15.tgz", - "integrity": "sha512-U6tYPovOkw3459t2CBwGcFYfFRjivcJJc1WC8Q3funIwX8x4fP+R6xL/QuTPNGOblbq/EUDxj9GU+dWKX0oWlQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.15.tgz", - "integrity": "sha512-W+Z5F++wgKAleDABemiyXVnzXgvRFs+GVKThSI+mGgleLWluv0D7Diz4oQpgdpNzh4i2nNDzQtWbjJiqutRp6Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.15.tgz", - "integrity": "sha512-Muz/+uGgheShKGqSVS1KsHtCyEzcdOn/W/Xbh6H91Etm+wiIfwZaBn1W58MeGtfI8WA961YMHFYTthBdQs4t+w==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.15.tgz", - "integrity": "sha512-DjDa9ywLUUmjhV2Y9wUTIF+1XsmuFGvZoCmOWkli1XcNAh5t25cc7fgsCx4Zi/Uurep3TTLyDiKATgGEg61pkA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, - "node_modules/@types/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", - "dev": true - }, - "node_modules/@types/chai-subset": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", - "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", - "dev": true, - "dependencies": { - "@types/chai": "*" - } - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true - }, - "node_modules/@types/node": { - "version": "16.18.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", - "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==", - "dev": true - }, - "node_modules/@types/vscode": { - "version": "1.67.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.67.0.tgz", - "integrity": "sha512-GH8BDf8cw9AC9080uneJfulhSa7KHSMI2s/CyKePXoGNos9J486w2V4YKoeNUqIEkW4hKoEAWp6/cXTwyGj47g==", - "dev": true - }, - "node_modules/@vitest/coverage-c8": { - "version": "0.29.8", - "resolved": "https://registry.npmjs.org/@vitest/coverage-c8/-/coverage-c8-0.29.8.tgz", - "integrity": "sha512-y+sEMQMctWokjnSqm3FCQEYFkjLrYaznsxEZHxcx8z2aftpYg3A5tvI1S5himfdEFo7o+OeHzh40bPSWZHW4oQ==", - "dev": true, - "dependencies": { - "c8": "^7.13.0", - "picocolors": "^1.0.0", - "std-env": "^3.3.1" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "vitest": ">=0.29.0 <1" - } - }, - "node_modules/@vitest/expect": { - "version": "0.29.8", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.29.8.tgz", - "integrity": "sha512-xlcVXn5I5oTq6NiZSY3ykyWixBxr5mG8HYtjvpgg6KaqHm0mvhX18xuwl5YGxIRNt/A5jidd7CWcNHrSvgaQqQ==", - "dev": true, - "dependencies": { - "@vitest/spy": "0.29.8", - "@vitest/utils": "0.29.8", - "chai": "^4.3.7" - } - }, - "node_modules/@vitest/runner": { - "version": "0.29.8", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.29.8.tgz", - "integrity": "sha512-FzdhnRDwEr/A3Oo1jtIk/B952BBvP32n1ObMEb23oEJNO+qO5cBet6M2XWIDQmA7BDKGKvmhUf2naXyp/2JEwQ==", - "dev": true, - "dependencies": { - "@vitest/utils": "0.29.8", - "p-limit": "^4.0.0", - "pathe": "^1.1.0" - } - }, - "node_modules/@vitest/runner/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@vitest/runner/node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@vitest/spy": { - "version": "0.29.8", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.29.8.tgz", - "integrity": "sha512-VdjBe9w34vOMl5I5mYEzNX8inTxrZ+tYUVk9jxaZJmHFwmDFC/GV3KBFTA/JKswr3XHvZL+FE/yq5EVhb6pSAw==", - "dev": true, - "dependencies": { - "tinyspy": "^1.0.2" - } - }, - "node_modules/@vitest/utils": { - "version": "0.29.8", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.29.8.tgz", - "integrity": "sha512-qGzuf3vrTbnoY+RjjVVIBYfuWMjn3UMUqyQtdGNZ6ZIIyte7B37exj6LaVkrZiUTvzSadVvO/tJm8AEgbGCBPg==", - "dev": true, - "dependencies": { - "cli-truncate": "^3.1.0", - "diff": "^5.1.0", - "loupe": "^2.3.6", - "pretty-format": "^27.5.1" - } - }, - "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/c8": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-7.13.0.tgz", - "integrity": "sha512-/NL4hQTv1gBL6J6ei80zu3IiTrmePDKXKXOTLpHvcIWZTVYQlDhVWjjWvkhICylE8EwwnMVzDZugCvdx0/DIIA==", - "dev": true, - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@istanbuljs/schema": "^0.1.3", - "find-up": "^5.0.0", - "foreground-child": "^2.0.0", - "istanbul-lib-coverage": "^3.2.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-reports": "^3.1.4", - "rimraf": "^3.0.2", - "test-exclude": "^6.0.0", - "v8-to-istanbul": "^9.0.0", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9" - }, - "bin": { - "c8": "bin/c8.js" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", - "dev": true, - "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/chevrotain": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-10.4.2.tgz", - "integrity": "sha512-gzF5GxE0Ckti5kZVuKEZycLntB5X2aj9RVY0r4/220GwQjdnljU+/t3kP74/FMWC7IzCDDEjQ9wsFUf0WCdSHg==", - "dependencies": { - "@chevrotain/cst-dts-gen": "10.4.2", - "@chevrotain/gast": "10.4.2", - "@chevrotain/types": "10.4.2", - "@chevrotain/utils": "10.4.2", - "lodash": "4.17.21", - "regexp-to-ast": "0.5.0" - } - }, - "node_modules/chevrotain-allstar": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.1.7.tgz", - "integrity": "sha512-oMSHkXVCDQxnj3tDCqcEoMnNIEiYlAYT0FVja1PaLrT3njXGvg5JXTXs/tk2NI42SR3LMJyqTNgjR4VyDIf19w==", - "dependencies": { - "lodash": "^4.17.21" - }, - "peerDependencies": { - "chevrotain": "~10.4.1" - } - }, - "node_modules/cli-truncate": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", - "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", - "dev": true, - "dependencies": { - "slice-ansi": "^5.0.0", - "string-width": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/cliui/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/commander": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz", - "integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==", - "engines": { - "node": ">=14" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/diff": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", - "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "node_modules/esbuild": { - "version": "0.17.15", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.15.tgz", - "integrity": "sha512-LBUV2VsUIc/iD9ME75qhT4aJj0r75abCVS0jakhFzOtR7TQsqQA5w0tZ+KTKnwl3kXE0MhskNdHDh/I5aCR1Zw==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.17.15", - "@esbuild/android-arm64": "0.17.15", - "@esbuild/android-x64": "0.17.15", - "@esbuild/darwin-arm64": "0.17.15", - "@esbuild/darwin-x64": "0.17.15", - "@esbuild/freebsd-arm64": "0.17.15", - "@esbuild/freebsd-x64": "0.17.15", - "@esbuild/linux-arm": "0.17.15", - "@esbuild/linux-arm64": "0.17.15", - "@esbuild/linux-ia32": "0.17.15", - "@esbuild/linux-loong64": "0.17.15", - "@esbuild/linux-mips64el": "0.17.15", - "@esbuild/linux-ppc64": "0.17.15", - "@esbuild/linux-riscv64": "0.17.15", - "@esbuild/linux-s390x": "0.17.15", - "@esbuild/linux-x64": "0.17.15", - "@esbuild/netbsd-x64": "0.17.15", - "@esbuild/openbsd-x64": "0.17.15", - "@esbuild/sunos-x64": "0.17.15", - "@esbuild/win32-arm64": "0.17.15", - "@esbuild/win32-ia32": "0.17.15", - "@esbuild/win32-x64": "0.17.15" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/foreground-child": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", - "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/fs-extra": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", - "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/glob": { - "version": "9.3.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.4.tgz", - "integrity": "sha512-qaSc49hojMOv1EPM4EuyITjDSgSKI0rthoHnvE81tcOi1SCVndHko7auqxdQ14eiQG2NDBJBE86+2xIrbIvrbA==", - "dependencies": { - "fs.realpath": "^1.0.0", - "minimatch": "^8.0.2", - "minipass": "^4.2.4", - "path-scurry": "^1.6.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.3.tgz", - "integrity": "sha512-tEEvU9TkZgnFDCtpnrEYnPsjT7iUx42aXfs4bzmQ5sMA09/6hZY0jeZcGkXyDagiBOvkUjNo8Viom+Me6+2x7g==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", - "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", - "dev": true, - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "dev": true - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsonschema": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", - "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/langium": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/langium/-/langium-1.1.0.tgz", - "integrity": "sha512-TsWY/DIOR73se9/YaMQZpvfFWWrhWP0FQS9MrpxWEnMJR0FoKVpMF1thPWXZexLSfyEm1pn2oYzCdW4KUBqXxA==", - "dependencies": { - "chevrotain": "~10.4.2", - "chevrotain-allstar": "~0.1.4", - "vscode-languageserver": "~8.0.2", - "vscode-languageserver-textdocument": "~1.0.8", - "vscode-uri": "~3.0.7" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/langium-cli": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-1.1.0.tgz", - "integrity": "sha512-vnv037FHqXqMeNiNF90v47VrJGiJPzH721UIbbHcu6Nfx0C1UC6SmQhGHtZIDRovT5qJsiXRIPDTZYrIkm4KJQ==", - "dev": true, - "dependencies": { - "chalk": "~4.1.2", - "commander": "~10.0.0", - "fs-extra": "~11.1.0", - "jsonschema": "~1.4.1", - "langium": "~1.1.0", - "lodash": "~4.17.21" - }, - "bin": { - "langium": "bin/langium.js" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/local-pkg": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", - "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.0" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minipass": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz", - "integrity": "sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==", - "engines": { - "node": ">=8" - } - }, - "node_modules/mlly": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.2.0.tgz", - "integrity": "sha512-+c7A3CV0KGdKcylsI6khWyts/CYrGTrRVo4R/I7u/cUsy0Conxa6LUhiEzVKIw14lc2L5aiO4+SeVe4TeGRKww==", - "dev": true, - "dependencies": { - "acorn": "^8.8.2", - "pathe": "^1.1.0", - "pkg-types": "^1.0.2", - "ufo": "^1.1.1" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-scurry": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.3.tgz", - "integrity": "sha512-RAmB+n30SlN+HnNx6EbcpoDy9nwdpcGPnEKrJnu6GZoDWBdIjo1UQMVtW2ybtC7LC2oKLcMq8y5g8WnKLiod9g==", - "dependencies": { - "lru-cache": "^7.14.1", - "minipass": "^4.0.2" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "engines": { - "node": ">=12" - } - }, - "node_modules/pathe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.0.tgz", - "integrity": "sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w==", - "dev": true - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "node_modules/pkg-types": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.2.tgz", - "integrity": "sha512-hM58GKXOcj8WTqUXnsQyJYXdeAPbythQgEF3nTcEo+nkD49chjQ9IKm/QJy9xf6JakXptz86h7ecP2024rrLaQ==", - "dev": true, - "dependencies": { - "jsonc-parser": "^3.2.0", - "mlly": "^1.1.1", - "pathe": "^1.1.0" - } - }, - "node_modules/postcss": { - "version": "8.4.21", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", - "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - } - ], - "dependencies": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/pretty-format": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", - "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1", - "ansi-styles": "^5.0.0", - "react-is": "^17.0.1" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/radash": { - "version": "10.8.1", - "resolved": "https://registry.npmjs.org/radash/-/radash-10.8.1.tgz", - "integrity": "sha512-NzYo3XgM9Tzjf5iFPIMG2l5+LSOCi2H7Axe3Ry/1PrhlvuqxUoiLsmcTBtw4CfKtzy5Fzo79STiEj9JZWMfDQg==", - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", - "dev": true - }, - "node_modules/regexp-to-ast": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", - "integrity": "sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==" - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", - "dev": true, - "dependencies": { - "is-core-module": "^2.11.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rollup": { - "version": "3.20.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.2.tgz", - "integrity": "sha512-3zwkBQl7Ai7MFYQE0y1MeQ15+9jsi7XxfrqwTb/9EK8D9C9+//EBR4M+CuA1KODRaNbFez/lWxA5vhEGZp4MUg==", - "dev": true, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=14.18.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/slice-ansi": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", - "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.0.0", - "is-fullwidth-code-point": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true - }, - "node_modules/std-env": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.2.tgz", - "integrity": "sha512-uUZI65yrV2Qva5gqE0+A7uVAvO40iPo6jGhs7s8keRfHCmtg+uB2X6EiLGCI9IgL1J17xGhvoOqSz79lzICPTA==", - "dev": true - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", - "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-literal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", - "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", - "dev": true, - "dependencies": { - "acorn": "^8.8.2" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/test-exclude/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/tinybench": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.4.0.tgz", - "integrity": "sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==", - "dev": true - }, - "node_modules/tinypool": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.4.0.tgz", - "integrity": "sha512-2ksntHOKf893wSAH4z/+JbPpi92esw8Gn9N2deXX+B0EO92hexAVI9GIZZPx7P5aYo5KULfeOSt3kMOmSOy6uA==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.1.1.tgz", - "integrity": "sha512-UVq5AXt/gQlti7oxoIg5oi/9r0WpF7DGEVwXgqWSMmyN16+e3tl5lIvTaOpJ3TAtu5xFzWccFRM4R5NaWHF+4g==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/true-myth": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/true-myth/-/true-myth-6.2.0.tgz", - "integrity": "sha512-NYvzj/h2mGXmdIBmz825c/lQhpI4bzUQEEiBCAbNOVpr6aeYa1WTpJ+OmGmj1yPqbTLPKCCSi54yDnaEup504Q==", - "engines": { - "node": "14.* || 16.* || >= 18.*" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/ufo": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.1.1.tgz", - "integrity": "sha512-MvlCc4GHrmZdAllBc0iUDowff36Q9Ndw/UzqmEKyrfSzokTd9ZCy1i+IIk5hrYKkjoYVQyNbrw7/F8XJ2rEwTg==", - "dev": true - }, - "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/v8-to-istanbul": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", - "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/vite": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.2.1.tgz", - "integrity": "sha512-7MKhqdy0ISo4wnvwtqZkjke6XN4taqQ2TBaTccLIpOKv7Vp2h4Y+NpmWCnGDeSvvn45KxvWgGyb0MkHvY1vgbg==", - "dev": true, - "dependencies": { - "esbuild": "^0.17.5", - "postcss": "^8.4.21", - "resolve": "^1.22.1", - "rollup": "^3.18.0" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "peerDependencies": { - "@types/node": ">= 14", - "less": "*", - "sass": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } - } - }, - "node_modules/vite-node": { - "version": "0.29.8", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.29.8.tgz", - "integrity": "sha512-b6OtCXfk65L6SElVM20q5G546yu10/kNrhg08afEoWlFRJXFq9/6glsvSVY+aI6YeC1tu2TtAqI2jHEQmOmsFw==", - "dev": true, - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.3.4", - "mlly": "^1.1.0", - "pathe": "^1.1.0", - "picocolors": "^1.0.0", - "vite": "^3.0.0 || ^4.0.0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": ">=v14.16.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/vitest": { - "version": "0.29.8", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.29.8.tgz", - "integrity": "sha512-JIAVi2GK5cvA6awGpH0HvH/gEG9PZ0a/WoxdiV3PmqK+3CjQMf8c+J/Vhv4mdZ2nRyXFw66sAg6qz7VNkaHfDQ==", - "dev": true, - "dependencies": { - "@types/chai": "^4.3.4", - "@types/chai-subset": "^1.3.3", - "@types/node": "*", - "@vitest/expect": "0.29.8", - "@vitest/runner": "0.29.8", - "@vitest/spy": "0.29.8", - "@vitest/utils": "0.29.8", - "acorn": "^8.8.1", - "acorn-walk": "^8.2.0", - "cac": "^6.7.14", - "chai": "^4.3.7", - "debug": "^4.3.4", - "local-pkg": "^0.4.2", - "pathe": "^1.1.0", - "picocolors": "^1.0.0", - "source-map": "^0.6.1", - "std-env": "^3.3.1", - "strip-literal": "^1.0.0", - "tinybench": "^2.3.1", - "tinypool": "^0.4.0", - "tinyspy": "^1.0.2", - "vite": "^3.0.0 || ^4.0.0", - "vite-node": "0.29.8", - "why-is-node-running": "^2.2.2" - }, - "bin": { - "vitest": "vitest.mjs" - }, - "engines": { - "node": ">=v14.16.0" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@edge-runtime/vm": "*", - "@vitest/browser": "*", - "@vitest/ui": "*", - "happy-dom": "*", - "jsdom": "*", - "playwright": "*", - "safaridriver": "*", - "webdriverio": "*" - }, - "peerDependenciesMeta": { - "@edge-runtime/vm": { - "optional": true - }, - "@vitest/browser": { - "optional": true - }, - "@vitest/ui": { - "optional": true - }, - "happy-dom": { - "optional": true - }, - "jsdom": { - "optional": true - }, - "playwright": { - "optional": true - }, - "safaridriver": { - "optional": true - }, - "webdriverio": { - "optional": true - } - } - }, - "node_modules/vscode-jsonrpc": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.0.2.tgz", - "integrity": "sha512-RY7HwI/ydoC1Wwg4gJ3y6LpU9FJRZAUnTYMXthqhFXXu77ErDd/xkREpGuk4MyYkk4a+XDWAMqe0S3KkelYQEQ==", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/vscode-languageclient": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.0.2.tgz", - "integrity": "sha512-lHlthJtphG9gibGb/y72CKqQUxwPsMXijJVpHEC2bvbFqxmkj9LwQ3aGU9dwjBLqsX1S4KjShYppLvg1UJDF/Q==", - "dependencies": { - "minimatch": "^3.0.4", - "semver": "^7.3.5", - "vscode-languageserver-protocol": "3.17.2" - }, - "engines": { - "vscode": "^1.67.0" - } - }, - "node_modules/vscode-languageserver": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.0.2.tgz", - "integrity": "sha512-bpEt2ggPxKzsAOZlXmCJ50bV7VrxwCS5BI4+egUmure/oI/t4OlFzi/YNtVvY24A2UDOZAgwFGgnZPwqSJubkA==", - "dependencies": { - "vscode-languageserver-protocol": "3.17.2" - }, - "bin": { - "installServerIntoExtension": "bin/installServerIntoExtension" - } - }, - "node_modules/vscode-languageserver-protocol": { - "version": "3.17.2", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.2.tgz", - "integrity": "sha512-8kYisQ3z/SQ2kyjlNeQxbkkTNmVFoQCqkmGrzLH6A9ecPlgTbp3wDTnUNqaUxYr4vlAcloxx8zwy7G5WdguYNg==", - "dependencies": { - "vscode-jsonrpc": "8.0.2", - "vscode-languageserver-types": "3.17.2" - } - }, - "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz", - "integrity": "sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==" - }, - "node_modules/vscode-languageserver-types": { - "version": "3.17.2", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", - "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" - }, - "node_modules/vscode-uri": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.7.tgz", - "integrity": "sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/why-is-node-running": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", - "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", - "dev": true, - "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, - "bin": { - "why-is-node-running": "cli.js" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/yargs/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/DSL-langium/package.json b/DSL-langium/package.json deleted file mode 100644 index 534f0a159..000000000 --- a/DSL-langium/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "safe-ds", - "displayName": "safe-ds", - "description": "Please enter a brief description here", - "version": "0.0.1", - "engines": { - "vscode": "^1.67.0" - }, - "categories": [ - "Programming Languages" - ], - "contributes": { - "languages": [ - { - "id": "safe-ds", - "aliases": [ - "Safe-DS", - "safe-ds" - ], - "extensions": [ - ".sdspipe", - ".sdsschema", - ".sdsstub", - ".sdstest" - ], - "configuration": "./language-configuration.json" - } - ], - "grammars": [ - { - "language": "safe-ds", - "scopeName": "source.safe-ds", - "path": "./syntaxes/safe-ds.tmLanguage.json" - } - ] - }, - "activationEvents": [ - "onLanguage:safe-ds" - ], - "files": [ - "bin", - "out", - "src" - ], - "bin": { - "safe-ds-cli": "./bin/cli" - }, - "main": "./out/extension.js", - "scripts": { - "vscode:prepublish": "npm run build && npm run lint", - "build": "tsc -b tsconfig.json", - "watch": "tsc -b tsconfig.json --watch", - "test": "vitest tests", - "test-with-coverage": "vitest tests --coverage", - "langium:generate": "langium generate", - "langium:watch": "langium generate --watch" - }, - "dependencies": { - "chalk": "~4.1.2", - "chevrotain": "~10.4.2", - "commander": "~10.0.0", - "glob": "^9.3.4", - "langium": "~1.1.0", - "radash": "^10.8.1", - "true-myth": "^6.2.0", - "vscode-languageclient": "~8.0.2", - "vscode-languageserver": "~8.0.2", - "vscode-uri": "~3.0.7" - }, - "devDependencies": { - "@types/node": "~16.18.11", - "@types/vscode": "~1.67.0", - "@vitest/coverage-c8": "^0.29.8", - "langium-cli": "~1.1.0", - "typescript": "~4.9.5", - "vitest": "^0.29.8" - } -} diff --git a/DSL-langium/src/extension.ts b/DSL-langium/src/extension.ts deleted file mode 100644 index fce6ab0b8..000000000 --- a/DSL-langium/src/extension.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as vscode from 'vscode'; -import * as path from 'path'; -import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient/node'; - -let client: LanguageClient; - -// This function is called when the extension is activated. -export const activate = function (context: vscode.ExtensionContext): void { - client = startLanguageClient(context); -}; - -// This function is called when the extension is deactivated. -export const deactivate = function (): Thenable | undefined { - if (client) { - return client.stop(); - } - return undefined; -}; - -const startLanguageClient = function (context: vscode.ExtensionContext): LanguageClient { - const serverModule = context.asAbsolutePath(path.join('out', 'language-server', 'main')); - // The debug options for the server - // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging. - // By setting `process.env.DEBUG_BREAK` to a truthy value, the language server will wait until a debugger is attached. - const debugOptions = { - execArgv: [ - '--nolazy', - `--inspect${process.env.DEBUG_BREAK ? '-brk' : ''}=${process.env.DEBUG_SOCKET || '6009'}`, - ], - }; - - // If the extension is launched in debug mode then the debug server options are used - // Otherwise the run options are used - const serverOptions: ServerOptions = { - run: { module: serverModule, transport: TransportKind.ipc }, - debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }, - }; - - const fileSystemWatcher = vscode.workspace.createFileSystemWatcher('**/*.{sdspipe,sdsschema,sdsstub,sdstest}'); - context.subscriptions.push(fileSystemWatcher); - - // Options to control the language client - const clientOptions: LanguageClientOptions = { - documentSelector: [{ scheme: 'file', language: 'safe-ds' }], - synchronize: { - // Notify the server about file changes to files contained in the workspace - fileEvents: fileSystemWatcher, - }, - }; - - // Create the language client and start the client. - const result = new LanguageClient('safe-ds', 'Safe-DS', serverOptions, clientOptions); - - // Start the client. This will also launch the server - result.start(); - return result; -}; diff --git a/DSL-langium/src/language-server/grammar/safe-ds.langium b/DSL-langium/src/language-server/grammar/safe-ds.langium deleted file mode 100644 index 42089e989..000000000 --- a/DSL-langium/src/language-server/grammar/safe-ds.langium +++ /dev/null @@ -1,46 +0,0 @@ -grammar SafeDs - -interface SdsModule { - name: string; - imports: SdsImport[]; -} - -entry SdsModule returns SdsModule: - {SdsModule} - ('package' name=QualifiedName)? - imports+=SdsImport* -; - -interface SdsImport { - importedNamespace: string; - alias: SdsImportAlias; -} - -SdsImport returns SdsImport: - 'import' importedNamespace=QualifiedNameWithWildcard alias=SdsImportAlias ? -; - -interface SdsImportAlias { - name: string; -} - -SdsImportAlias returns SdsImportAlias: - 'as' name=ID -; - -QualifiedName returns string: - ID ('.' ID )* -; - -QualifiedNameWithWildcard returns string: - QualifiedName ('.' '*' )? -; - - -terminal ID returns string:IDENTIFIER | '`' IDENTIFIER '`' ; -terminal IDENTIFIER returns string: /[_a-zA-Z][_a-zA-Z0-9]*/; - -hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//; -hidden terminal SL_COMMENT: /\/\/[^\n\r]*/; -hidden terminal TEST_MARKER: /[»«]/; -hidden terminal WS: /\s+/; diff --git a/DSL-langium/syntaxes/safe-ds.tmLanguage.json b/DSL-langium/syntaxes/safe-ds.tmLanguage.json deleted file mode 100644 index 6e4642432..000000000 --- a/DSL-langium/syntaxes/safe-ds.tmLanguage.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "safe-ds", - "scopeName": "source.safe-ds", - "fileTypes": [".sdspipe", ".sdsschema", ".sdsstub", ".sdstest"], - "patterns": [ - { - "include": "#comments" - }, - { - "name": "keyword.control.safe-ds", - "match": "\\b(as|import|package)\\b" - } - ], - "repository": { - "comments": { - "patterns": [ - { - "name": "comment.block.safe-ds", - "begin": "/\\*", - "beginCaptures": { - "0": { - "name": "punctuation.definition.comment.safe-ds" - } - }, - "end": "\\*/", - "endCaptures": { - "0": { - "name": "punctuation.definition.comment.safe-ds" - } - } - }, - { - "begin": "//", - "beginCaptures": { - "1": { - "name": "punctuation.whitespace.comment.leading.safe-ds" - } - }, - "end": "(?=$)", - "name": "comment.line.safe-ds" - }, - { - "name": "comment.block.safe-ds", - "begin": "[»«]", - "beginCaptures": { - "0": { - "name": "punctuation.definition.comment.safe-ds" - } - }, - "end": "[»«]", - "endCaptures": { - "0": { - "name": "punctuation.definition.comment.safe-ds" - } - } - } - ] - } - } -} diff --git a/DSL-langium/tests/grammar/IssueFinderTest.kt b/DSL-langium/tests/grammar/IssueFinderTest.kt deleted file mode 100644 index 7f8e3ce8f..000000000 --- a/DSL-langium/tests/grammar/IssueFinderTest.kt +++ /dev/null @@ -1,163 +0,0 @@ -// class IssueFinderTest { -// -// @com.google.inject.Inject -// private lateinit var parseHelper: com.larsreimann.safeds.testing.ParseHelper -// -// @com.google.inject.Inject -// private lateinit var validationHelper: org.eclipse.xtext.testing.validation.ValidationTestHelper -// -// @org.junit.jupiter.api.TestFactory -// fun `should parse test files correctly`(): java.util.stream.Stream { -// return javaClass.classLoader -// .getResourcePath("grammar") -// ?.createDynamicTestsFromResourceFolder(::validateTestFile, ::createTest) -// ?: java.util.stream.Stream.empty() -// } -// -// @org.junit.jupiter.api.TestFactory -// fun `should validate test files correctly`(): java.util.stream.Stream { -// return javaClass.classLoader -// .getResourcePath("validation") -// ?.createDynamicTestsFromResourceFolder(::validateTestFile, ::createTest) -// ?: java.util.stream.Stream.empty() -// } -// -// /** -// * Checks if the given program is a valid test. If there are issues a description of the issue is returned, -// * otherwise this returns `null`. -// */ -// private fun validateTestFile( -// @Suppress("UNUSED_PARAMETER") resourcePath: java.nio.file.Path, -// filePath: java.nio.file.Path, -// program: String -// ): String? { -// val severities = severities(program) -// -// // Must contain at least one severity -// if (severities.isEmpty()) { -// return "No expected issue is specified." -// } -// -// // Severities must be valid -// severities.forEach { -// if (it !in com.larsreimann.safeds.validSeverities) { -// return "Severity '$it' is invalid." -// } -// } -// -// // Opening and closing test markers must match -// val locations = when (val locationsResult = com.larsreimann.safeds.testing.findTestRanges(program)) { -// is com.larsreimann.safeds.testing.FindTestRangesResult.Success -> locationsResult.ranges -// is com.larsreimann.safeds.testing.FindTestRangesResult.Failure -> return locationsResult.message -// } -// -// // Must not contain more locations markers than severities -// if (severities.size < locations.size) { -// return "Test file contains more locations (»«) than severities." -// } -// -// // Must be able to parse the test file -// if (parseHelper.parseProgramText(program) == null) { -// return "Could not parse test file." -// } -// -// // Must not combine syntax errors with checks of semantic errors -// if (severities.intersect(com.larsreimann.safeds.semanticSeverities).isNotEmpty()) { -// if (severities.contains(com.larsreimann.safeds.SYNTAX_ERROR)) { -// return "Cannot combine severity 'syntax_error' with check of semantic errors." -// } -// -// val syntaxErrors = actualIssues(program, filePath).filter { it.isSyntaxError } -// if (syntaxErrors.isNotEmpty()) { -// return "File checks for semantic issues but has syntax errors${syntaxErrors.stringify()}" -// } -// } -// -// return null -// } -// -// private fun createTest(resourcePath: java.nio.file.Path, filePath: java.nio.file.Path, program: String) = sequence { -// expectedIssues(program) -// .groupBy { it.severity to it.message } -// .keys -// .forEach { (severity, message) -> -// yield( -// com.larsreimann.safeds.testing.CategorizedTest( -// severity, -// org.junit.jupiter.api.DynamicTest.dynamicTest( -// com.larsreimann.safeds.testing.testDisplayName( -// resourcePath, -// filePath, -// message -// ), filePath.toUri() -// ) { -// parsingTest(program, filePath, severity, message) -// } -// ) -// ) -// } -// } -// -// private fun parsingTest(program: String, filePath: java.nio.file.Path, severity: String, message: String) { -// val actualIssues = actualIssues(program, filePath) -// expectedIssues(program) -// .filter { it.severity == severity && it.message == message } -// .forEach { -// when (it.severity) { -// com.larsreimann.safeds.SYNTAX_ERROR -> actualIssues.shouldHaveSyntaxError(it) -// com.larsreimann.safeds.NO_SYNTAX_ERROR -> actualIssues.shouldHaveNoSyntaxError(it) -// com.larsreimann.safeds.SEMANTIC_ERROR -> actualIssues.shouldHaveSemanticError(it) -// com.larsreimann.safeds.NO_SEMANTIC_ERROR -> actualIssues.shouldHaveNoSemanticError(it) -// com.larsreimann.safeds.SEMANTIC_WARNING -> actualIssues.shouldHaveSemanticWarning(it) -// com.larsreimann.safeds.NO_SEMANTIC_WARNING -> actualIssues.shouldHaveNoSemanticWarning(it) -// com.larsreimann.safeds.SEMANTIC_INFO -> actualIssues.shouldHaveSemanticInfo(it) -// com.larsreimann.safeds.NO_SEMANTIC_INFO -> actualIssues.shouldHaveNoSemanticInfo(it) -// com.larsreimann.safeds.NO_ISSUE -> actualIssues.shouldHaveNoIssue(it) -// } -// } -// } -// -// private fun expectedIssues(program: String): List { -// val locations = when (val locationsResult = com.larsreimann.safeds.testing.findTestRanges(program)) { -// is com.larsreimann.safeds.testing.FindTestRangesResult.Success -> locationsResult.ranges -// else -> return emptyList() -// } -// -// return com.larsreimann.safeds.utils.outerZipBy( -// severitiesAndMessages(program), -// locations -// ) { severityAndMessage, location -> -// com.larsreimann.safeds.testing.assertions.ExpectedIssue( -// severityAndMessage!!.severity, -// severityAndMessage.message, -// severityAndMessage.messageIsRegex, -// location -// ) -// } -// } -// -// private fun severities(program: String): List { -// return severitiesAndMessages(program).map { it.severity } -// } -// -// private fun severitiesAndMessages(program: String): List { -// return """//\s*(?\S+)\s*(?:(?r)?"(?[^"]*)")?""" -// .toRegex() -// .findAll(program) -// .map { -// com.larsreimann.safeds.testing.assertions.ExpectedIssue( -// it.groupValues[1], -// it.groupValues[3], -// it.groupValues[2] == "r", -// null -// ) -// } -// .toList() -// } -// -// private fun actualIssues(program: String, filePath: java.nio.file.Path): List { -// val parsingResult = parseHelper.parseProgramText(program) ?: return emptyList() -// parsingResult.eResource().eAdapters().add(com.larsreimann.safeds.emf.OriginalFilePath(filePath.toString())) -// return validationHelper.validate(parsingResult) -// } -// } diff --git a/DSL-langium/tests/helpers/testResources.test.ts b/DSL-langium/tests/helpers/testResources.test.ts deleted file mode 100644 index 5630044c0..000000000 --- a/DSL-langium/tests/helpers/testResources.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { describe, expect, it } from 'vitest'; -import { listTestResources } from './testResources'; - -describe('listTestResources', () => { - it('should yield all Safe-DS files in a directory', () => { - expect(listTestResources('grammar').length > 0).toBeTruthy(); - }); -}); diff --git a/DSL-langium/tests/helpers/testResources.ts b/DSL-langium/tests/helpers/testResources.ts deleted file mode 100644 index ad1481ea2..000000000 --- a/DSL-langium/tests/helpers/testResources.ts +++ /dev/null @@ -1,34 +0,0 @@ -import path from 'path'; -import { globSync } from 'glob'; -import { - PIPELINE_FILE_EXTENSION, - SCHEMA_FILE_EXTENSION, - STUB_FILE_EXTENSION, - TEST_FILE_EXTENSION, -} from '../../src/language-server/constant/fileExtensions'; - -const resourcesPath = path.join(__dirname, '..', 'resources'); - -/** - * Resolves the given path relative to `tests/resources/`. - * - * @param pathRelativeToResources The path relative to `tests/resources/`. - * @return The resolved absolute path. - */ -export const resolvePathRelativeToResources = (pathRelativeToResources: string) => { - return path.join(resourcesPath, pathRelativeToResources); -}; - -/** - * Lists all Safe-DS files in the given directory relative to `tests/resources/`. - * - * @param pathRelativeToResources The root directory relative to `tests/resources/`. - * @return Paths to the Safe-DS files relative to `pathRelativeToResources`. - */ -export const listTestResources = (pathRelativeToResources: string) => { - const fileExtensions = [PIPELINE_FILE_EXTENSION, SCHEMA_FILE_EXTENSION, STUB_FILE_EXTENSION, TEST_FILE_EXTENSION]; - const pattern = `**/*.{${fileExtensions.join(',')}}`; - const cwd = resolvePathRelativeToResources(pathRelativeToResources); - - return globSync(pattern, { cwd, nodir: true, withFileTypes: true }); -}; diff --git a/DSL-langium/tests/resources/grammar/compilationUnits/bad-annotation between package and import.sdstest b/DSL-langium/tests/resources/grammar/compilationUnits/bad-annotation between package and import.sdstest deleted file mode 100644 index 868e48709..000000000 --- a/DSL-langium/tests/resources/grammar/compilationUnits/bad-annotation between package and import.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -package test - -@AnnotationCall - -import someDeclaration diff --git a/DSL-langium/tests/resources/grammar/compilationUnits/good-complex example.sdstest b/DSL-langium/tests/resources/grammar/compilationUnits/good-complex example.sdstest deleted file mode 100644 index 6cdd256e2..000000000 --- a/DSL-langium/tests/resources/grammar/compilationUnits/good-complex example.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -@AnnotationCall - -package test - -import someDeclaration -import somePackage.* - -@AnnotationCall -class C diff --git a/DSL-langium/tests/resources/grammar/compilationUnits/good-lone annotation call.sdstest b/DSL-langium/tests/resources/grammar/compilationUnits/good-lone annotation call.sdstest deleted file mode 100644 index a5b6ef4dd..000000000 --- a/DSL-langium/tests/resources/grammar/compilationUnits/good-lone annotation call.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -@AnnotationCall diff --git a/DSL-langium/tests/resources/grammar/declarations/annotation.sdstest b/DSL-langium/tests/resources/grammar/declarations/annotation.sdstest deleted file mode 100644 index 7b341c5b9..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/annotation.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -annotation MySimpleAnnotation - -@AnnotationUse annotation MyComplexAnnotation( - @AnnotationUse a: Int, - vararg b: Int = 3 -) constraint { - T2 super Number, - T3 sub Number -} diff --git a/DSL-langium/tests/resources/grammar/declarations/annotationUse.sdstest b/DSL-langium/tests/resources/grammar/declarations/annotationUse.sdstest deleted file mode 100644 index bb42d5a11..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/annotationUse.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -@AnnotationUse(1, b = 2, A.B) class MyClass diff --git a/DSL-langium/tests/resources/grammar/declarations/class.sdstest b/DSL-langium/tests/resources/grammar/declarations/class.sdstest deleted file mode 100644 index f16224e55..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/class.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -// $TEST$ no_syntax_error - -class MySimpleClass - -@AnnotationUse -class MyComplexClass - <@AnnotationUse T1, in T2, out T3, T4 :: $SchemaType, T5 :: $ExpressionType, T6 :: $IntType, T7 :: $FloatType, T8 :: $BooleanType, T9 :: $StringType, T10 :: $NamedType> - (@AnnotationUse a: Int, vararg b: Int = 3) - sub SuperClass1, SuperClass2 -{ - constraint { - T2 super Number, - T3 sub Number - } - @AnnotationUse static attr myAttribute: Int - @AnnotationUse class MyClass - @AnnotationUse enum MyEnum - @AnnotationUse static fun MyFunction() -} diff --git a/DSL-langium/tests/resources/grammar/declarations/enum.sdstest b/DSL-langium/tests/resources/grammar/declarations/enum.sdstest deleted file mode 100644 index c40e86597..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/enum.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -// $TEST$ no_syntax_error -enum MySimpleEnum - -@AnnotationUse enum MyComplexEnum { - MySimpleVariant - @AnnotationUse MyComplexVariant - <@AnnotationUse T1, in T2, out T3> - (@AnnotationUse a: Int, vararg b: Int = 3) constraint { - T2 super Number, - T3 sub Number - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/function.sdstest b/DSL-langium/tests/resources/grammar/declarations/function.sdstest deleted file mode 100644 index 56ad01d76..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/function.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -// $TEST$ no_syntax_error - -fun mySimpleFunction() - -fun myFunctionWithOneResult() -> a : Int - -@MyAnnotation -fun myComplexFunction - <@AnnotationUse T1, in T2, out T3> - (@AnnotationUse a: Int, vararg b: Int = 3) - -> (@AnnotationUse a: Int, b: Int) { - constraint { - T2 super Number, - T3 sub Number - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/package/good-annotationUsesWithImports.sdstest b/DSL-langium/tests/resources/grammar/declarations/package/good-annotationUsesWithImports.sdstest deleted file mode 100644 index cd6c79b19..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/package/good-annotationUsesWithImports.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -@AnnotationUse - -import myPackage.MyClass diff --git a/DSL-langium/tests/resources/grammar/declarations/package/good-annotationUsesWithName.sdstest b/DSL-langium/tests/resources/grammar/declarations/package/good-annotationUsesWithName.sdstest deleted file mode 100644 index 3be6b6f60..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/package/good-annotationUsesWithName.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -@AnnotationUse - -package myPackage diff --git a/DSL-langium/tests/resources/grammar/declarations/package/good-full.sdstest b/DSL-langium/tests/resources/grammar/declarations/package/good-full.sdstest deleted file mode 100644 index f66ccf200..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/package/good-full.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -@AnnotationUse - -package myPackage - -import myPackage.MyClass -import myPackage.MyClass as Class -import myPackage.* - -pipeline p1 {} diff --git a/DSL-langium/tests/resources/grammar/declarations/pipeline.sdstest b/DSL-langium/tests/resources/grammar/declarations/pipeline.sdstest deleted file mode 100644 index a78a03c35..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/pipeline.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline mySimplePipeline {} - -@AnnotationUse pipeline myComplexPipeline { - val a = 1; -} diff --git a/DSL-langium/tests/resources/grammar/declarations/predicates/goals/goalsWithArguments.sdstest b/DSL-langium/tests/resources/grammar/declarations/predicates/goals/goalsWithArguments.sdstest deleted file mode 100644 index d1ec75efb..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/predicates/goals/goalsWithArguments.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -predicate myPredicateWithgoalArgs(){ - goal(myRef, "String", 3, null, 4.4, false) -} - -predicate myPredicateWithgoalNesting(){ - goal( - goalInner("Str", 3) - ) -} diff --git a/DSL-langium/tests/resources/grammar/declarations/predicates/predicate.sdstest b/DSL-langium/tests/resources/grammar/declarations/predicates/predicate.sdstest deleted file mode 100644 index 18c2ce287..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/predicates/predicate.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// $TEST$ no_syntax_error - -predicate mySimplePredicate(){ -} diff --git a/DSL-langium/tests/resources/grammar/declarations/predicates/predicateComplex.sdstest b/DSL-langium/tests/resources/grammar/declarations/predicates/predicateComplex.sdstest deleted file mode 100644 index 320cb445b..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/predicates/predicateComplex.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -predicate myComplexPredicate(dataset: Dataset, columnName: String) -> :: Schema { - -} diff --git a/DSL-langium/tests/resources/grammar/declarations/predicates/predicateWithGoals.sdstest b/DSL-langium/tests/resources/grammar/declarations/predicates/predicateWithGoals.sdstest deleted file mode 100644 index 9b2f1f28c..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/predicates/predicateWithGoals.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -// $TEST$ no_syntax_error - -predicate myPredicateWithGoals(){ - goal1(), - goal31(), - goal32(dataset, columnName), - val intermediate1 = goal2() -} - -predicate myPredicateWithGoalsComplex(){ - val intermediate2 = goal41(dataset, columnName), - goal42(dataset, columnName), - goal51(intermediate2), - goal52(dataset, columnName), - goal53(intermediate2, columnName) -} diff --git a/DSL-langium/tests/resources/grammar/declarations/predicates/predicateWithSchemaEffects.sdstest b/DSL-langium/tests/resources/grammar/declarations/predicates/predicateWithSchemaEffects.sdstest deleted file mode 100644 index 31b09295f..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/predicates/predicateWithSchemaEffects.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -predicate predicateWithSchemaEffectGoals () { - $readSchema("datasetPathStr"), - $checkColumn(::ASchema, "columnNameStr1", "columnNameStr2") -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with alternative as reference list.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with alternative as reference list.sdstest deleted file mode 100644 index e10398d60..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with alternative as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [^ f | g] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with alternative as universe.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with alternative as universe.sdstest deleted file mode 100644 index 6d96e3401..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with alternative as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [f | g^ f] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with complement as reference list.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with complement as reference list.sdstest deleted file mode 100644 index 9bea7ac72..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with complement as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [^ [^ f]] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with complement as universe.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with complement as universe.sdstest deleted file mode 100644 index 36be4a494..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with complement as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [[^ f]^ f] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with parenthesized term as reference list.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with parenthesized term as reference list.sdstest deleted file mode 100644 index ecf147600..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with parenthesized term as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [^ (f)] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with parenthesized term as universe.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with parenthesized term as universe.sdstest deleted file mode 100644 index 2c6fc986d..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with parenthesized term as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [(f)^ f] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with sequence as universe.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with sequence as universe.sdstest deleted file mode 100644 index 035f11586..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with sequence as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [f g^ f] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with token as universe.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with token as universe.sdstest deleted file mode 100644 index f12329287..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with token as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [f^ f] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with token class as reference list.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with token class as reference list.sdstest deleted file mode 100644 index e4d3bef00..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-complement with token class as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - [^ \a] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-subterm after term.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-subterm after term.sdstest deleted file mode 100644 index 9ddbd5eeb..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-subterm after term.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - f - - subterm term = f; - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-subterm without semicolon.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/bad-subterm without semicolon.sdstest deleted file mode 100644 index f6a79907b..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/bad-subterm without semicolon.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ syntax_error - -class C { - protocol { - subterm term = f - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-alternative.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-alternative.sdstest deleted file mode 100644 index bee5a8b51..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-alternative.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - f | g - } - - protocol { - f | g | h - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-complement without reference list.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-complement without reference list.sdstest deleted file mode 100644 index e0ca81aea..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-complement without reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - [^] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-complement.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-complement.sdstest deleted file mode 100644 index 6a7c28af7..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-complement.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - [^ f] - [.^ f] - [\a^ a] - [\f^ f] - - [^ f g] - [.^ f h] - [\a^ a b] - [\f^ f h] - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-empty.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-empty.sdstest deleted file mode 100644 index a8c67c6ae..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-empty.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol {} -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-parenthesizedTerm.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-parenthesizedTerm.sdstest deleted file mode 100644 index 2544b39c5..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-parenthesizedTerm.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - (f) - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-quantifiedTerm.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-quantifiedTerm.sdstest deleted file mode 100644 index 99fbd8503..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-quantifiedTerm.sdstest +++ /dev/null @@ -1,29 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - [^ f]? - [^ f]* - [^ f]+ - - (f)? - (f)* - (f)+ - - f? - f* - f+ - - .? - .* - .+ - - \a? - \a* - \a+ - - \f? - \f* - \f+ - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-sequence.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-sequence.sdstest deleted file mode 100644 index 17b18e3ad..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-sequence.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - f g - } - - protocol { - f g h - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-subterms.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-subterms.sdstest deleted file mode 100644 index 866b47cf9..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-subterms.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - subterm term1 = f; - subterm term2 = g; - - term1 | term2 - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-token.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-token.sdstest deleted file mode 100644 index 9b2a5d685..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-token.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - f - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/protocols/good-tokenClasses.sdstest b/DSL-langium/tests/resources/grammar/declarations/protocols/good-tokenClasses.sdstest deleted file mode 100644 index 913ad7288..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/protocols/good-tokenClasses.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ no_syntax_error - -class C { - protocol { - . - \a - \f - } -} diff --git a/DSL-langium/tests/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest b/DSL-langium/tests/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest deleted file mode 100644 index 490eefca7..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -internal private step myStep() {} diff --git a/DSL-langium/tests/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest b/DSL-langium/tests/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest deleted file mode 100644 index 10d20514c..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -private internal step myStep() {} diff --git a/DSL-langium/tests/resources/grammar/declarations/steps/good-step in compilation unit.sdstest b/DSL-langium/tests/resources/grammar/declarations/steps/good-step in compilation unit.sdstest deleted file mode 100644 index a6f91b993..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/steps/good-step in compilation unit.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -// $TEST$ no_syntax_error - -step mySimpleStep() {} - -internal step myInternalStep() {} - -step myStepWithOneResult() -> a: Int {} - -@AnnotationUse -private step myComplexStep(@AnnotationUse a: Int, vararg b: Int = 3) -> (a: Int, b: Int) { - val a = 1; -} diff --git a/DSL-langium/tests/resources/grammar/declarations/steps/good-step in package.sdstest b/DSL-langium/tests/resources/grammar/declarations/steps/good-step in package.sdstest deleted file mode 100644 index 7217af8a1..000000000 --- a/DSL-langium/tests/resources/grammar/declarations/steps/good-step in package.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -// $TEST$ no_syntax_error - -package myPackage - -step mySimpleStep() {} - -internal step myInternalStep() {} - -step myStepWithOneResult() -> a: Int {} - -@AnnotationUse -private step myComplexStep(@AnnotationUse a: Int, vararg b: Int = 3) -> (a: Int, b: Int) { - val a = 1; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/arithmeticOperator.sdstest b/DSL-langium/tests/resources/grammar/expressions/arithmeticOperator.sdstest deleted file mode 100644 index b331054e1..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/arithmeticOperator.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - 1 + 2; - 1 - 2; - 1 * 2; - 1 / 2; - -1; - - (1 + 2) * -3 / (1 - 4) + 5; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/blockLambda.sdstest b/DSL-langium/tests/resources/grammar/expressions/blockLambda.sdstest deleted file mode 100644 index f44e798f7..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/blockLambda.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - () {}; - - (a, vararg b = 1) { - val a = 1; - }; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/call.sdstest b/DSL-langium/tests/resources/grammar/expressions/call.sdstest deleted file mode 100644 index ae8d16985..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/call.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - f(); - f<*, in Number, out Number, T = Number>(1, b = 2); -} diff --git a/DSL-langium/tests/resources/grammar/expressions/comparisonOperator.sdstest b/DSL-langium/tests/resources/grammar/expressions/comparisonOperator.sdstest deleted file mode 100644 index 1946226a2..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/comparisonOperator.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - 1 < 2; - 1 <= 2; - 1 == 2; - 1 === 2; - 1 != 2; - 1 !== 2; - 1 >= 2; - 1 > 2; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/expressionLambda.sdstest b/DSL-langium/tests/resources/grammar/expressions/expressionLambda.sdstest deleted file mode 100644 index a39992494..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/expressionLambda.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - () -> 1; - - (a, vararg b = 1) -> 1; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/indexedAccess/good-indexed access.sdstest b/DSL-langium/tests/resources/grammar/expressions/indexedAccess/good-indexed access.sdstest deleted file mode 100644 index 6d40c5cf5..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/indexedAccess/good-indexed access.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline test { - a[1]; - a[b]; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/literals/booleanLiteral.sdstest b/DSL-langium/tests/resources/grammar/expressions/literals/booleanLiteral.sdstest deleted file mode 100644 index 645644621..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/literals/booleanLiteral.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - true; - false; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/literals/numberLiteral.sdstest b/DSL-langium/tests/resources/grammar/expressions/literals/numberLiteral.sdstest deleted file mode 100644 index 823ecd787..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/literals/numberLiteral.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - 1; - 1.2; - - 1e10; - 1e+10; - 1e-10; - 1.2e2; - - 1E10; - 1E+10; - 1E-10; - 1.2E2; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/literals/stringLiteral.sdstest b/DSL-langium/tests/resources/grammar/expressions/literals/stringLiteral.sdstest deleted file mode 100644 index 280425c1d..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/literals/stringLiteral.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - ""; - "myString"; - "'"; - "\n"; - "\u000c"; - " - multi - line - string - "; - "{"; - "{\n"; - "{ {"; - "not a template { ??? }"; - "not a template either \{{ ??? }}"; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/logicalOperator.sdstest b/DSL-langium/tests/resources/grammar/expressions/logicalOperator.sdstest deleted file mode 100644 index 295bca6f7..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/logicalOperator.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - false and true; - true or true; - not true; - - not true and false or true; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/memberAccess.sdstest b/DSL-langium/tests/resources/grammar/expressions/memberAccess.sdstest deleted file mode 100644 index cc0b07e35..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/memberAccess.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - a.member; - a?.member; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/templateString_bad.sdstest b/DSL-langium/tests/resources/grammar/expressions/templateString_bad.sdstest deleted file mode 100644 index 9262c589b..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/templateString_bad.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ syntax_error - -pipeline myPipeline { - "}} template {{ ??? }}"; -} diff --git a/DSL-langium/tests/resources/grammar/expressions/templateString_good.sdstest b/DSL-langium/tests/resources/grammar/expressions/templateString_good.sdstest deleted file mode 100644 index 2bb136bb0..000000000 --- a/DSL-langium/tests/resources/grammar/expressions/templateString_good.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - "}} template {{ a }}"; -} diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedConstraint.sdstest b/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedConstraint.sdstest deleted file mode 100644 index 4ad090f86..000000000 --- a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedConstraint.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -class constraint diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedStep.sdstest b/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedStep.sdstest deleted file mode 100644 index a786139de..000000000 --- a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedStep.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -class step diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/good-escapedKeywords.sdstest b/DSL-langium/tests/resources/grammar/keywordsAsNames/good-escapedKeywords.sdstest deleted file mode 100644 index 3375be979..000000000 --- a/DSL-langium/tests/resources/grammar/keywordsAsNames/good-escapedKeywords.sdstest +++ /dev/null @@ -1,29 +0,0 @@ -// $TEST$ no_syntax_error - -class `_` -class `and` -class `annotation` -class `as` -class `attr` -class `class` -class `constraint` -class `enum` -class `false` -class `fun` -class `import` -class `in` -class `not` -class `null` -class `or` -class `out` -class `package` -class `pipeline` -class `static` -class `step` -class `sub` -class `super` -class `true` -class `union` -class `val` -class `vararg` -class `yield` diff --git a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedEnum.sdstest b/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedEnum.sdstest deleted file mode 100644 index 9294a84da..000000000 --- a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedEnum.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -enum TestEnum { diff --git a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedParameterList.sdstest b/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedParameterList.sdstest deleted file mode 100644 index 1b8e0e4f0..000000000 --- a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedParameterList.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -fun f( diff --git a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedResultList.sdstest b/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedResultList.sdstest deleted file mode 100644 index 66c9b9dab..000000000 --- a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedResultList.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -fun s() -> ( diff --git a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedTypeParameterList.sdstest b/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedTypeParameterList.sdstest deleted file mode 100644 index c9df5484f..000000000 --- a/DSL-langium/tests/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedTypeParameterList.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -class C< diff --git a/DSL-langium/tests/resources/grammar/schema/schema.sdsschema b/DSL-langium/tests/resources/grammar/schema/schema.sdsschema deleted file mode 100644 index 046ba645a..000000000 --- a/DSL-langium/tests/resources/grammar/schema/schema.sdsschema +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -schema MySchema { - "column name" : ColumnType -} diff --git a/DSL-langium/tests/resources/grammar/statements/assignment.sdstest b/DSL-langium/tests/resources/grammar/statements/assignment.sdstest deleted file mode 100644 index 36b7e7ae2..000000000 --- a/DSL-langium/tests/resources/grammar/statements/assignment.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - val a = 0; - val a, _, yield b = call(); - - () { - val a = 0; - val a, _, yield b = call(); - }; -} diff --git a/DSL-langium/tests/resources/grammar/statements/expressionStatement.sdstest b/DSL-langium/tests/resources/grammar/statements/expressionStatement.sdstest deleted file mode 100644 index bc3410be1..000000000 --- a/DSL-langium/tests/resources/grammar/statements/expressionStatement.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ no_syntax_error - -pipeline myPipeline { - call(); - - () { - call(); - }; -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotationUse_ArgumentList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotationUse_ArgumentList.sdstest deleted file mode 100644 index cce7df4c2..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotationUse_ArgumentList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inAnnotationUseArgumentList - -// $TEST$ no_syntax_error - -@A(1, 2, ) class C diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotation_ConstraintList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotation_ConstraintList.sdstest deleted file mode 100644 index 58d6b5d65..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotation_ConstraintList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inAnnotationConstraintList - -// $TEST$ no_syntax_error - -annotation A constraint { - T sub Any, - T super Int -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotation_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotation_ParameterList.sdstest deleted file mode 100644 index fe61472ec..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inAnnotation_ParameterList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inAnnotationParameterList - -// $TEST$ no_syntax_error - -annotation A( - a: Int, - b: Int, -) diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inAssignment_AssigneeList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inAssignment_AssigneeList.sdstest deleted file mode 100644 index 1a977042d..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inAssignment_AssigneeList.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package tests.trailingComma.inDoStatementAssigneeList - -// $TEST$ no_syntax_error - -pipeline p { - val a, val b, = f(); - - () { - val a, val b, = f(); - }; -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inBlockLambda_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inBlockLambda_ParameterList.sdstest deleted file mode 100644 index 2ed7df85b..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inBlockLambda_ParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inBlockLambdaParameterList - -// $TEST$ no_syntax_error - -pipeline p { - (first, second, ) {}; -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inCall_ArgumentList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inCall_ArgumentList.sdstest deleted file mode 100644 index 7141c0733..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inCall_ArgumentList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inCallArgumentList - -// $TEST$ no_syntax_error - -pipeline p { - f(1, 2, ); -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inCall_TypeArgumentList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inCall_TypeArgumentList.sdstest deleted file mode 100644 index ad92292d3..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inCall_TypeArgumentList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inCallTypeArgumentList - -// $TEST$ no_syntax_error - -pipeline p { - f(); -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_ConstraintList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inClass_ConstraintList.sdstest deleted file mode 100644 index 489aacf4b..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_ConstraintList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inClassConstraintList - -// $TEST$ no_syntax_error - -class C { - constraint { - T sub Any, - T super Int - } -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inClass_ParameterList.sdstest deleted file mode 100644 index 7f8011e64..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_ParameterList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inClassParameterList - -// $TEST$ no_syntax_error - -class C(a: Int, b: Int, ) diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_SuperTypeList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inClass_SuperTypeList.sdstest deleted file mode 100644 index 8c840d547..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_SuperTypeList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inClassSuperTypeList - -// $TEST$ no_syntax_error - -class C sub D, E, diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_TypeParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inClass_TypeParameterList.sdstest deleted file mode 100644 index bd87d0f17..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inClass_TypeParameterList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inClassTypeParameterList - -// $TEST$ no_syntax_error - -class C diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_ConstraintList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_ConstraintList.sdstest deleted file mode 100644 index 78b5fb026..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_ConstraintList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inEnumVariantConstraintList - -// $TEST$ no_syntax_error - -enum E { - A -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_ParameterList.sdstest deleted file mode 100644 index 2117c9ce7..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_ParameterList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inEnumVariantParameterList - -// $TEST$ no_syntax_error - -enum E { - A( - a: Int, - b: Int, - ) -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_TypeParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_TypeParameterList.sdstest deleted file mode 100644 index b62f090d4..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inEnumVariant_TypeParameterList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inEnumVariantTypeParameterList - -// $TEST$ no_syntax_error - -enum E { - A constraint { - T sub Any, - T super Int - } -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inExpressionLambda_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inExpressionLambda_ParameterList.sdstest deleted file mode 100644 index 4bf11d967..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inExpressionLambda_ParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inExpressionLambdaParameterList - -// $TEST$ no_syntax_error - -pipeline p { - (first, second, ) -> 1; -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inFunctionType_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inFunctionType_ParameterList.sdstest deleted file mode 100644 index 8b5fb06d0..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inFunctionType_ParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inFunctionTypeParameterList - -// $TEST$ no_syntax_error - -step s( - f: (x: Int, y: Int, ) -> () -) {} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inFunctionType_ResultList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inFunctionType_ResultList.sdstest deleted file mode 100644 index c11cb2db6..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inFunctionType_ResultList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inFunctionTypeResultList - -// $TEST$ no_syntax_error - -step s( - f: () -> (x: Int, y: Int, ) -) {} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_ParameterList.sdstest deleted file mode 100644 index 3bc46e422..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_ParameterList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inFunctionParameterList - -// $TEST$ no_syntax_error - -fun f( - a: Int, - b: Int, -) diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_ResultList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_ResultList.sdstest deleted file mode 100644 index 2e750a649..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_ResultList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inFunctionResultList - -// $TEST$ no_syntax_error - -fun f() -> ( - first: Int, - second: Int, -) diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_TypeParameterConstraintList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_TypeParameterConstraintList.sdstest deleted file mode 100644 index 18e4b74aa..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_TypeParameterConstraintList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inFunctionTypeParameterConstraintList - -// $TEST$ no_syntax_error - -fun f() { - constraint { - T sub Any, - T super Int - } -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_TypeParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_TypeParameterList.sdstest deleted file mode 100644 index 52d4cde27..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inFunction_TypeParameterList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inFunctionTypeParameterList - -// $TEST$ no_syntax_error - -fun f() diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inNamedType_TypeArgumentList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inNamedType_TypeArgumentList.sdstest deleted file mode 100644 index 35418e95e..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inNamedType_TypeArgumentList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inNamedTypeTypeArgumentList - -// $TEST$ no_syntax_error - -step s( - f: Type -) {} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inSchema_ColumnList.sdsschema b/DSL-langium/tests/resources/grammar/trailingCommas/inSchema_ColumnList.sdsschema deleted file mode 100644 index d9ef5be5b..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inSchema_ColumnList.sdsschema +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -schema MySchemaWithTrailingComma { - "column name" : ColumnType, -} diff --git a/DSL-langium/tests/resources/grammar/trailingCommas/inWorkflowStep_ParameterList.sdstest b/DSL-langium/tests/resources/grammar/trailingCommas/inWorkflowStep_ParameterList.sdstest deleted file mode 100644 index e2f0e10ca..000000000 --- a/DSL-langium/tests/resources/grammar/trailingCommas/inWorkflowStep_ParameterList.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.trailingComma.inStepParameterList - -// $TEST$ no_syntax_error -step s(a: Int, b: Int, ) {} diff --git a/DSL-langium/tests/resources/grammar/types/callableType.sdstest b/DSL-langium/tests/resources/grammar/types/callableType.sdstest deleted file mode 100644 index 746a5d945..000000000 --- a/DSL-langium/tests/resources/grammar/types/callableType.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -// $TEST$ no_syntax_error - -step s1( - f: () -> () -) {} - -step s2( - f: () -> result: Int -) {} - -step s3( - f: (@AnnotationUse a: Int, vararg b: Int = 3) -> (@AnnotationUse a: Int, b: Int) -) {} diff --git a/DSL-langium/tests/resources/grammar/types/memberType.sdstest b/DSL-langium/tests/resources/grammar/types/memberType.sdstest deleted file mode 100644 index 6a1c72398..000000000 --- a/DSL-langium/tests/resources/grammar/types/memberType.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ no_syntax_error - -step s1( - f: OuterClass.InnerClass -) {} - -step s2( - f: (OuterClass?.MiddleClass?).InnerClass -) {} diff --git a/DSL-langium/tests/resources/grammar/types/namedType.sdstest b/DSL-langium/tests/resources/grammar/types/namedType.sdstest deleted file mode 100644 index f1c335e6a..000000000 --- a/DSL-langium/tests/resources/grammar/types/namedType.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ no_syntax_error - -step s1( - f: Int -) {} - -step s2( - f: Int<*, in Number, out Number, T = Number>? -) {} diff --git a/DSL-langium/tests/resources/grammar/types/parenthesizedType.sdstest b/DSL-langium/tests/resources/grammar/types/parenthesizedType.sdstest deleted file mode 100644 index cb4f43c7a..000000000 --- a/DSL-langium/tests/resources/grammar/types/parenthesizedType.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// $TEST$ no_syntax_error - -step s( - f: (Int) -) {} diff --git a/DSL-langium/tests/resources/grammar/types/unionType.sdstest b/DSL-langium/tests/resources/grammar/types/unionType.sdstest deleted file mode 100644 index d31a47b83..000000000 --- a/DSL-langium/tests/resources/grammar/types/unionType.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// $TEST$ no_syntax_error - -step s1( - f: union<> -) {} - -step s2( - f: union -) {} diff --git a/DSL-langium/tsconfig.json b/DSL-langium/tsconfig.json deleted file mode 100644 index 577644349..000000000 --- a/DSL-langium/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ES6", - "module": "commonjs", - "lib": ["ESNext"], - "sourceMap": true, - "outDir": "out", - "strict": true, - "noUnusedLocals": true, - "noImplicitReturns": true, - "noImplicitOverride": true, - "moduleResolution": "node", - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["src/**/*.ts", "tests/**/*.ts"], - "exclude": ["out", "node_modules"] -} diff --git a/DSL/.gitignore b/DSL/.gitignore deleted file mode 100644 index ea53e4103..000000000 --- a/DSL/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Xtext test module (gets created by workflow but removed afterwards) -com.larsreimann.safeds.tests/ diff --git a/DSL-langium/.vscodeignore b/DSL/.vscodeignore similarity index 100% rename from DSL-langium/.vscodeignore rename to DSL/.vscodeignore diff --git a/DSL/README.md b/DSL/README.md deleted file mode 100644 index 0633ca0b9..000000000 --- a/DSL/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# DSL - -## Installation for Developers - -1. Install [VS Code](https://code.visualstudio.com/). -2. Clone this repository. -3. Build everything: - ```shell - ./gradlew build - ``` - -## Execution - -### Running the VS Code Extension - -1. Ensure VS Code is closed. -2. Install the extension and launch VS Code: - ```shell - ./gradlew launchVSCode - ``` - -### Generating the Stdlib documentation - -```shell -./gradlew generateStdlibDocumentation -``` diff --git a/DSL/build.gradle.kts b/DSL/build.gradle.kts deleted file mode 100644 index 4250a0bb6..000000000 --- a/DSL/build.gradle.kts +++ /dev/null @@ -1,230 +0,0 @@ -import com.larsreimann.safeds.xtextConfiguration.code -import com.larsreimann.safeds.xtextConfiguration.configuration -import com.larsreimann.safeds.xtextConfiguration.directoryCleaner -import com.larsreimann.safeds.xtextConfiguration.ecoreGenerator -import com.larsreimann.safeds.xtextConfiguration.execute -import com.larsreimann.safeds.xtextConfiguration.project -import com.larsreimann.safeds.xtextConfiguration.projectMapping -import com.larsreimann.safeds.xtextConfiguration.standaloneSetup -import com.larsreimann.safeds.xtextConfiguration.standardLanguage -import com.larsreimann.safeds.xtextConfiguration.workflow -import com.larsreimann.safeds.xtextConfiguration.xtext2langium -import com.larsreimann.safeds.xtextConfiguration.xtextGenerator -import org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2 -import org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2 -import org.eclipse.xtext.xtext.generator.junit.JUnitFragment -import org.eclipse.xtext.xtext.generator.model.project.BundleProjectConfig -import org.eclipse.xtext.xtext.generator.model.project.RuntimeProjectConfig -import org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 -import org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2 - -// Plugins ------------------------------------------------------------------------------------------------------------- - -plugins { - base - idea - id("org.jetbrains.kotlinx.kover") version "0.6.1" - - kotlin("jvm") version "1.8.10" apply false - id("com.github.node-gradle.node") version "3.5.1" apply false - id("org.jetbrains.dokka") version "1.8.10" apply false -} - -repositories { - mavenCentral() -} - -idea { - module { - excludeDirs.add(file("gradle")) - } -} - -koverMerged { - enable() - - filters { - projects { - excludes += listOf( - "Safe-DS.DSL", - "com.larsreimann.safeds.vscode", - ) - } - - classes { - excludes += listOf( - "com.larsreimann.safeds.parser.antlr.*", - "com.larsreimann.safeds.serializer.AbstractSafeDSSemanticSequencer", - "com.larsreimann.safeds.serializer.AbstractSafeDSSyntacticSequencer", - "com.larsreimann.safeds.services.*", - "com.larsreimann.safeds.safeDS.*", - "com.larsreimann.safeds.testing.*", - "com.larsreimann.safeds.ide.contentassist.antlr.*", - ) - } - } - - verify { - rule { - name = "Minimal line coverage rate in percents" - bound { - minValue = 80 - } - } - } -} - -// Variables ----------------------------------------------------------------------------------------------------------- - -val javaVersion by extra(17) -val xtextVersion by extra("2.27.0") - -// Subprojects --------------------------------------------------------------------------------------------------------- - -subprojects { - group = "com.larsreimann.safe-ds" - version = "1.0.0" - - repositories { - mavenCentral() - } -} - -// Tasks --------------------------------------------------------------------------------------------------------------- - -tasks.register("generateXtextLanguage") { - val rootPath = this.project.rootDir.path - - group = "Build" - description = "Generate language files (e.g. EMF classes)" - - outputs.cacheIf { true } - - inputs.files( - "$rootPath/com.larsreimann.safeds/model/SafeDS.ecore", - "$rootPath/com.larsreimann.safeds/model/SafeDS.genmodel", - "$rootPath/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDS.xtext", - ) - outputs.dirs( - "$rootPath/com.larsreimann.safeds/META-INF", - "$rootPath/com.larsreimann.safeds/emf-gen", - "$rootPath/com.larsreimann.safeds/src-gen", - "$rootPath/com.larsreimann.safeds.ide/src-gen", - "$rootPath/com.larsreimann.safeds.tests", - ) - outputs.files( - "$rootPath/com.larsreimann.safeds/build.properties", - "$rootPath/com.larsreimann.safeds/plugin.properties", - "$rootPath/com.larsreimann.safeds/plugin.xml", - ) - - doFirst { - workflow { - standaloneSetup { - setPlatformUri(rootPath) - setScanClassPath(true) - - projectMapping( - projectName = "com.larsreimann.safeds", - path = "$rootPath/com.larsreimann.safeds", - ) - - projectMapping( - projectName = "com.larsreimann.safeds.ide", - path = "$rootPath/com.larsreimann.safeds.ide", - ) - } - - directoryCleaner("$rootPath/com.larsreimann.safeds/emf-gen") - - ecoreGenerator( - genModel = "platform:/resource/com.larsreimann.safeds/model/SafeDS.genmodel", - srcPaths = listOf("platform:/resource/com.larsreimann.safeds/src/main/kotlin"), - ) - - xtextGenerator { - configuration { - project { - baseName = "com.larsreimann.safeds" - this.rootPath = rootPath - - runtime = RuntimeProjectConfig().apply { - setSrc("$rootPath/com.larsreimann.safeds/src/main/kotlin") - } - - genericIde = BundleProjectConfig().apply { - isEnabled = true - setSrc("$rootPath/com.larsreimann.safeds.ide/src/main/kotlin") - } - - runtimeTest = BundleProjectConfig().apply { - isEnabled = false - } - - isCreateEclipseMetaData = false - } - - code { - encoding = "UTF-8" - lineDelimiter = "\n" - fileHeader = "/*\n * generated by Xtext \${version}\n */" - isPreferXtendStubs = true - } - } - - standardLanguage { - setName("com.larsreimann.safeds.SafeDS") - setFileExtensions("sdspipe,sdsschema,sdsstub,sdstest") - addReferencedResource("platform:/resource/com.larsreimann.safeds/model/SafeDS.genmodel") - - setFormatter( - Formatter2Fragment2().apply { - isGenerateStub = true - }, - ) - - setGenerator( - GeneratorFragment2().apply { - isGenerateXtendMain = false - }, - ) - - setSerializer( - SerializerFragment2().apply { - isGenerateStub = true - }, - ) - - setValidator( - ValidatorFragment2().apply { - isGenerateDeprecationValidation = true - }, - ) - - setJunitSupport( - JUnitFragment().apply { - setJunitVersion("5") - isGenerateStub = false - }, - ) - - xtext2langium("./langium") - } - } - }.execute() - } - - doLast { - delete( - fileTree("$rootPath/com.larsreimann.safeds/src") { - include("**/*.xtend") - }, - ) - delete( - fileTree("$rootPath/com.larsreimann.safeds.ide/src") { - include("**/*.xtend") - }, - ) - delete(file("$rootPath/com.larsreimann.safeds.tests")) - } -} diff --git a/DSL/buildSrc/build.gradle.kts b/DSL/buildSrc/build.gradle.kts deleted file mode 100644 index 1fc668548..000000000 --- a/DSL/buildSrc/build.gradle.kts +++ /dev/null @@ -1,38 +0,0 @@ -val javaVersion by extra(11) -val xtextVersion by extra("2.26.0.M2") - -// Plugins ------------------------------------------------------------------------------------------------------------- - -plugins { - kotlin("jvm") version "1.8.10" - idea -} - -repositories { - mavenCentral() -} - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(javaVersion)) - } -} - -// Dependencies -------------------------------------------------------------------------------------------------------- - -dependencies { - api(platform("org.eclipse.xtext:xtext-dev-bom:$xtextVersion")) - implementation("org.eclipse.xtext:org.eclipse.xtext:$xtextVersion") - - implementation("org.eclipse.emf:org.eclipse.emf.mwe2.launch:2.14.0") - implementation("org.eclipse.xtext:org.eclipse.xtext.common.types:$xtextVersion") - implementation("org.eclipse.xtext:org.eclipse.xtext.xtext.generator:$xtextVersion") - implementation("org.eclipse.xtext:xtext-antlr-generator:2.1.1") - implementation("io.typefox.xtext2langium:io.typefox.xtext2langium:0.4.0") -} - -// Tasks --------------------------------------------------------------------------------------------------------------- - -tasks.withType().configureEach { - kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" -} diff --git a/DSL/buildSrc/src/main/kotlin/com/larsreimann/safeds/xtextConfiguration/XtextConfigurationDsl.kt b/DSL/buildSrc/src/main/kotlin/com/larsreimann/safeds/xtextConfiguration/XtextConfigurationDsl.kt deleted file mode 100644 index 6f2ce6cb8..000000000 --- a/DSL/buildSrc/src/main/kotlin/com/larsreimann/safeds/xtextConfiguration/XtextConfigurationDsl.kt +++ /dev/null @@ -1,83 +0,0 @@ -@file:Suppress("unused") - -package com.larsreimann.safeds.xtextConfiguration - -import io.typefox.xtext2langium.Xtext2LangiumFragment -import org.eclipse.emf.mwe.utils.DirectoryCleaner -import org.eclipse.emf.mwe.utils.ProjectMapping -import org.eclipse.emf.mwe.utils.StandaloneSetup -import org.eclipse.emf.mwe2.ecore.EcoreGenerator -import org.eclipse.emf.mwe2.runtime.workflow.Workflow -import org.eclipse.emf.mwe2.runtime.workflow.WorkflowContextImpl -import org.eclipse.xtext.xtext.generator.CodeConfig -import org.eclipse.xtext.xtext.generator.DefaultGeneratorModule -import org.eclipse.xtext.xtext.generator.StandardLanguage -import org.eclipse.xtext.xtext.generator.XtextGenerator -import org.eclipse.xtext.xtext.generator.model.project.StandardProjectConfig - -fun workflow(init: Workflow.() -> Unit): Workflow { - return Workflow().apply(init) -} - -fun Workflow.standaloneSetup(init: StandaloneSetup.() -> Unit) { - addBean(StandaloneSetup().apply(init)) -} - -fun StandaloneSetup.projectMapping(projectName: String, path: String) { - addProjectMapping( - ProjectMapping().apply { - this.projectName = projectName - this.path = path - }, - ) -} - -fun Workflow.directoryCleaner(directory: String) { - addComponent( - DirectoryCleaner().apply { - setDirectory(directory) - }, - ) -} - -fun Workflow.ecoreGenerator(genModel: String, srcPaths: List, init: EcoreGenerator.() -> Unit = {}) { - addComponent( - EcoreGenerator().apply { - setGenModel(genModel) - srcPaths.forEach { addSrcPath(it) } - init() - }, - ) -} - -fun Workflow.xtextGenerator(init: XtextGenerator.() -> Unit) { - addComponent(XtextGenerator().apply(init)) -} - -fun XtextGenerator.configuration(init: DefaultGeneratorModule.() -> Unit) { - configuration = DefaultGeneratorModule().apply(init) -} - -fun DefaultGeneratorModule.project(init: StandardProjectConfig.() -> Unit) { - project = StandardProjectConfig().apply(init) -} - -fun DefaultGeneratorModule.code(init: CodeConfig.() -> Unit) { - code = CodeConfig().apply(init) -} - -fun XtextGenerator.standardLanguage(init: StandardLanguage.() -> Unit) { - addLanguage(StandardLanguage().apply(init)) -} - -fun StandardLanguage.xtext2langium(outputPath: String) { - this.addFragment( - Xtext2LangiumFragment().apply { - setOutputPath(outputPath) - }, - ) -} - -fun Workflow.execute() { - run(WorkflowContextImpl()) -} diff --git a/DSL/com.larsreimann.safeds.ide/.gitignore b/DSL/com.larsreimann.safeds.ide/.gitignore deleted file mode 100644 index f96c8ba13..000000000 --- a/DSL/com.larsreimann.safeds.ide/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/test-data -src-gen/ -*.xtend diff --git a/DSL/com.larsreimann.safeds.ide/build.gradle.kts b/DSL/com.larsreimann.safeds.ide/build.gradle.kts deleted file mode 100644 index f8745fd58..000000000 --- a/DSL/com.larsreimann.safeds.ide/build.gradle.kts +++ /dev/null @@ -1,75 +0,0 @@ -val javaVersion: Int by rootProject.extra -val xtextVersion: String by rootProject.extra - -// Plugins ------------------------------------------------------------------------------------------------------------- - -plugins { - java - kotlin("jvm") - application - id("org.jetbrains.kotlinx.kover") -} - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(javaVersion)) - } -} - -application { - mainClass.set("com.larsreimann.safeds.ide.ServerLauncher2") -} - -kover { - filters { - classes { - excludes += "com.larsreimann.safeds.ide.contentassist.antlr.*" - } - } - - verify { - rule { - name = "Minimal line coverage rate in percents" - bound { - minValue = 33 - } - } - } -} - -// Dependencies -------------------------------------------------------------------------------------------------------- - -dependencies { - implementation(project(":com.larsreimann.safeds")) - implementation("org.eclipse.xtext:org.eclipse.xtext.ide:$xtextVersion") - - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") - testImplementation(testFixtures(project(":com.larsreimann.safeds"))) - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.eclipse.xtext:org.eclipse.xtext.testing:$xtextVersion") - testImplementation("org.eclipse.xtext:org.eclipse.xtext.xbase.testing:$xtextVersion") - testImplementation("io.kotest:kotest-assertions-core-jvm:5.5.5") -} - -// Source sets --------------------------------------------------------------------------------------------------------- - -sourceSets { - main { - java.srcDirs("src-gen") - resources.srcDirs("src-gen") - resources.include("**/*.ISetup") - } -} - -// Tasks --------------------------------------------------------------------------------------------------------------- - -tasks { - processResources { - val generateXtextLanguage = rootProject.tasks.named("generateXtextLanguage") - dependsOn(generateXtextLanguage) - } - - test { - useJUnitPlatform() - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/CustomServerModule.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/CustomServerModule.kt deleted file mode 100644 index 0df2edcc2..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/CustomServerModule.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.larsreimann.safeds.ide - -import com.larsreimann.safeds.ide.server.project.SafeDSProjectManager -import org.eclipse.xtext.ide.server.ProjectManager -import org.eclipse.xtext.ide.server.ServerModule - -class CustomServerModule : ServerModule() { - override fun configure() { - super.configure() - bind(ProjectManager::class.java).to(SafeDSProjectManager::class.java) - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/SafeDSIdeModule.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/SafeDSIdeModule.kt deleted file mode 100644 index 929d2bf9f..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/SafeDSIdeModule.kt +++ /dev/null @@ -1,57 +0,0 @@ -package com.larsreimann.safeds.ide - -import com.larsreimann.safeds.ide.editor.contentassist.SafeDSIdeContentProposalProvider -import com.larsreimann.safeds.ide.server.codelens.SafeDSCodeLensProvider -import com.larsreimann.safeds.ide.server.commands.SafeDSExecutableCommandService -import com.larsreimann.safeds.ide.server.hover.SafeDSHoverService -import com.larsreimann.safeds.ide.server.symbol.SafeDSDocumentSymbolDeprecationInfoProvider -import com.larsreimann.safeds.ide.server.symbol.SafeDSDocumentSymbolDetailsProvider -import com.larsreimann.safeds.ide.server.symbol.SafeDSDocumentSymbolKindProvider -import com.larsreimann.safeds.ide.server.symbol.SafeDSDocumentSymbolNameProvider -import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider -import org.eclipse.xtext.ide.server.codelens.ICodeLensResolver -import org.eclipse.xtext.ide.server.codelens.ICodeLensService -import org.eclipse.xtext.ide.server.commands.IExecutableCommandService -import org.eclipse.xtext.ide.server.hover.HoverService -import org.eclipse.xtext.ide.server.symbol.DocumentSymbolMapper - -/** - * Use this class to register IDE components. - */ -class SafeDSIdeModule : AbstractSafeDSIdeModule() { - fun bindICodeLensResolver(): Class { - return SafeDSCodeLensProvider::class.java - } - - fun bindICodeLensService(): Class { - return SafeDSCodeLensProvider::class.java - } - - fun bindIExecutableCommandService(): Class { - return SafeDSExecutableCommandService::class.java - } - - fun bindDocumentSymbolDeprecationInfoProvider(): Class { - return SafeDSDocumentSymbolDeprecationInfoProvider::class.java - } - - fun bindDocumentSymbolDetailsProvider(): Class { - return SafeDSDocumentSymbolDetailsProvider::class.java - } - - fun bindDocumentSymbolKindProvider(): Class { - return SafeDSDocumentSymbolKindProvider::class.java - } - - fun bindDocumentSymbolNameProvider(): Class { - return SafeDSDocumentSymbolNameProvider::class.java - } - - fun bindIdeContentProposalProvider(): Class { - return SafeDSIdeContentProposalProvider::class.java - } - - fun bindHoverService(): Class { - return SafeDSHoverService::class.java - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/SafeDSIdeSetup.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/SafeDSIdeSetup.kt deleted file mode 100644 index 76dc31820..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/SafeDSIdeSetup.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.larsreimann.safeds.ide - -import com.google.inject.Guice -import com.google.inject.Injector -import com.larsreimann.safeds.SafeDSRuntimeModule -import com.larsreimann.safeds.SafeDSStandaloneSetup -import org.eclipse.xtext.util.Modules2 - -/** - * Initialization support for running Xtext languages as language servers. - */ -class SafeDSIdeSetup : SafeDSStandaloneSetup() { - override fun createInjector(): Injector? { - return Guice.createInjector(Modules2.mixin(SafeDSRuntimeModule(), SafeDSIdeModule())) - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/ServerLauncher2.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/ServerLauncher2.kt deleted file mode 100644 index ed0c970ee..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/ServerLauncher2.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.larsreimann.safeds.ide - -import org.eclipse.xtext.ide.server.ServerLauncher - -class ServerLauncher2 { - companion object { - - @JvmStatic - fun main(args: Array) { - ServerLauncher.launch(ServerLauncher2::class.java.name, args, CustomServerModule()) - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/editor/contentassist/Proposals.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/editor/contentassist/Proposals.kt deleted file mode 100644 index 4fd853e4d..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/editor/contentassist/Proposals.kt +++ /dev/null @@ -1,162 +0,0 @@ -package com.larsreimann.safeds.ide.editor.contentassist - -import com.larsreimann.safeds.emf.classMembersOrEmpty -import com.larsreimann.safeds.emf.containingClassOrNull -import com.larsreimann.safeds.emf.isClassMember -import com.larsreimann.safeds.emf.isGlobal -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.variantsOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractCallable -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.scoping.allGlobalDeclarations -import com.larsreimann.safeds.staticAnalysis.typing.Type -import com.larsreimann.safeds.staticAnalysis.typing.hasPrimitiveType -import com.larsreimann.safeds.staticAnalysis.typing.isSubstitutableFor -import com.larsreimann.safeds.staticAnalysis.typing.type -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.EcoreUtil2 - -/** - * Suggests callables that only require primitive values as arguments when called. - * - * @param context - * Any EObject in the current file, e.g. the [SdsCompilationUnit]. This is used to determine which declarations are - * visible from here. - * - * @return - * A map of URIs to EObjects ([SdsClass], [SdsFunction], or [SdsStep]). - */ -fun listCallablesWithOnlyPrimitiveParameters(context: EObject): Map { - return context.allCallables() - .filterValues { obj -> - when (obj) { - is SdsClass -> { - obj.parameterList != null && obj.parametersOrEmpty().all { - it.hasPrimitiveType() - } - } - is SdsFunction -> { - obj.isGlobal() && obj.parametersOrEmpty().all { - it.hasPrimitiveType() - } - } - is SdsStep -> { - obj.parametersOrEmpty().all { - it.hasPrimitiveType() - } - } - else -> false - } - } -} - -/** - * Suggests callables that can accept all the given [declarations] as parameters. These callables can still have - * additional parameters that are not yet assigned. - * - * @param context - * Any EObject in the current file, e.g. the [SdsCompilationUnit]. This is used to determine which declarations are - * visible from here. - * - * @param declarations - * The declarations that correspond to the result port the user clicked on or null if a new initial call should - * be added. They should be either SdsPlaceholders or SdsResults. If multiple declarations are specified, a callable - * must have one matching input port for each. - * - * @return - * A map of URIs to EObjects ([SdsClass], [SdsFunction], or [SdsStep]). - */ -fun listCallablesWithMatchingParameters( - context: EObject, - declarations: List, -): Map { - val requiredTypes = declarations.map { it.type() } - - return context.allCallables() - .filterValues { obj -> - val availableTypes = when (obj) { - is SdsClass -> { - if (obj.parameterList == null) { - return@filterValues false - } - - obj.parametersOrEmpty().map { it.type() } - } - is SdsEnumVariant -> { - obj.parametersOrEmpty().map { it.type() } - } - is SdsFunction -> { - val parameterTypes = obj.parametersOrEmpty().map { it.type() } - if (obj.isClassMember()) { - parameterTypes + obj.containingClassOrNull()!!.type() - } else { - parameterTypes - } - } - is SdsStep -> { - obj.parametersOrEmpty().map { it.type() } - } - else -> return@filterValues false - } - - typesMatch(requiredTypes, availableTypes) - } -} - -private fun typesMatch(requiredTypes: List, availableTypes: List): Boolean { - if (requiredTypes.isEmpty()) { - return true - } - - val requiredType = requiredTypes.first() - - val matchingAvailableTypes = availableTypes.filter { requiredType.isSubstitutableFor(it) } - if (matchingAvailableTypes.isEmpty()) { - return false - } - - return matchingAvailableTypes.any { - typesMatch(requiredTypes.drop(1), availableTypes - it) - } -} - -/** - * Lists all [SdsAbstractCallable]s that can be called from the given context. - */ -private fun EObject.allCallables(): Map { - return allGlobalDeclarations() - .flatMap { - when (val obj = it.eObjectOrProxy) { - is SdsClass -> obj.allNestedCallables().toList() - is SdsEnum -> obj.variantsOrEmpty() - is SdsFunction -> listOf(obj) - is SdsStep -> listOf(obj) - else -> emptyList() - } - } - .associateBy { EcoreUtil2.getURI(it) } -} - -/** - * Lists all [SdsAbstractCallable]s nested in an [SdsClass]. - */ -private fun SdsClass.allNestedCallables(): Sequence = sequence { - if (parameterList != null) { - yield(this@allNestedCallables) - } - - classMembersOrEmpty().forEach { - when (it) { - is SdsClass -> yieldAll(it.allNestedCallables()) - is SdsEnum -> yieldAll(it.variantsOrEmpty()) - is SdsFunction -> yield(it) - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/editor/contentassist/SafeDSIdeContentProposalProvider.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/editor/contentassist/SafeDSIdeContentProposalProvider.kt deleted file mode 100644 index 825e068a9..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/editor/contentassist/SafeDSIdeContentProposalProvider.kt +++ /dev/null @@ -1,91 +0,0 @@ -package com.larsreimann.safeds.ide.editor.contentassist - -import com.google.inject.Inject -import com.larsreimann.safeds.safeDS.SdsArgumentList -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.services.SafeDSGrammarAccess -import com.larsreimann.safeds.staticAnalysis.linking.parametersOrNull -import org.eclipse.xtext.Assignment -import org.eclipse.xtext.Keyword -import org.eclipse.xtext.RuleCall -import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext -import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor -import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider -import org.eclipse.xtext.scoping.IScopeProvider - -class SafeDSIdeContentProposalProvider @Inject constructor( - private val grammarAccess: SafeDSGrammarAccess, - private val scopeProvider2: IScopeProvider, -) : IdeContentProposalProvider() { - - private val crossReferencePriority = 500 - private val snippetPriority = 450 - private val defaultPriority = 400 - - override fun _createProposals( - ruleCall: RuleCall, - context: ContentAssistContext, - acceptor: IIdeContentProposalAcceptor, - ) { - val rule = ruleCall.rule - val model = context.currentModel - - println("Auto-completion rule: $rule") - println("Auto-completion model: $model") - - when { - model is SdsCompilationUnit -> { - completeGlobalSnippets(context, acceptor) - } - model is SdsArgumentList && rule == grammarAccess.sdsCallArgumentRule -> { - completeSdsCallArguments(model, context, acceptor) - } - } - } - - override fun _createProposals( - assignment: Assignment, - context: ContentAssistContext, - acceptor: IIdeContentProposalAcceptor, - ) { - println("Auto-completion assignment: $assignment") - - // Intentionally left blank so assignments don't get suggested - } - - override fun _createProposals( - keyword: Keyword, - context: ContentAssistContext, - acceptor: IIdeContentProposalAcceptor, - ) { - println("Auto-completion keyword: $keyword") - - // Intentionally left blank so keywords don't get suggested - } - - private fun completeGlobalSnippets( - context: ContentAssistContext, - acceptor: IIdeContentProposalAcceptor, - ) { - val pipeline = """ - |pipeline ${'$'}{1:name} { - | ${'$'}{2:body} - |} - """.trimMargin() - - acceptor.accept(proposalCreator.createSnippet(pipeline, "pipeline", context), snippetPriority) - } - - private fun completeSdsCallArguments( - model: SdsArgumentList, - context: ContentAssistContext, - acceptor: IIdeContentProposalAcceptor, - ) { - val usedParameters = model.arguments.map { it.parameter }.toSet() - model.parametersOrNull() - ?.filter { it !in usedParameters && !it.isVariadic } - ?.forEach { - acceptor.accept(proposalCreator.createProposal("${it.name} = ", context), crossReferencePriority) - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/codelens/SafeDSCodeLensProvider.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/codelens/SafeDSCodeLensProvider.kt deleted file mode 100644 index ef4753f34..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/codelens/SafeDSCodeLensProvider.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.larsreimann.safeds.ide.server.codelens - -import com.google.inject.Inject -import org.eclipse.lsp4j.CodeLens -import org.eclipse.lsp4j.CodeLensParams -import org.eclipse.xtext.ide.server.Document -import org.eclipse.xtext.ide.server.codelens.ICodeLensResolver -import org.eclipse.xtext.ide.server.codelens.ICodeLensService -import org.eclipse.xtext.ide.server.symbol.DocumentSymbolMapper -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.service.OperationCanceledManager -import org.eclipse.xtext.util.CancelIndicator - -class SafeDSCodeLensProvider : ICodeLensResolver, ICodeLensService { - - @Inject - private lateinit var operationCanceledManager: OperationCanceledManager - - @Inject - private lateinit var rangeProvider: DocumentSymbolMapper.DocumentSymbolRangeProvider - - override fun computeCodeLenses( - document: Document, - resource: XtextResource, - params: CodeLensParams, - indicator: CancelIndicator, - ): List { - return emptyList() - } - - override fun resolveCodeLens( - document: Document, - resource: XtextResource, - codeLens: CodeLens, - indicator: CancelIndicator, - ): CodeLens { - return codeLens - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/commands/CommandId.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/commands/CommandId.kt deleted file mode 100644 index 5b7385a30..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/commands/CommandId.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.larsreimann.safeds.ide.server.commands - -enum class CommandId { - RemoveOnceOtherCommandsAreAdded, - ; - - override fun toString(): String { - return "safe-ds." + this.name - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/commands/SafeDSExecutableCommandService.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/commands/SafeDSExecutableCommandService.kt deleted file mode 100644 index 0367d357c..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/commands/SafeDSExecutableCommandService.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.larsreimann.safeds.ide.server.commands - -import com.google.inject.Inject -import org.eclipse.lsp4j.ExecuteCommandParams -import org.eclipse.xtext.ide.server.ILanguageServerAccess -import org.eclipse.xtext.ide.server.commands.IExecutableCommandService -import org.eclipse.xtext.service.OperationCanceledManager -import org.eclipse.xtext.util.CancelIndicator - -class SafeDSExecutableCommandService : IExecutableCommandService { - - @Inject - private lateinit var operationCanceledManager: OperationCanceledManager - - override fun initialize(): List { - return emptyList() - } - - override fun execute( - params: ExecuteCommandParams, - access: ILanguageServerAccess, - cancelIndicator: CancelIndicator, - ): Any { - return when (params.command) { - CommandId.RemoveOnceOtherCommandsAreAdded.toString() -> {} - else -> { - throw IllegalArgumentException("Unknown command '${params.command}'.") - } - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/hover/SafeDSHoverService.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/hover/SafeDSHoverService.kt deleted file mode 100644 index e397fb65f..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/hover/SafeDSHoverService.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.larsreimann.safeds.ide.server.hover - -import com.google.inject.Inject -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.documentation.IEObjectDocumentationProvider -import org.eclipse.xtext.ide.labels.INameLabelProvider -import org.eclipse.xtext.ide.server.hover.HoverService - -class SafeDSHoverService @Inject constructor( - private val documentationProvider: IEObjectDocumentationProvider, - private val nameLabelProvider: INameLabelProvider, -) : HoverService() { - - override fun getContents(obj: EObject): String { - val documentation = documentationProvider.getDocumentation(obj) - return if (documentation == null) { - getFirstLine(obj) - } else { - "${getFirstLine(obj)} \n$documentation" - } - } - - private fun getFirstLine(obj: EObject): String { - val label = nameLabelProvider.getNameLabel(obj) - return if (label == null) { - obj.eClass().name - } else { - "${obj.eClass().name} **$label**" - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/project/SafeDSProjectManager.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/project/SafeDSProjectManager.kt deleted file mode 100644 index 1fc53d3e3..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/project/SafeDSProjectManager.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.larsreimann.safeds.ide.server.project - -import com.larsreimann.safeds.stdlibAccess.listStdlibFiles -import org.eclipse.xtext.build.IncrementalBuilder -import org.eclipse.xtext.ide.server.ProjectManager -import org.eclipse.xtext.util.CancelIndicator - -class SafeDSProjectManager : ProjectManager() { - - override fun doInitialBuild(cancelIndicator: CancelIndicator): IncrementalBuilder.Result { - // Load Stdlib first to prevent errors when it is edited in VS Code (`simple.lang` would be overridden) - val uris = listStdlibFiles().map { it.second }.toMutableList() - uris += projectConfig.sourceFolders - .flatMap { srcFolder -> srcFolder.getAllResources(fileSystemScanner) } - - return doBuild(uris, emptyList(), emptyList(), cancelIndicator) - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolDeprecationInfoProvider.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolDeprecationInfoProvider.kt deleted file mode 100644 index b1399d49d..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolDeprecationInfoProvider.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.larsreimann.safeds.ide.server.symbol - -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.stdlibAccess.isDeprecated -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.ide.server.symbol.DocumentSymbolMapper -import org.eclipse.xtext.resource.IEObjectDescription - -class SafeDSDocumentSymbolDeprecationInfoProvider : DocumentSymbolMapper.DocumentSymbolDeprecationInfoProvider() { - - override fun isDeprecated(obj: EObject): Boolean { - if (obj !is SdsAbstractDeclaration) { - return false - } - - return obj.isDeprecated() - } - - override fun isDeprecated(description: IEObjectDescription): Boolean { - return isDeprecated(description.eObjectOrProxy) - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolDetailsProvider.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolDetailsProvider.kt deleted file mode 100644 index 5338c8678..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolDetailsProvider.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.larsreimann.safeds.ide.server.symbol - -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.ide.server.symbol.DocumentSymbolMapper - -class SafeDSDocumentSymbolDetailsProvider : DocumentSymbolMapper.DocumentSymbolDetailsProvider() { - override fun getDetails(obj: EObject?): String { - return "" - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolKindProvider.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolKindProvider.kt deleted file mode 100644 index ca5650990..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolKindProvider.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.larsreimann.safeds.ide.server.symbol - -import com.larsreimann.safeds.emf.isClassMember -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsFunction -import org.eclipse.emf.ecore.EClass -import org.eclipse.emf.ecore.EObject -import org.eclipse.lsp4j.SymbolKind -import org.eclipse.xtext.ide.server.symbol.DocumentSymbolMapper -import org.eclipse.xtext.resource.IEObjectDescription - -class SafeDSDocumentSymbolKindProvider : DocumentSymbolMapper.DocumentSymbolKindProvider() { - override fun getSymbolKind(obj: EObject?): SymbolKind? { - if (obj is SdsFunction && obj.isClassMember()) { - return SymbolKind.Method - } - - return obj?.let { getSymbolKind(it.eClass()) } - } - - override fun getSymbolKind(description: IEObjectDescription?): SymbolKind? { - return getSymbolKind(description?.eObjectOrProxy) - } - - override fun getSymbolKind(clazz: EClass): SymbolKind? { - return when (clazz) { - Literals.SDS_ANNOTATION -> SymbolKind.Interface // Not ideal but matches @interface in Java - Literals.SDS_ATTRIBUTE -> SymbolKind.Field - Literals.SDS_CLASS -> SymbolKind.Class - Literals.SDS_COMPILATION_UNIT -> SymbolKind.Package - Literals.SDS_ENUM -> SymbolKind.Enum - Literals.SDS_ENUM_VARIANT -> SymbolKind.EnumMember - Literals.SDS_FUNCTION -> SymbolKind.Function - Literals.SDS_PIPELINE -> SymbolKind.Function - Literals.SDS_STEP -> SymbolKind.Function - else -> null - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolNameProvider.kt b/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolNameProvider.kt deleted file mode 100644 index a93de5bf5..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/main/kotlin/com/larsreimann/safeds/ide/server/symbol/SafeDSDocumentSymbolNameProvider.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.larsreimann.safeds.ide.server.symbol - -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.ide.server.symbol.DocumentSymbolMapper -import org.eclipse.xtext.resource.IEObjectDescription - -class SafeDSDocumentSymbolNameProvider : DocumentSymbolMapper.DocumentSymbolNameProvider() { - override fun getName(obj: EObject): String? { - return (obj as? SdsAbstractDeclaration)?.name - } - - override fun getName(description: IEObjectDescription): String? { - return getName(description.eObjectOrProxy) - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/AbstractSafeDSLanguageServerTest.kt b/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/AbstractSafeDSLanguageServerTest.kt deleted file mode 100644 index e476417e9..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/AbstractSafeDSLanguageServerTest.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.larsreimann.safeds.ide - -import com.larsreimann.safeds.constant.SdsFileExtension -import org.eclipse.lsp4j.InitializeParams -import org.eclipse.lsp4j.InitializeResult -import org.eclipse.xtext.testing.AbstractLanguageServerTest -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1 -import java.lang.IllegalStateException - -abstract class AbstractSafeDSLanguageServerTest : AbstractLanguageServerTest(SdsFileExtension.Test.extension) { - - /** - * This override is necessary since `LanguageServerImpl` throws if it is initialized twice. - */ - override fun initialize(initializer: Procedure1?): InitializeResult? { - return try { - this.initialize(initializer, true) - } catch (e: IllegalStateException) { - null - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/editor/contentassist/ProposalsTest.kt b/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/editor/contentassist/ProposalsTest.kt deleted file mode 100644 index 074ffb601..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/editor/contentassist/ProposalsTest.kt +++ /dev/null @@ -1,181 +0,0 @@ -package com.larsreimann.safeds.ide.editor.contentassist - -import com.google.inject.Inject -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.maps.shouldContainValue -import io.kotest.matchers.maps.shouldContainValues -import io.kotest.matchers.maps.shouldNotContainValue -import io.kotest.matchers.nulls.shouldNotBeNull -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class ProposalsTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - private val testProgram = """ - |package test - | - |step primitive_empty() {} - |step primitive_boolean(b: Boolean) {} - |step primitive_float(f: Float) {} - |step primitive_int(i: Int) {} - |step primitive_string(s: String) {} - | - |class A() - |class B() - |class C() { - | fun someMethod() - |} - |class D() sub C - | - |step matching_a(a: A) {} - |step matching_b(b: B) {} - |step matching_multiple_c(c1: C, c2: C) {} - |step not_matching_multiple_c(c: C) {} - |step matching_multiple_c_d(c: C, d: D) {} - |step matching_multiple_d_c(d: D, c: C) {} - | - |step test_callee() -> (test_result_a: A, test_result_c: C) { - | val test_placeholder_a = A(); - | val test_placeholder_d = D(); - |} - """.trimMargin() - - @Nested - inner class ListCallablesWithOnlyPrimitiveParameters { - - @Test - fun `should contain steps with primitive parameters`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val steps = context.members - .asSequence() - .filterIsInstance() - .filter { it.name.startsWith("primitive") } - .toList() - steps.shouldHaveSize(5) - - val descriptions = listCallablesWithOnlyPrimitiveParameters(context) - descriptions.shouldContainValues(*steps.toTypedArray()) - } - } - - @Nested - inner class ListCallablesWithMatchingParameters { - - @Test - fun `should contain only steps with matching parameters when a placeholder is passed`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val placeholder = context.findUniqueDeclarationOrFail("test_placeholder_a") - val stepA = context.findUniqueDeclarationOrFail("matching_a") - val stepB = context.findUniqueDeclarationOrFail("matching_b") - - val descriptions = listCallablesWithMatchingParameters(context, listOf(placeholder)) - descriptions.shouldContainValue(stepA) - descriptions.shouldNotContainValue(stepB) - } - - @Test - fun `should contain only steps with matching parameters when a result is passed`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val result = context.findUniqueDeclarationOrFail("test_result_a") - val stepA = context.findUniqueDeclarationOrFail("matching_a") - val stepB = context.findUniqueDeclarationOrFail("matching_b") - - val descriptions = listCallablesWithMatchingParameters(context, listOf(result)) - descriptions.shouldContainValue(stepA) - descriptions.shouldNotContainValue(stepB) - } - - @Test - fun `should contain only steps with matching parameters when multiple declarations are passed (1)`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val result = context.findUniqueDeclarationOrFail("test_result_c") - val matchingStep = context.findUniqueDeclarationOrFail("matching_multiple_c") - val nonMatchingStep = context.findUniqueDeclarationOrFail("not_matching_multiple_c") - - val descriptions = listCallablesWithMatchingParameters(context, listOf(result, result)) - descriptions.shouldContainValue(matchingStep) - descriptions.shouldNotContainValue(nonMatchingStep) - } - - @Test - fun `should contain only steps with matching parameters when multiple declarations are passed (2)`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val result = context.findUniqueDeclarationOrFail("test_result_c") - val placeholder = context.findUniqueDeclarationOrFail("test_placeholder_d") - val matchingStep1 = context.findUniqueDeclarationOrFail("matching_multiple_c_d") - val matchingStep2 = context.findUniqueDeclarationOrFail("matching_multiple_d_c") - - // Inverse order of placeholder and result compared to (3) - val descriptions = listCallablesWithMatchingParameters(context, listOf(result, placeholder)) - descriptions.shouldContainValue(matchingStep1) - descriptions.shouldContainValue(matchingStep2) - } - - @Test - fun `should contain only steps with matching parameters when multiple declarations are passed (3)`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val result = context.findUniqueDeclarationOrFail("test_result_c") - val placeholder = context.findUniqueDeclarationOrFail("test_placeholder_d") - val matchingStep1 = context.findUniqueDeclarationOrFail("matching_multiple_c_d") - val matchingStep2 = context.findUniqueDeclarationOrFail("matching_multiple_d_c") - - // Inverse order of placeholder and result compared to (2) - val descriptions = listCallablesWithMatchingParameters(context, listOf(placeholder, result)) - descriptions.shouldContainValue(matchingStep1) - descriptions.shouldContainValue(matchingStep2) - } - - @Test - fun `should contain methods defined directly on class`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val result = context.findUniqueDeclarationOrFail("test_result_c") - val matchingMethod = context.findUniqueDeclarationOrFail("someMethod") - - // Inverse order of placeholder and result compared to (2) - val descriptions = listCallablesWithMatchingParameters(context, listOf(result)) - descriptions.shouldContainValue(matchingMethod) - } - - @Test - fun `should contain methods defined on superclass`() { - val context = parseHelper.parseProgramText(testProgram) - context.shouldNotBeNull() - - val placeholder = context.findUniqueDeclarationOrFail("test_placeholder_d") - val matchingMethod = context.findUniqueDeclarationOrFail("someMethod") - - // Inverse order of placeholder and result compared to (2) - val descriptions = listCallablesWithMatchingParameters(context, listOf(placeholder)) - descriptions.shouldContainValue(matchingMethod) - } - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/server/symbol/DocumentSymbolTest.kt b/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/server/symbol/DocumentSymbolTest.kt deleted file mode 100644 index 12650e3a0..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/kotlin/com/larsreimann/safeds/ide/server/symbol/DocumentSymbolTest.kt +++ /dev/null @@ -1,133 +0,0 @@ -package com.larsreimann.safeds.ide.server.symbol - -import com.larsreimann.safeds.ide.AbstractSafeDSLanguageServerTest -import com.larsreimann.safeds.location.LspRange -import com.larsreimann.safeds.testing.CategorizedTest -import com.larsreimann.safeds.testing.FindTestRangesResult -import com.larsreimann.safeds.testing.createDynamicTestsFromResourceFolder -import com.larsreimann.safeds.testing.findTestRanges -import com.larsreimann.safeds.testing.getResourcePath -import com.larsreimann.safeds.testing.testDisplayName -import org.eclipse.lsp4j.SymbolKind -import org.junit.jupiter.api.DynamicNode -import org.junit.jupiter.api.DynamicTest -import org.junit.jupiter.api.TestFactory -import java.nio.file.Path -import java.util.stream.Stream - -class DocumentSymbolTest : AbstractSafeDSLanguageServerTest() { - - @TestFactory - fun `should provide correct symbols`(): Stream { - return javaClass.classLoader - .getResourcePath("symbols") - ?.createDynamicTestsFromResourceFolder(::validateTestFile, ::createTest) - ?: Stream.empty() - } - - /** - * Checks if the given program is a valid test. If there are issues a description of the issue is returned, otherwise - * this returns null. - */ - @Suppress("UNUSED_PARAMETER") - private fun validateTestFile(resourcePath: Path, filePath: Path, program: String): String? { - val symbolComments = try { - symbolComments(program) - } catch (e: IllegalArgumentException) { - return e.message - } - - // Must contain at least one comment - if (symbolComments.isEmpty()) { - return "No expected symbol is specified." - } - - // Opening and closing test markers must match - val locations = when (val locationsResult = findTestRanges(program)) { - is FindTestRangesResult.Success -> locationsResult.ranges - is FindTestRangesResult.Failure -> return locationsResult.message - } - - // Must contain the same amount of test markers and symbols - if (symbolComments.size != locations.size) { - return "Test file contains ${symbolComments.size} symbol comments but ${locations.size} ranges." - } - - // Must be able to parse the test file - // This code fails with Guice configuration errors: - // - // 1) [Guice/MissingImplementation]: No implementation for String annotated with - // @Named(value="file.extensions") was bound. - // val compilationUnit = parseHelper.parse(program) - // ?: return "Could not parse test file." - // - // // Must not have syntax errors - // val syntaxErrors = validationHelper.validate(compilationUnit).filter { it.isSyntaxError } - // if (syntaxErrors.isNotEmpty()) { - // return "File has syntax errors${syntaxErrors.stringify()}" - // } - - return null - } - - private fun createTest(resourcePath: Path, filePath: Path, program: String) = sequence { - val expectedSymbols = expectedSymbols(program) - yield( - CategorizedTest( - "symbol tests", - DynamicTest.dynamicTest(testDisplayName(resourcePath, filePath), filePath.toUri()) { - testDocumentSymbol { - it.model = program - it.expectedSymbols = expectedSymbols.joinToString("") - } - }, - ), - ) - } - - private fun symbolComments(program: String): List { - return """//\s*(?\S+)\s*"(?[^"]*)"\s*(?:in\s*"(?[^"]*)")?""" - .toRegex() - .findAll(program) - .map { - SymbolComment( - enumValueOf(it.groupValues[1]), - it.groupValues[2], - it.groupValues[3], - ) - } - .toList() - } - - private fun expectedSymbols(program: String): List { - val ranges = findTestRanges(program) as? FindTestRangesResult.Success ?: return emptyList() - val symbolComments = symbolComments(program) - - return ranges.ranges.zip(symbolComments) { range, comment -> - ExpectedSymbol(comment.kind, comment.name, range.toLspRange(), comment.containerName) - } - } -} - -private data class SymbolComment(val kind: SymbolKind, val name: String, val containerName: String?) - -private data class ExpectedSymbol( - val kind: SymbolKind, - val name: String, - val range: LspRange, - val containerName: String?, -) { - private val indent = " " - - override fun toString() = buildString { - appendLine("symbol \"$name\" {") - appendLine("${indent}kind: ${kind.value}") - appendLine("${indent}location: MyModel.sdstest $range") - - if (!containerName.isNullOrEmpty()) { - appendLine("${indent}container: \"$containerName\"") - } - - appendLine("}") - } -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/annotations.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/annotations.sdstest deleted file mode 100644 index 1921d7bdb..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/annotations.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Interface "MyAnnotation" -annotation »MyAnnotation« diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/attributes.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/attributes.sdstest deleted file mode 100644 index cf4d166cf..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/attributes.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// Class "MyClass" -class »MyClass« { - // Field "myAttribute" in "MyClass" - attr »myAttribute«: Int -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/classes.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/classes.sdstest deleted file mode 100644 index 4c0b1dbcb..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/classes.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Class "MyClass" -class »MyClass« diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/compilationUnitMembers.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/compilationUnitMembers.sdstest deleted file mode 100644 index 48756d975..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/compilationUnitMembers.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// Package "myPackage" -package »myPackage« - -// Function "myPipeline" in "myPackage" -pipeline »myPipeline« {} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/compilationUnits.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/compilationUnits.sdstest deleted file mode 100644 index d686e1af4..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/compilationUnits.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Package "myPackage" -package »myPackage« diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/enumVariants.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/enumVariants.sdstest deleted file mode 100644 index d9c01fc2d..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/enumVariants.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// Enum "MyEnum" -enum »MyEnum« { - // EnumMember "EnumVariant" in "MyEnum" - »EnumVariant« -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/enums.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/enums.sdstest deleted file mode 100644 index 990a8bfd0..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/enums.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Enum "MyEnum" -enum »MyEnum« diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/globalFunctions.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/globalFunctions.sdstest deleted file mode 100644 index a1095a83f..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/globalFunctions.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Function "myFunction" -fun »myFunction«() diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/lambdaResults.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/lambdaResults.sdstest deleted file mode 100644 index 149ff3020..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/lambdaResults.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// Function "myPipeline" -pipeline »myPipeline« { - lambda { - yield a = 1; - }; -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/methods.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/methods.sdstest deleted file mode 100644 index 2fbf6fdd4..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/methods.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// Class "MyClass" -class »MyClass« { - // Method "myMethod" in "MyClass" - fun »myMethod«() -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/parameters.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/parameters.sdstest deleted file mode 100644 index 9b823de56..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/parameters.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Function "myFunction" -fun »myFunction«(a: Int) diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/pipelines.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/pipelines.sdstest deleted file mode 100644 index 3d4c8c0d2..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/pipelines.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Function "myPipeline" -pipeline »myPipeline« {} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/placeholders.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/placeholders.sdstest deleted file mode 100644 index b8b746cb9..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/placeholders.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// Function "myPipeline" -pipeline »myPipeline« { - val a = 1; -} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/results.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/results.sdstest deleted file mode 100644 index c91adb81c..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/results.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Function "myFunction" -fun »myFunction«() -> a: Int diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/steps.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/steps.sdstest deleted file mode 100644 index b994775b9..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/steps.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Function "myStep" -step »myStep« () {} diff --git a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/typeParameters.sdstest b/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/typeParameters.sdstest deleted file mode 100644 index e3e351eee..000000000 --- a/DSL/com.larsreimann.safeds.ide/src/test/resources/symbols/typeParameters.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// Function "myFunction" -fun »myFunction«() diff --git a/DSL/com.larsreimann.safeds.vscode/.gitattributes b/DSL/com.larsreimann.safeds.vscode/.gitattributes deleted file mode 100644 index 13bc9c2ee..000000000 --- a/DSL/com.larsreimann.safeds.vscode/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# Set default behavior to automatically normalize line endings. -* text=auto - diff --git a/DSL/com.larsreimann.safeds.vscode/.gitignore b/DSL/com.larsreimann.safeds.vscode/.gitignore deleted file mode 100644 index f034388c5..000000000 --- a/DSL/com.larsreimann.safeds.vscode/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/dist/ -/ls/ -/out/ -/node_modules/ -/src/safeds/ diff --git a/DSL/com.larsreimann.safeds.vscode/.vscodeignore b/DSL/com.larsreimann.safeds.vscode/.vscodeignore deleted file mode 100644 index 53bc0f10c..000000000 --- a/DSL/com.larsreimann.safeds.vscode/.vscodeignore +++ /dev/null @@ -1,20 +0,0 @@ -# Git -.gitignore - -# Gradle -build.gradle.kts - -# Typescript -**/*.ts -**/tsconfig.json - -# NPM -**/node_modules - -# VS Code -.vscode/** -.vscode-test/** -vsc-extension-quickstart.md - -# Sources -src/ diff --git a/DSL/com.larsreimann.safeds.vscode/CHANGELOG.md b/DSL/com.larsreimann.safeds.vscode/CHANGELOG.md deleted file mode 100644 index 55b976578..000000000 --- a/DSL/com.larsreimann.safeds.vscode/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -## [0.1.0](https://github.com/Safe-DS/Stdlib-Examples/commits/v0.1.0) (2023-04-07) - - -### Features - -* Initial release diff --git a/DSL/com.larsreimann.safeds.vscode/README.md b/DSL/com.larsreimann.safeds.vscode/README.md deleted file mode 100644 index 651f41ffd..000000000 --- a/DSL/com.larsreimann.safeds.vscode/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Safe-DS - -A preview of the language support for the [Safe-DS][safe-ds-repo] DSL. - -## Requirements - -You need to install [OpenJDK 17 LTS][temurin]. - -[safe-ds-repo]: https://github.com/Safe-DS/DSL -[temurin]: https://adoptium.net/temurin diff --git a/DSL/com.larsreimann.safeds.vscode/build.gradle.kts b/DSL/com.larsreimann.safeds.vscode/build.gradle.kts deleted file mode 100644 index a81dc31fc..000000000 --- a/DSL/com.larsreimann.safeds.vscode/build.gradle.kts +++ /dev/null @@ -1,126 +0,0 @@ -import com.github.gradle.node.npm.task.NpxTask - -// Plugins ------------------------------------------------------------------------------------------------------------- - -plugins { - base - id("com.github.node-gradle.node") - idea -} - -node { - version.set("18.15.0") - download.set(true) -} - -idea { - module { - sourceDirs.add(file("src")) - sourceDirs.add(file("syntaxes")) - - excludeDirs.add(file("dist")) - excludeDirs.add(file("ls")) - excludeDirs.add(file("node_modules")) - } -} - -// Tasks --------------------------------------------------------------------------------------------------------------- - -val extensionPath = "dist/safe-ds-${project.version}.vsix" - -tasks.register("copyApplication") { - val installDistTask = project(":com.larsreimann.safeds.ide").tasks.named("installDist") - dependsOn(installDistTask) - - from(installDistTask.get().outputs) - into("ls") -} - -tasks { - npmInstall { - dependsOn("copyApplication") - } -} - -tasks.register("vsCodeExtension") { - group = "Build" - description = "Generate an extension for VS Code" - - dependsOn("npmInstall") - - inputs.dir("ls") - inputs.dir("src") - inputs.dir("syntaxes") - inputs.files( - ".vscodeignore", - "CHANGELOG.md", - "language-configuration.json", - "package.json", - "README.md", - "tsconfig.json", - ) - outputs.dirs("dist") - - command.set("vsce") - args.set(listOf("package", "--out", extensionPath)) -} - -tasks.register("installExtension") { - dependsOn("vsCodeExtension") - - inputs.files(extensionPath) - outputs.dirs() - - if (System.getProperty("os.name").toLowerCase().contains("windows")) { - commandLine("powershell", "code", "--install-extension", extensionPath) - } else { - commandLine("code", "--install-extension", extensionPath) - } -} - -tasks.register("launchVSCode") { - group = "Run" - description = "Launch VS Code with the extension installed" - - dependsOn("installExtension") - - if (System.getProperty("os.name").toLowerCase().contains("windows")) { - commandLine("powershell", "code", "-n", "../com.larsreimann.safeds/src/main/resources/stdlib") - } else { - commandLine("code", "-n", "../com.larsreimann.safeds/src/main/resources/stdlib") - } -} - -tasks.register("publishVSCE") { - group = "other" - description = "Publish the extension to the VS Code marketplace" - - dependsOn("npmInstall") - - inputs.dir("ls") - inputs.dir("src") - inputs.dir("syntaxes") - inputs.files( - ".vscodeignore", - "CHANGELOG.md", - "language-configuration.json", - "package.json", - "README.md", - "tsconfig.json", - ) - outputs.dirs("dist") - - command.set("vsce") - args.set(listOf("publish")) -} - -tasks { - build { - dependsOn("vsCodeExtension") - } - - clean { - delete(named("copyApplication").get().outputs) - delete(named("vsCodeExtension").get().outputs) - } -} diff --git a/DSL/com.larsreimann.safeds.vscode/img/safe-ds_logo_rounded.png b/DSL/com.larsreimann.safeds.vscode/img/safe-ds_logo_rounded.png deleted file mode 100644 index cf515d7ab..000000000 Binary files a/DSL/com.larsreimann.safeds.vscode/img/safe-ds_logo_rounded.png and /dev/null differ diff --git a/DSL/com.larsreimann.safeds.vscode/language-configuration.json b/DSL/com.larsreimann.safeds.vscode/language-configuration.json deleted file mode 100644 index 1d9913446..000000000 --- a/DSL/com.larsreimann.safeds.vscode/language-configuration.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "comments": { - "lineComment": "//", - "blockComment": ["/*", "*/"] - }, - "brackets": [ - ["{", "}"], - ["(", ")"], - ["<", ">"], - ["»", "«"] - ], - "autoClosingPairs": [ - ["{", "}"], - ["(", ")"], - ["<", ">"], - ["»", "«"], - ["\"", "\""], - ["`", "`"] - ], - "surroundingPairs": [ - ["{", "}"], - ["(", ")"], - ["<", ">"], - ["»", "«"], - ["\"", "\""], - ["`", "`"] - ] -} diff --git a/DSL/com.larsreimann.safeds.vscode/package-lock.json b/DSL/com.larsreimann.safeds.vscode/package-lock.json deleted file mode 100644 index 9edd47c30..000000000 --- a/DSL/com.larsreimann.safeds.vscode/package-lock.json +++ /dev/null @@ -1,1474 +0,0 @@ -{ - "name": "safe-ds", - "version": "0.1.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "safe-ds", - "version": "0.1.0", - "license": "MIT", - "dependencies": { - "vscode-languageclient": "^8.1.0" - }, - "devDependencies": { - "@types/node": "^18.15.11", - "@types/vscode": "^1.77.0", - "esbuild": "^0.17.14", - "typescript": "^5.0.3", - "vscode-test": "^1.6.1" - }, - "engines": { - "vscode": "^1.77.0" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.14.tgz", - "integrity": "sha512-0CnlwnjDU8cks0yJLXfkaU/uoLyRf9VZJs4p1PskBr2AlAHeEsFEwJEo0of/Z3g+ilw5mpyDwThlxzNEIxOE4g==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.14.tgz", - "integrity": "sha512-eLOpPO1RvtsP71afiFTvS7tVFShJBCT0txiv/xjFBo5a7R7Gjw7X0IgIaFoLKhqXYAXhahoXm7qAmRXhY4guJg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.14.tgz", - "integrity": "sha512-nrfQYWBfLGfSGLvRVlt6xi63B5IbfHm3tZCdu/82zuFPQ7zez4XjmRtF/wIRYbJQ/DsZrxJdEvYFE67avYXyng==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.14.tgz", - "integrity": "sha512-eoSjEuDsU1ROwgBH/c+fZzuSyJUVXQTOIN9xuLs9dE/9HbV/A5IqdXHU1p2OfIMwBwOYJ9SFVGGldxeRCUJFyw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.14.tgz", - "integrity": "sha512-zN0U8RWfrDttdFNkHqFYZtOH8hdi22z0pFm0aIJPsNC4QQZv7je8DWCX5iA4Zx6tRhS0CCc0XC2m7wKsbWEo5g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.14.tgz", - "integrity": "sha512-z0VcD4ibeZWVQCW1O7szaLxGsx54gcCnajEJMdYoYjLiq4g1jrP2lMq6pk71dbS5+7op/L2Aod+erw+EUr28/A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.14.tgz", - "integrity": "sha512-hd9mPcxfTgJlolrPlcXkQk9BMwNBvNBsVaUe5eNUqXut6weDQH8whcNaKNF2RO8NbpT6GY8rHOK2A9y++s+ehw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.14.tgz", - "integrity": "sha512-BNTl+wSJ1omsH8s3TkQmIIIQHwvwJrU9u1ggb9XU2KTVM4TmthRIVyxSp2qxROJHhZuW/r8fht46/QE8hU8Qvg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.14.tgz", - "integrity": "sha512-FhAMNYOq3Iblcj9i+K0l1Fp/MHt+zBeRu/Qkf0LtrcFu3T45jcwB6A1iMsemQ42vR3GBhjNZJZTaCe3VFPbn9g==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.14.tgz", - "integrity": "sha512-91OK/lQ5y2v7AsmnFT+0EyxdPTNhov3y2CWMdizyMfxSxRqHazXdzgBKtlmkU2KYIc+9ZK3Vwp2KyXogEATYxQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.14.tgz", - "integrity": "sha512-vp15H+5NR6hubNgMluqqKza85HcGJgq7t6rMH7O3Y6ApiOWPkvW2AJfNojUQimfTp6OUrACUXfR4hmpcENXoMQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.14.tgz", - "integrity": "sha512-90TOdFV7N+fgi6c2+GO9ochEkmm9kBAKnuD5e08GQMgMINOdOFHuYLPQ91RYVrnWwQ5683sJKuLi9l4SsbJ7Hg==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.14.tgz", - "integrity": "sha512-NnBGeoqKkTugpBOBZZoktQQ1Yqb7aHKmHxsw43NddPB2YWLAlpb7THZIzsRsTr0Xw3nqiPxbA1H31ZMOG+VVPQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.14.tgz", - "integrity": "sha512-0qdlKScLXA8MGVy21JUKvMzCYWovctuP8KKqhtE5A6IVPq4onxXhSuhwDd2g5sRCzNDlDjitc5sX31BzDoL5Fw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.14.tgz", - "integrity": "sha512-Hdm2Jo1yaaOro4v3+6/zJk6ygCqIZuSDJHdHaf8nVH/tfOuoEX5Riv03Ka15LmQBYJObUTNS1UdyoMk0WUn9Ww==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.14.tgz", - "integrity": "sha512-8KHF17OstlK4DuzeF/KmSgzrTWQrkWj5boluiiq7kvJCiQVzUrmSkaBvcLB2UgHpKENO2i6BthPkmUhNDaJsVw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.14.tgz", - "integrity": "sha512-nVwpqvb3yyXztxIT2+VsxJhB5GCgzPdk1n0HHSnchRAcxqKO6ghXwHhJnr0j/B+5FSyEqSxF4q03rbA2fKXtUQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.14.tgz", - "integrity": "sha512-1RZ7uQQ9zcy/GSAJL1xPdN7NDdOOtNEGiJalg/MOzeakZeTrgH/DoCkbq7TaPDiPhWqnDF+4bnydxRqQD7il6g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.14.tgz", - "integrity": "sha512-nqMjDsFwv7vp7msrwWRysnM38Sd44PKmW8EzV01YzDBTcTWUpczQg6mGao9VLicXSgW/iookNK6AxeogNVNDZA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.14.tgz", - "integrity": "sha512-xrD0mccTKRBBIotrITV7WVQAwNJ5+1va6L0H9zN92v2yEdjfAN7864cUaZwJS7JPEs53bDTzKFbfqVlG2HhyKQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.14.tgz", - "integrity": "sha512-nXpkz9bbJrLLyUTYtRotSS3t5b+FOuljg8LgLdINWFs3FfqZMtbnBCZFUmBzQPyxqU87F8Av+3Nco/M3hEcu1w==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.14.tgz", - "integrity": "sha512-gPQmsi2DKTaEgG14hc3CHXHp62k8g6qr0Pas+I4lUxRMugGSATh/Bi8Dgusoz9IQ0IfdrvLpco6kujEIBoaogA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@tootallnate/once": { - "version": "1.1.2", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==", - "dev": true - }, - "node_modules/@types/vscode": { - "version": "1.77.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.77.0.tgz", - "integrity": "sha512-MWFN5R7a33n8eJZJmdVlifjig3LWUNRrPeO1xemIcZ0ae0TEQuRc7G2xV0LUX78RZFECY1plYBn+dP/Acc3L0Q==", - "dev": true - }, - "node_modules/agent-base": { - "version": "6.0.2", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "node_modules/big-integer": { - "version": "1.6.48", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/binary": { - "version": "0.3.0", - "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", - "dev": true, - "dependencies": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/bluebird": { - "version": "3.4.7", - "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/buffer-indexof-polyfill": { - "version": "1.0.2", - "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", - "dev": true, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/buffers": { - "version": "0.1.1", - "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", - "dev": true, - "engines": { - "node": ">=0.2.0" - } - }, - "node_modules/chainsaw": { - "version": "0.1.0", - "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", - "dev": true, - "dependencies": { - "traverse": ">=0.3.0 <0.4" - }, - "engines": { - "node": "*" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "node_modules/debug": { - "version": "4.3.1", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/duplexer2": { - "version": "0.1.4", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "dev": true, - "dependencies": { - "readable-stream": "^2.0.2" - } - }, - "node_modules/esbuild": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.14.tgz", - "integrity": "sha512-vOO5XhmVj/1XQR9NQ1UPq6qvMYL7QFJU57J5fKBKBKxp17uDt5PgxFDb4A2nEiXhr1qQs4x0F5+66hVVw4ruNw==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.17.14", - "@esbuild/android-arm64": "0.17.14", - "@esbuild/android-x64": "0.17.14", - "@esbuild/darwin-arm64": "0.17.14", - "@esbuild/darwin-x64": "0.17.14", - "@esbuild/freebsd-arm64": "0.17.14", - "@esbuild/freebsd-x64": "0.17.14", - "@esbuild/linux-arm": "0.17.14", - "@esbuild/linux-arm64": "0.17.14", - "@esbuild/linux-ia32": "0.17.14", - "@esbuild/linux-loong64": "0.17.14", - "@esbuild/linux-mips64el": "0.17.14", - "@esbuild/linux-ppc64": "0.17.14", - "@esbuild/linux-riscv64": "0.17.14", - "@esbuild/linux-s390x": "0.17.14", - "@esbuild/linux-x64": "0.17.14", - "@esbuild/netbsd-x64": "0.17.14", - "@esbuild/openbsd-x64": "0.17.14", - "@esbuild/sunos-x64": "0.17.14", - "@esbuild/win32-arm64": "0.17.14", - "@esbuild/win32-ia32": "0.17.14", - "@esbuild/win32-x64": "0.17.14" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "node_modules/fstream": { - "version": "1.0.12", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/fstream/node_modules/rimraf": { - "version": "2.7.1", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/glob": { - "version": "7.1.6", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.6", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", - "dev": true - }, - "node_modules/http-proxy-agent": { - "version": "4.0.1", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.0", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/isarray": { - "version": "1.0.0", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "node_modules/listenercount": { - "version": "1.0.1", - "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", - "dev": true - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, - "node_modules/mkdirp": { - "version": "0.5.5", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/once": { - "version": "1.4.0", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "node_modules/readable-stream": { - "version": "2.3.7", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/setimmediate": { - "version": "1.0.5", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", - "dev": true - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/traverse": { - "version": "0.3.9", - "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/typescript": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=12.20" - } - }, - "node_modules/unzipper": { - "version": "0.10.11", - "integrity": "sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw==", - "dev": true, - "dependencies": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", - "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "node_modules/vscode-jsonrpc": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", - "integrity": "sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw==", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/vscode-languageclient": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", - "integrity": "sha512-GL4QdbYUF/XxQlAsvYWZRV3V34kOkpRlvV60/72ghHfsYFnS/v2MANZ9P6sHmxFcZKOse8O+L9G7Czg0NUWing==", - "dependencies": { - "minimatch": "^5.1.0", - "semver": "^7.3.7", - "vscode-languageserver-protocol": "3.17.3" - }, - "engines": { - "vscode": "^1.67.0" - } - }, - "node_modules/vscode-languageclient/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/vscode-languageclient/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/vscode-languageserver-protocol": { - "version": "3.17.3", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.3.tgz", - "integrity": "sha512-924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA==", - "dependencies": { - "vscode-jsonrpc": "8.1.0", - "vscode-languageserver-types": "3.17.3" - } - }, - "node_modules/vscode-languageserver-types": { - "version": "3.17.3", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", - "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" - }, - "node_modules/vscode-test": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz", - "integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==", - "dev": true, - "dependencies": { - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "rimraf": "^3.0.2", - "unzipper": "^0.10.11" - }, - "engines": { - "node": ">=8.9.3" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - }, - "dependencies": { - "@esbuild/android-arm": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.14.tgz", - "integrity": "sha512-0CnlwnjDU8cks0yJLXfkaU/uoLyRf9VZJs4p1PskBr2AlAHeEsFEwJEo0of/Z3g+ilw5mpyDwThlxzNEIxOE4g==", - "dev": true, - "optional": true - }, - "@esbuild/android-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.14.tgz", - "integrity": "sha512-eLOpPO1RvtsP71afiFTvS7tVFShJBCT0txiv/xjFBo5a7R7Gjw7X0IgIaFoLKhqXYAXhahoXm7qAmRXhY4guJg==", - "dev": true, - "optional": true - }, - "@esbuild/android-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.14.tgz", - "integrity": "sha512-nrfQYWBfLGfSGLvRVlt6xi63B5IbfHm3tZCdu/82zuFPQ7zez4XjmRtF/wIRYbJQ/DsZrxJdEvYFE67avYXyng==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.14.tgz", - "integrity": "sha512-eoSjEuDsU1ROwgBH/c+fZzuSyJUVXQTOIN9xuLs9dE/9HbV/A5IqdXHU1p2OfIMwBwOYJ9SFVGGldxeRCUJFyw==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.14.tgz", - "integrity": "sha512-zN0U8RWfrDttdFNkHqFYZtOH8hdi22z0pFm0aIJPsNC4QQZv7je8DWCX5iA4Zx6tRhS0CCc0XC2m7wKsbWEo5g==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.14.tgz", - "integrity": "sha512-z0VcD4ibeZWVQCW1O7szaLxGsx54gcCnajEJMdYoYjLiq4g1jrP2lMq6pk71dbS5+7op/L2Aod+erw+EUr28/A==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.14.tgz", - "integrity": "sha512-hd9mPcxfTgJlolrPlcXkQk9BMwNBvNBsVaUe5eNUqXut6weDQH8whcNaKNF2RO8NbpT6GY8rHOK2A9y++s+ehw==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.14.tgz", - "integrity": "sha512-BNTl+wSJ1omsH8s3TkQmIIIQHwvwJrU9u1ggb9XU2KTVM4TmthRIVyxSp2qxROJHhZuW/r8fht46/QE8hU8Qvg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.14.tgz", - "integrity": "sha512-FhAMNYOq3Iblcj9i+K0l1Fp/MHt+zBeRu/Qkf0LtrcFu3T45jcwB6A1iMsemQ42vR3GBhjNZJZTaCe3VFPbn9g==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ia32": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.14.tgz", - "integrity": "sha512-91OK/lQ5y2v7AsmnFT+0EyxdPTNhov3y2CWMdizyMfxSxRqHazXdzgBKtlmkU2KYIc+9ZK3Vwp2KyXogEATYxQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.14.tgz", - "integrity": "sha512-vp15H+5NR6hubNgMluqqKza85HcGJgq7t6rMH7O3Y6ApiOWPkvW2AJfNojUQimfTp6OUrACUXfR4hmpcENXoMQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-mips64el": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.14.tgz", - "integrity": "sha512-90TOdFV7N+fgi6c2+GO9ochEkmm9kBAKnuD5e08GQMgMINOdOFHuYLPQ91RYVrnWwQ5683sJKuLi9l4SsbJ7Hg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ppc64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.14.tgz", - "integrity": "sha512-NnBGeoqKkTugpBOBZZoktQQ1Yqb7aHKmHxsw43NddPB2YWLAlpb7THZIzsRsTr0Xw3nqiPxbA1H31ZMOG+VVPQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-riscv64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.14.tgz", - "integrity": "sha512-0qdlKScLXA8MGVy21JUKvMzCYWovctuP8KKqhtE5A6IVPq4onxXhSuhwDd2g5sRCzNDlDjitc5sX31BzDoL5Fw==", - "dev": true, - "optional": true - }, - "@esbuild/linux-s390x": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.14.tgz", - "integrity": "sha512-Hdm2Jo1yaaOro4v3+6/zJk6ygCqIZuSDJHdHaf8nVH/tfOuoEX5Riv03Ka15LmQBYJObUTNS1UdyoMk0WUn9Ww==", - "dev": true, - "optional": true - }, - "@esbuild/linux-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.14.tgz", - "integrity": "sha512-8KHF17OstlK4DuzeF/KmSgzrTWQrkWj5boluiiq7kvJCiQVzUrmSkaBvcLB2UgHpKENO2i6BthPkmUhNDaJsVw==", - "dev": true, - "optional": true - }, - "@esbuild/netbsd-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.14.tgz", - "integrity": "sha512-nVwpqvb3yyXztxIT2+VsxJhB5GCgzPdk1n0HHSnchRAcxqKO6ghXwHhJnr0j/B+5FSyEqSxF4q03rbA2fKXtUQ==", - "dev": true, - "optional": true - }, - "@esbuild/openbsd-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.14.tgz", - "integrity": "sha512-1RZ7uQQ9zcy/GSAJL1xPdN7NDdOOtNEGiJalg/MOzeakZeTrgH/DoCkbq7TaPDiPhWqnDF+4bnydxRqQD7il6g==", - "dev": true, - "optional": true - }, - "@esbuild/sunos-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.14.tgz", - "integrity": "sha512-nqMjDsFwv7vp7msrwWRysnM38Sd44PKmW8EzV01YzDBTcTWUpczQg6mGao9VLicXSgW/iookNK6AxeogNVNDZA==", - "dev": true, - "optional": true - }, - "@esbuild/win32-arm64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.14.tgz", - "integrity": "sha512-xrD0mccTKRBBIotrITV7WVQAwNJ5+1va6L0H9zN92v2yEdjfAN7864cUaZwJS7JPEs53bDTzKFbfqVlG2HhyKQ==", - "dev": true, - "optional": true - }, - "@esbuild/win32-ia32": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.14.tgz", - "integrity": "sha512-nXpkz9bbJrLLyUTYtRotSS3t5b+FOuljg8LgLdINWFs3FfqZMtbnBCZFUmBzQPyxqU87F8Av+3Nco/M3hEcu1w==", - "dev": true, - "optional": true - }, - "@esbuild/win32-x64": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.14.tgz", - "integrity": "sha512-gPQmsi2DKTaEgG14hc3CHXHp62k8g6qr0Pas+I4lUxRMugGSATh/Bi8Dgusoz9IQ0IfdrvLpco6kujEIBoaogA==", - "dev": true, - "optional": true - }, - "@tootallnate/once": { - "version": "1.1.2", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true - }, - "@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==", - "dev": true - }, - "@types/vscode": { - "version": "1.77.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.77.0.tgz", - "integrity": "sha512-MWFN5R7a33n8eJZJmdVlifjig3LWUNRrPeO1xemIcZ0ae0TEQuRc7G2xV0LUX78RZFECY1plYBn+dP/Acc3L0Q==", - "dev": true - }, - "agent-base": { - "version": "6.0.2", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "requires": { - "debug": "4" - } - }, - "balanced-match": { - "version": "1.0.0", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "big-integer": { - "version": "1.6.48", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", - "dev": true - }, - "binary": { - "version": "0.3.0", - "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", - "dev": true, - "requires": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - } - }, - "bluebird": { - "version": "3.4.7", - "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "buffer-indexof-polyfill": { - "version": "1.0.2", - "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", - "dev": true - }, - "buffers": { - "version": "0.1.1", - "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", - "dev": true - }, - "chainsaw": { - "version": "0.1.0", - "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", - "dev": true, - "requires": { - "traverse": ">=0.3.0 <0.4" - } - }, - "concat-map": { - "version": "0.0.1", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "debug": { - "version": "4.3.1", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "duplexer2": { - "version": "0.1.4", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - } - }, - "esbuild": { - "version": "0.17.14", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.14.tgz", - "integrity": "sha512-vOO5XhmVj/1XQR9NQ1UPq6qvMYL7QFJU57J5fKBKBKxp17uDt5PgxFDb4A2nEiXhr1qQs4x0F5+66hVVw4ruNw==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.17.14", - "@esbuild/android-arm64": "0.17.14", - "@esbuild/android-x64": "0.17.14", - "@esbuild/darwin-arm64": "0.17.14", - "@esbuild/darwin-x64": "0.17.14", - "@esbuild/freebsd-arm64": "0.17.14", - "@esbuild/freebsd-x64": "0.17.14", - "@esbuild/linux-arm": "0.17.14", - "@esbuild/linux-arm64": "0.17.14", - "@esbuild/linux-ia32": "0.17.14", - "@esbuild/linux-loong64": "0.17.14", - "@esbuild/linux-mips64el": "0.17.14", - "@esbuild/linux-ppc64": "0.17.14", - "@esbuild/linux-riscv64": "0.17.14", - "@esbuild/linux-s390x": "0.17.14", - "@esbuild/linux-x64": "0.17.14", - "@esbuild/netbsd-x64": "0.17.14", - "@esbuild/openbsd-x64": "0.17.14", - "@esbuild/sunos-x64": "0.17.14", - "@esbuild/win32-arm64": "0.17.14", - "@esbuild/win32-ia32": "0.17.14", - "@esbuild/win32-x64": "0.17.14" - } - }, - "fs.realpath": { - "version": "1.0.0", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fstream": { - "version": "1.0.12", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "dependencies": { - "rimraf": { - "version": "2.7.1", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, - "glob": { - "version": "7.1.6", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.2.6", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", - "dev": true - }, - "http-proxy-agent": { - "version": "4.0.1", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, - "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - } - }, - "https-proxy-agent": { - "version": "5.0.0", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "inflight": { - "version": "1.0.6", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "listenercount": { - "version": "1.0.1", - "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", - "dev": true - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, - "mkdirp": { - "version": "0.5.5", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.1.2", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "once": { - "version": "1.4.0", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.1", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "3.0.2", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "setimmediate": { - "version": "1.0.5", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "traverse": { - "version": "0.3.9", - "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", - "dev": true - }, - "typescript": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", - "dev": true - }, - "unzipper": { - "version": "0.10.11", - "integrity": "sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw==", - "dev": true, - "requires": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", - "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" - } - }, - "util-deprecate": { - "version": "1.0.2", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "vscode-jsonrpc": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", - "integrity": "sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw==" - }, - "vscode-languageclient": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", - "integrity": "sha512-GL4QdbYUF/XxQlAsvYWZRV3V34kOkpRlvV60/72ghHfsYFnS/v2MANZ9P6sHmxFcZKOse8O+L9G7Czg0NUWing==", - "requires": { - "minimatch": "^5.1.0", - "semver": "^7.3.7", - "vscode-languageserver-protocol": "3.17.3" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, - "vscode-languageserver-protocol": { - "version": "3.17.3", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.3.tgz", - "integrity": "sha512-924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA==", - "requires": { - "vscode-jsonrpc": "8.1.0", - "vscode-languageserver-types": "3.17.3" - } - }, - "vscode-languageserver-types": { - "version": "3.17.3", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", - "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" - }, - "vscode-test": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz", - "integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==", - "dev": true, - "requires": { - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "rimraf": "^3.0.2", - "unzipper": "^0.10.11" - } - }, - "wrappy": { - "version": "1.0.2", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - } -} diff --git a/DSL/com.larsreimann.safeds.vscode/package.json b/DSL/com.larsreimann.safeds.vscode/package.json deleted file mode 100644 index bfa5e5582..000000000 --- a/DSL/com.larsreimann.safeds.vscode/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "name": "safe-ds", - "version": "0.1.0", - "publisher": "Safe-DS", - "engines": { - "vscode": "^1.77.0" - }, - "displayName": "Safe-DS", - "description": "Statically checked Data Science programs.", - "categories": [ - "Programming Languages", - "Machine Learning", - "Data Science" - ], - "keywords": [ - "dsl", - "static checking" - ], - "galleryBanner": { - "color": "#e3e9e9" - }, - "preview": true, - "main": "./dist/extension.js", - "contributes": { - "languages": [ - { - "id": "safe-ds", - "aliases": [ - "Safe-DS", - "safe-ds", - "SafeDS", - "safeds", - "SDS", - "sds" - ], - "extensions": [ - ".sdspipe", - ".sdsschema", - ".sdsstub", - ".sdstest" - ], - "configuration": "./language-configuration.json" - } - ], - "grammars": [ - { - "language": "safe-ds", - "scopeName": "source.safeds", - "path": "./syntaxes/safe-ds.tmLanguage.json" - } - ] - }, - "activationEvents": [ - "onLanguage:safe-ds" - ], - "badges": [ - { - "url": "https://github.com/Safe-DS/DSL/actions/workflows/main.yml/badge.svg", - "href": "https://github.com/Safe-DS/DSL/actions/workflows/main.yml", - "description": "Main" - }, - { - "url": "https://codecov.io/gh/Safe-DS/DSL/branch/main/graph/badge.svg?token=ma0ytglhO1", - "href": "https://codecov.io/gh/Safe-DS/DSL", - "description": "codecov" - } - ], - "qna": "https://github.com/orgs/Safe-DS/discussions", - "dependencies": { - "vscode-languageclient": "^8.1.0" - }, - "devDependencies": { - "@types/node": "^18.15.11", - "@types/vscode": "^1.77.0", - "esbuild": "^0.17.14", - "typescript": "^5.0.3", - "vscode-test": "^1.6.1" - }, - "scripts": { - "vscode:prepublish": "esbuild src/extension.ts --bundle --platform=node --external:vscode --outfile=dist/extension.js", - "vscode:package": "vsce package" - }, - "icon": "img/safe-ds_logo_rounded.png", - "license": "MIT", - "homepage": "https://dsl.safe-ds.com", - "bugs": { - "url": "https://github.com/Safe-DS/DSL/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/Safe-DS/DSL.git" - } -} diff --git a/DSL/com.larsreimann.safeds.vscode/src/extension.ts b/DSL/com.larsreimann.safeds.vscode/src/extension.ts deleted file mode 100644 index e43dde023..000000000 --- a/DSL/com.larsreimann.safeds.vscode/src/extension.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ - -import * as os from 'os'; -import * as path from 'path'; -import { workspace, ExtensionContext } from 'vscode'; - -import { LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient/node'; - -let client: LanguageClient; - -export const activate = (context: ExtensionContext) => { - const launcher = os.platform() === 'win32' ? 'com.larsreimann.safeds.ide.bat' : 'com.larsreimann.safeds.ide'; - const script = context.asAbsolutePath(path.join('ls', 'bin', launcher)); - - const serverOptions: ServerOptions = { - run: { - command: script, - args: ['-log', 'debug', '--trace-deprecation'], - }, - debug: { - command: script, - args: ['-log', 'debug', '--trace-deprecation'], - }, - }; - - // Options to control the language client - const clientOptions: LanguageClientOptions = { - // Register the server for plain text documents - documentSelector: [{ scheme: 'file', language: 'safe-ds' }], - synchronize: { - // Notify the server about file changes to '.clientrc files contained in the workspace - fileEvents: workspace.createFileSystemWatcher('**/.clientrc'), - }, - outputChannelName: 'Safe-DS Language Server', - }; - - // Create the language client and start the client. - client = new LanguageClient('safeds', 'Safe-DS', serverOptions, clientOptions); - - // Start the client. This will also launch the server - client.start(); -}; - -export const deactivate = (): Thenable | undefined => { - if (!client) { - return undefined; - } - return client.stop(); -}; diff --git a/DSL/com.larsreimann.safeds.vscode/syntaxes/safe-ds.tmLanguage.json b/DSL/com.larsreimann.safeds.vscode/syntaxes/safe-ds.tmLanguage.json deleted file mode 100644 index 2508ffc1a..000000000 --- a/DSL/com.larsreimann.safeds.vscode/syntaxes/safe-ds.tmLanguage.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", - "name": "Safe-DS", - "patterns": [ - { - "include": "#comment" - }, - { - "include": "#keywords" - }, - { - "include": "#strings" - } - ], - "repository": { - "comment": { - "patterns": [ - { - "name": "comment.block.safeds", - "begin": "/\\*", - "end": "\\*/" - }, - { - "name": "comment.line.double-slash.safeds", - "begin": "//", - "end": "(?=$)" - } - ] - }, - "keywords": { - "patterns": [ - { - "name": "keyword.control.safeds", - "match": "\\b(_|abstract|and|annotation|as|attr|class|enum|false|fun|import|in|internal|not|null|or|out|package|pipeline|predicate|private|protocol|static|step|sub|subterm|super|true|union|val|vararg|where|yield)\\b" - } - ] - }, - "strings": { - "name": "string.quoted.double.safeds", - "begin": "\"", - "end": "\"", - "patterns": [ - { - "name": "constant.character.escape.safeds", - "match": "\\\\." - } - ] - } - }, - "scopeName": "source.safeds" -} diff --git a/DSL/com.larsreimann.safeds.vscode/tsconfig.json b/DSL/com.larsreimann.safeds.vscode/tsconfig.json deleted file mode 100644 index 07796ad38..000000000 --- a/DSL/com.larsreimann.safeds.vscode/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es2019", - "lib": ["ES2019"], - "outDir": "out", - "rootDir": "src", - "sourceMap": true - }, - "include": ["src/**/*"], - "exclude": ["node_modules", ".vscode-test"] -} diff --git a/DSL/com.larsreimann.safeds/.gitignore b/DSL/com.larsreimann.safeds/.gitignore deleted file mode 100644 index 6424543f4..000000000 --- a/DSL/com.larsreimann.safeds/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/META-INF/ -emf-gen/ -src-gen/ -build.properties -plugin.properties -plugin.xml -*.xtend diff --git a/DSL/com.larsreimann.safeds/build.gradle.kts b/DSL/com.larsreimann.safeds/build.gradle.kts deleted file mode 100644 index 073f5ca41..000000000 --- a/DSL/com.larsreimann.safeds/build.gradle.kts +++ /dev/null @@ -1,218 +0,0 @@ -import org.jetbrains.dokka.gradle.DokkaTask - -val javaVersion: Int by rootProject.extra -val xtextVersion: String by rootProject.extra - -// Plugins ------------------------------------------------------------------------------------------------------------- - -plugins { - idea - `java-library` - `java-test-fixtures` - kotlin("jvm") - `maven-publish` - signing - id("org.jetbrains.dokka") - id("org.jetbrains.kotlinx.kover") -} - -val javadocJar by tasks.creating(Jar::class) { - val dokkaHtml by tasks.getting(DokkaTask::class) - dependsOn(dokkaHtml) - archiveClassifier.set("javadoc") - from(dokkaHtml.outputDirectory) -} - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(javaVersion)) - } - withJavadocJar() - withSourcesJar() -} - -publishing { - publications { - create("mavenJava") { - artifactId = "safe-ds-core" - - val javaComponent = components["java"] as AdhocComponentWithVariants - javaComponent.withVariantsFromConfiguration(configurations["testFixturesApiElements"]) { skip() } - javaComponent.withVariantsFromConfiguration(configurations["testFixturesRuntimeElements"]) { skip() } - from(javaComponent) - - pom { - name.set("$groupId:$artifactId") - description.set("Safely develop Data Science programs with a statically checked DSL.") - url.set("https://github.com/lars-reimann/Safe-DS") - licenses { - license { - name.set("MIT License") - url.set("https://github.com/lars-reimann/Safe-DS/blob/main/LICENSE") - } - } - developers { - developer { - name.set("Lars Reimann") - email.set("mail@larsreimann.com") - organization.set("N/A") - organizationUrl.set("https://github.com/lars-reimann") - } - } - scm { - connection.set("scm:git:https://github.com/lars-reimann/Safe-DS.git") - developerConnection.set("scm:git:https://github.com/lars-reimann/Safe-DS.git") - url.set("https://github.com/lars-reimann/Safe-DS") - } - } - } - } - repositories { - maven { - name = "OSSRH" - url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = System.getenv("MAVEN_USERNAME") - password = System.getenv("MAVEN_PASSWORD") - } - } - } -} - -signing { - val signingKey: String? by project - val signingPassword: String? by project - useInMemoryPgpKeys(signingKey, signingPassword) - sign(publishing.publications["mavenJava"]) -} - -idea { - module { - excludeDirs.add(file("META-INF")) - } -} - -kover { - filters { - classes { - excludes += listOf( - "com.larsreimann.safeds.parser.antlr.*", - "com.larsreimann.safeds.serializer.AbstractSafeDSSemanticSequencer", - "com.larsreimann.safeds.serializer.AbstractSafeDSSyntacticSequencer", - "com.larsreimann.safeds.services.*", - "com.larsreimann.safeds.safeDS.*", - "com.larsreimann.safeds.testing.*", - ) - } - } - - verify { - rule { - name = "Minimal line coverage rate in percents" - bound { - minValue = 80 - } - } - } -} - -// Dependencies -------------------------------------------------------------------------------------------------------- - -dependencies { - api(platform("org.eclipse.xtext:xtext-dev-bom:$xtextVersion")) - implementation("org.eclipse.xtext:org.eclipse.xtext:$xtextVersion") - - implementation("org.jetbrains.kotlinx:dataframe:0.9.1") - - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") - testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2") - testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.2") - testImplementation("org.eclipse.xtext:org.eclipse.xtext.testing:$xtextVersion") - testImplementation("org.eclipse.xtext:org.eclipse.xtext.xbase.testing:$xtextVersion") - testImplementation("io.kotest:kotest-assertions-core-jvm:5.5.5") - - testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2") - testFixturesImplementation("org.eclipse.xtext:org.eclipse.xtext.testing:$xtextVersion") - testFixturesImplementation("org.eclipse.xtext:org.eclipse.xtext.xbase.testing:$xtextVersion") - testFixturesImplementation("io.kotest:kotest-assertions-core-jvm:5.5.5") -} - -// Source sets --------------------------------------------------------------------------------------------------------- - -sourceSets { - main { - java.srcDirs("emf-gen", "src-gen") - java.exclude( - "**/*.sdspipe", - "**/*.sdsstub", - "**/*.tokens", - "**/*.xtextbin", - ) - resources.srcDirs("src-gen") - resources.include( - "**/*.sdspipe", - "**/*.sdsstub", - "**/*.tokens", - "**/*.xtextbin", - ) - } -} - -// Tasks --------------------------------------------------------------------------------------------------------------- - -tasks { - build { - dependsOn(project.tasks.named("generateStdlibDocumentation")) - } - - compileJava { - dependsOn(rootProject.tasks.named("generateXtextLanguage")) - } - - compileKotlin { - dependsOn(rootProject.tasks.named("generateXtextLanguage")) - } - - processResources { - dependsOn(rootProject.tasks.named("generateXtextLanguage")) - } - - named("sourcesJar") { - dependsOn(rootProject.tasks.named("generateXtextLanguage")) - } - - named("dokkaHtml") { - dependsOn(rootProject.tasks.named("generateXtextLanguage")) - } - - clean { - dependsOn(rootProject.tasks.named("cleanGenerateXtextLanguage")) - } - - test { - useJUnitPlatform() - - minHeapSize = "512m" - maxHeapSize = "1024m" - } -} - -tasks.withType().configureEach { - kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" -} - -tasks.register("generateStdlibDocumentation") { - group = "documentation" - description = "Generate documentation for the standard library." - - val inputDirectory = project.file("src/main/resources/stdlib") - val outputDirectory = rootProject.file("../docs/stdlib").absolutePath - - inputs.dir(inputDirectory) - outputs.dirs(outputDirectory) - - dependsOn(sourceSets.main.get().runtimeClasspath) - classpath = sourceSets.main.get().runtimeClasspath.filter { it.exists() } - mainClass.set("com.larsreimann.safeds.stdlibDocumentation.MainKt") - args = listOf(outputDirectory) -} diff --git a/DSL/com.larsreimann.safeds/model/SafeDS.ecore b/DSL/com.larsreimann.safeds/model/SafeDS.ecore deleted file mode 100644 index ea505356a..000000000 --- a/DSL/com.larsreimann.safeds/model/SafeDS.ecore +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSL/com.larsreimann.safeds/model/SafeDS.genmodel b/DSL/com.larsreimann.safeds/model/SafeDS.genmodel deleted file mode 100644 index e649ea6e8..000000000 --- a/DSL/com.larsreimann.safeds/model/SafeDS.genmodel +++ /dev/null @@ -1,310 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDS.xtext b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDS.xtext deleted file mode 100644 index fa6615f20..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDS.xtext +++ /dev/null @@ -1,843 +0,0 @@ -grammar com.larsreimann.safeds.SafeDS hidden ( - WS, - SL_COMMENT, - ML_COMMENT, - TEST_MARKER -) -import 'http://www.eclipse.org/emf/2002/Ecore' as ecore -import 'https://larsreimann.com/safeds/SafeDS' - - - -/********************************************************************************************************************** - * Declarations - **********************************************************************************************************************/ - -// Compilations Units -------------------------------------------------------------------------------------------------- - -SdsCompilationUnit - : {SdsCompilationUnit} - =>annotationCalls+=SdsAnnotationCall* // Annotation calls before a package declaration belong to the compilation unit - ('package' name=QualifiedName)? - imports+=SdsImport* - members+=SdsCompilationUnitMember* - ; - -SdsCompilationUnitMember returns SdsAbstractAnnotatedObject - : {SdsAnnotationCallList} annotationCalls+=SdsAnnotationCall* - - ( {SdsAnnotation.annotationCallList=current} - 'annotation' name=ID - parameterList=SdsParameterList? - constraint=SdsConstraint? - - | {SdsClass.annotationCallList=current} - 'class' name=ID - typeParameterList=SdsTypeParameterList? - parameterList=SdsParameterList? - parentTypeList=SdsParentTypeList? - body=SdsClassBody? - - | {SdsEnum.annotationCallList=current} - 'enum' name=ID - body=SdsEnumBody? - - | {SdsFunction.annotationCallList=current} - 'fun' name=ID - typeParameterList=SdsTypeParameterList? - parameterList=SdsParameterList - resultList=SdsResultList? - body=SdsFunctionBody? - - | {SdsPredicate.annotationCallList=current} - 'predicate' name=ID - typeParameterList=SdsTypeParameterList? - parameterList=SdsPredicateParameterList - resultList=SdsPredicateResultList? - body=SdsPredicateBlock - - | {SdsPredicate.annotationCallList=current} - 'abstract' 'predicate' name=ID - typeParameterList=SdsTypeParameterList? - parameterList=SdsPredicateParameterList - resultList=SdsPredicateResultList? - - | {SdsSchema.annotationCallList=current} - 'schema' name=ID - columnList=SdsColumnList - - | {SdsPipeline.annotationCallList=current} - 'pipeline' name=ID - body=SdsBlock - - | {SdsStep.annotationCallList=current} - visibility=('internal'|'private')? - 'step' name=ID - parameterList=SdsParameterList - resultList=SdsResultList? - body=SdsBlock - ) - ; - -SdsImport - : 'import' importedNamespace=QualifiedNameWithWildcard alias=SdsImportAlias? - ; - -SdsImportAlias - : 'as' name=ID - ; - - -// Annotations --------------------------------------------------------------------------------------------------------- - -SdsAnnotationCall - : '@' annotation=[SdsAnnotation] argumentList=SdsAnnotationCallArgumentList? - ; - -SdsAnnotationCallArgumentList returns SdsArgumentList - : {SdsArgumentList} '(' (arguments+=SdsAnnotationCallArgument (',' arguments+=SdsAnnotationCallArgument)* ','?)? ')' - ; - -SdsAnnotationCallArgument returns SdsArgument - : (parameter=[SdsParameter] '=')? value=SdsExpression - ; - - -// Classes ------------------------------------------------------------------------------------------------------------- - -SdsParentTypeList - : 'sub' parentTypes+=SdsParentType (',' parentTypes+=SdsParentType)* ','? - ; - -SdsParentType returns SdsAbstractType - : SdsParentPrimaryType =>({SdsMemberType.receiver=current} '.' member=SdsNamedType)* - ; - -SdsParentPrimaryType returns SdsAbstractType - : SdsNamedType - | SdsParentParenthesizedType - ; - -SdsParentParenthesizedType returns SdsParenthesizedType - : '(' type=SdsParentType ')' - ; - -SdsClassBody - : {SdsClassBody} '{' members+=SdsClassMember* '}' - ; - -SdsClassMember returns SdsAbstractObject - : SdsAnnotatedClassMember - | SdsProtocol - | SdsConstraint - ; - -SdsAnnotatedClassMember returns SdsAbstractAnnotatedObject - : {SdsAnnotationCallList} annotationCalls+=SdsAnnotationCall* - - ( {SdsAttribute.annotationCallList=current} - static?='static'? - 'attr' name=ID (':' type=SdsType)? - - | {SdsClass.annotationCallList=current} - 'class' name=ID - typeParameterList=SdsTypeParameterList? - parameterList=SdsParameterList? - parentTypeList=SdsParentTypeList? - body=SdsClassBody? - - | {SdsEnum.annotationCallList=current} - 'enum' name=ID - body=SdsEnumBody? - - | {SdsFunction.annotationCallList=current} - static?='static'? - 'fun' name=ID - typeParameterList=SdsTypeParameterList? - parameterList=SdsParameterList - resultList=SdsResultList? - body=SdsFunctionBody? - ) - ; - -SdsConstraint - : 'constraint' body=SdsConstraintBlock - ; - -SdsProtocol - : 'protocol' body=SdsProtocolBody - ; - -SdsProtocolBody - : {SdsProtocolBody} - '{' - subtermList=SdsProtocolSubtermList? - term=SdsProtocolTerm? - '}' - ; - -SdsProtocolSubtermList - : subterms+=SdsProtocolSubterm+ - ; - -SdsProtocolSubterm - : 'subterm' name=ID '=' term=SdsProtocolTerm ';' - ; - -SdsProtocolTerm returns SdsAbstractProtocolTerm - : SdsProtocolAlternative - ; - -SdsProtocolAlternative returns SdsAbstractProtocolTerm - : SdsProtocolSequence - ( - {SdsProtocolAlternative.terms+=current} '|' terms+=SdsProtocolSequence - ('|' terms+=SdsProtocolSequence)* - )? - ; - -SdsProtocolSequence returns SdsAbstractProtocolTerm - : SdsProtocolQuantifiedTerm - ( - {SdsProtocolSequence.terms+=current} terms+=SdsProtocolQuantifiedTerm - (terms+=SdsProtocolQuantifiedTerm)* - )? - ; - -SdsProtocolQuantifiedTerm returns SdsAbstractProtocolTerm - : SdsProtocolPrimaryElement - ({SdsProtocolQuantifiedTerm.term=current} quantifier=SdsProtocolQuantifier)? - ; - -SdsProtocolQuantifier - : '?' - | '*' - | '+' - ; - -SdsProtocolPrimaryElement returns SdsAbstractProtocolTerm - : SdsProtocolComplement - | SdsProtocolReference - | SdsProtocolTokenClass - | SdsProtocolParenthesizedTerm - ; - -SdsProtocolComplement - : {SdsProtocolComplement} - '[' - universe=SdsProtocolTokenClass? - '^' - referenceList=SdsProtocolReferenceList? - ']' - ; - -SdsProtocolReferenceList - : references+=SdsProtocolReference+ - ; - -SdsProtocolReference - : token=[SdsAbstractProtocolToken] - ; - -SdsProtocolTokenClass - : value=SdsProtocolTokenClassValue - ; - -SdsProtocolTokenClassValue - : '.' - | '\\a' - | '\\f' - ; - -SdsProtocolParenthesizedTerm - : '(' term=SdsProtocolTerm ')' - ; - - -// Enums --------------------------------------------------------------------------------------------------------------- - -SdsEnumBody - : {SdsEnumBody} '{' variants+=SdsEnumVariant* '}' - ; - -SdsEnumVariant - : annotationCalls+=SdsAnnotationCall* - name=ID - typeParameterList=SdsTypeParameterList? - parameterList=SdsParameterList? - constraint=SdsConstraint? - ; - - -// Parameters ---------------------------------------------------------------------------------------------------------- - -SdsParameterList - : {SdsParameterList} '(' (parameters+=SdsParameter (',' parameters+=SdsParameter)* ','?)? ')' - ; - -// Used while parsing lambdas to avoid left-recursion. Can be treated like a normal parameter list. -SdsLambdaParameterList - : {SdsLambdaParameterList} '(' (parameters+=SdsParameter (',' parameters+=SdsParameter)* ','?)? ')' - ; - -SdsParameter - : annotationCalls+=SdsAnnotationCall* - variadic?='vararg'? - name=ID (':' type=SdsType)? - ('=' defaultValue=SdsExpression)? - ; - -SdsPredicateParameterList returns SdsParameterList - : {SdsParameterList} '(' (parameters+=SdsPredicateParameter (',' parameters+=SdsPredicateParameter)* ','?)? ')' - ; - -SdsPredicateParameter returns SdsParameter - : annotationCalls+=SdsAnnotationCall* - ( variadic?='vararg'? - name=ID (':' type=SdsType)? - ('=' defaultValue=SdsExpression)? - - // For schema type parameters - | type=SdsSchemaType - ) - ; - - -// Results ------------------------------------------------------------------------------------------------------------- - -SdsResultList - : {SdsResultList} '->' results+=SdsResult // If there is exactly one result we need no parentheses - | {SdsResultList} '->' '(' (results+=SdsResult (',' results+=SdsResult)* ','?)? ')' - ; - -SdsResult - : annotationCalls+=SdsAnnotationCall* - name=ID (':' type=SdsType)? - ; - -SdsPredicateResultList returns SdsResultList - : {SdsResultList} '->' results+=SdsPredicateResult - ; - -SdsPredicateResult returns SdsResult - : annotationCalls+=SdsAnnotationCall* - type=SdsSchemaType - ; - -// Function ------------------------------------------------------------------------------------------------------------- - -SdsFunctionBody - : {SdsFunctionBody} '{' statements+=SdsFunctionStatement* '}' - ; - -SdsFunctionStatement returns SdsAbstractObject - : SdsConstraint - ; - -/********************************************************************************************************************** - * Statements - **********************************************************************************************************************/ - -// Pipelines and Steps ------------------------------------------------------------------------------------------------- - -SdsBlock - : {SdsBlock} '{' statements+=SdsStatement* '}' - ; - -SdsStatement returns SdsAbstractStatement - : SdsAssignment - | SdsExpressionStatement - ; - -SdsAssignment - : assigneeList=SdsAssigneeList '=' expression=SdsExpression ';' - ; - -SdsAssigneeList - : assignees+=SdsAssignee (',' assignees+=SdsAssignee)* ','? - ; - -SdsAssignee returns SdsAbstractAssignee - : {SdsPlaceholder} 'val' name=ID - | {SdsWildcard} '_' - | {SdsYield} 'yield' result=[SdsResult] - ; - -SdsExpressionStatement - : expression=SdsExpression ';' - ; - -// Constraints --------------------------------------------------------------------------------------------------------- - -SdsConstraintBlock returns SdsBlock - : {SdsBlock} '{' ( statements+=SdsConstraintStatement (',' statements+=SdsConstraintStatement)* )? '}' - ; - -SdsConstraintStatement returns SdsAbstractStatement - : SdsPredicateAssignment - | SdsPredicateExpressionStatement - | SdsTypeParameterConstraint - ; - -// Predicates ---------------------------------------------------------------------------------------------------------- - -SdsPredicateBlock returns SdsBlock - : {SdsBlock} '{' ( statements+=SdsPredicateStatement (',' statements+=SdsPredicateStatement)* )? '}' - ; - -SdsPredicateStatement returns SdsAbstractStatement - : SdsPredicateAssignment - | SdsPredicateExpressionStatement - ; - -SdsPredicateAssignment returns SdsAssignment - : assigneeList=SdsPredicateAssigneeList '=' expression=SdsExpression - ; - -SdsPredicateAssigneeList returns SdsAssigneeList - : assignees+=SdsPredicateAssignee (',' assignees+=SdsPredicateAssignee)* ','? - ; - -SdsPredicateAssignee returns SdsAbstractAssignee - : {SdsPlaceholder} 'val' name=ID - | {SdsWildcard} '_' - | {SdsSchemaPlaceholder} 'val' '::' name=ID - | {SdsSchemaYield} 'yield' type=SdsSchemaType - ; - -SdsPredicateExpressionStatement returns SdsExpressionStatement - : expression=SdsExpression - ; - -/********************************************************************************************************************** - * Expressions - **********************************************************************************************************************/ - -SdsExpression returns SdsAbstractExpression - : SdsLambda - | SdsOrExpression - ; - -SdsLambda returns SdsAbstractExpression - : SdsLambdaParameterList - ( {SdsBlockLambda.parameterList=current} body=SdsBlockLambdaBlock - | {SdsExpressionLambda.parameterList=current} '->' result=SdsExpression - ) - ; - -SdsBlockLambdaBlock returns SdsBlock - : {SdsBlock} '{' statements+=SdsBlockLambdaStatement* '}' - ; - -SdsBlockLambdaStatement returns SdsAbstractStatement - : SdsBlockLambdaAssignment - | SdsExpressionStatement - ; - -SdsBlockLambdaAssignment returns SdsAssignment - : assigneeList=SdsBlockLambdaAssigneeList '=' expression=SdsExpression ';' - ; - -SdsBlockLambdaAssigneeList returns SdsAssigneeList - : assignees+=SdsBlockLambdaAssignee (',' assignees+=SdsBlockLambdaAssignee)* ','? - ; - -SdsBlockLambdaAssignee returns SdsAbstractAssignee - : {SdsWildcard} '_' - | {SdsPlaceholder} 'val' name=ID - | {SdsBlockLambdaResult} 'yield' name=ID - ; - -SdsOrExpression returns SdsAbstractExpression - : SdsAndExpression ({SdsInfixOperation.leftOperand=current} operator='or' rightOperand=SdsAndExpression)* - ; - -SdsAndExpression returns SdsAbstractExpression - : SdsNotExpression ({SdsInfixOperation.leftOperand=current} operator='and' rightOperand=SdsNotExpression)* - ; - -SdsNotExpression returns SdsAbstractExpression - : {SdsPrefixOperation} operator='not' operand=SdsNotExpression - | SdsEqualityExpression - ; - -SdsEqualityExpression returns SdsAbstractExpression - : SdsComparisonExpression ({SdsInfixOperation.leftOperand=current} operator=SdsEqualityOperator rightOperand=SdsComparisonExpression)? - ; - -SdsEqualityOperator - : '==' - | '!=' - | '===' - | '!==' - ; - -SdsComparisonExpression returns SdsAbstractExpression - : SdsAdditiveExpression ({SdsInfixOperation.leftOperand=current} operator=SdsComparisonOperator rightOperand=SdsAdditiveExpression)? - ; - -SdsComparisonOperator - : '<' - | '<=' - | '>=' - | '>' - ; - -SdsAdditiveExpression returns SdsAbstractExpression - : SdsMultiplicativeExpression ({SdsInfixOperation.leftOperand=current} operator=SdsAdditiveOperator rightOperand=SdsMultiplicativeExpression)* - ; - -SdsAdditiveOperator - : '+' - | '-' - ; - -SdsMultiplicativeExpression returns SdsAbstractExpression - : SdsElvisExpression ({SdsInfixOperation.leftOperand=current} operator=SdsMultiplicativeOperator rightOperand=SdsElvisExpression)* - ; - -SdsMultiplicativeOperator - : '*' - | '/' - ; - -SdsElvisExpression returns SdsAbstractExpression - : SdsUnaryOperation ({SdsInfixOperation.leftOperand=current} operator='?:' rightOperand=SdsUnaryOperation)* - ; - -SdsUnaryOperation returns SdsAbstractExpression - : {SdsPrefixOperation} operator='-' operand=SdsUnaryOperation - | SdsChainedExpression - ; - -SdsChainedExpression returns SdsAbstractExpression - : SdsPrimaryExpression =>( - {SdsCall.receiver=current} typeArgumentList=SdsTypeArgumentList? argumentList=SdsCallArgumentList - | {SdsIndexedAccess.receiver=current} '[' index=SdsExpression ']' - | {SdsMemberAccess.receiver=current} (nullSafe?='?')? '.' member=SdsReference - )* - ; - -SdsCallArgumentList returns SdsArgumentList - : {SdsArgumentList} '(' (arguments+=SdsCallArgument (',' arguments+=SdsCallArgument)* ','?)? ')' - ; - -SdsCallArgument returns SdsArgument - : (parameter=[SdsParameter] '=')? value=SdsExpression - ; - -SdsPrimaryExpression returns SdsAbstractExpression - : SdsLiteral - | SdsParenthesizedExpression - | SdsReference - | SdsTemplateString - | {SdsSchemaReference} type=SdsSchemaType - ; - -SdsLiteral returns SdsAbstractLiteral - : SdsBoolean - | SdsFloat - | SdsInt - | SdsNull - | SdsString - ; - -SdsBoolean - : true?='true' - | {SdsBoolean} 'false' - ; - -SdsFloat - : value=FLOAT - ; - -SdsInt - : value=INT - ; - -SdsNull - : {SdsNull} 'null' - ; - -SdsString - : value=STRING - ; - -SdsReference - : declaration=[SdsAbstractDeclaration] - ; - -SdsParenthesizedExpression - : '(' expression=SdsExpression ')' - ; - - -// Template strings ---------------------------------------------------------------------------------------------------- - -SdsTemplateString - : expressions+=SdsTemplateStringStart expressions+=SdsExpression? - (expressions+=SdsTemplateStringInner expressions+=SdsExpression?)* - expressions+=SdsTemplateStringEnd - ; - -SdsTemplateStringStart - : value=TEMPLATE_STRING_START - ; - -SdsTemplateStringInner - : value=TEMPLATE_STRING_INNER - ; - -SdsTemplateStringEnd - : value=TEMPLATE_STRING_END - ; - -/********************************************************************************************************************** - * Schemas - **********************************************************************************************************************/ - -SdsColumnList -: {SdsColumnList} '{' ( columns+=SdsColumn (',' columns+=SdsColumn)* ','?)? '}' -; - -SdsColumn -: columnName=SdsString ":" columnType=SdsType -; - - -/********************************************************************************************************************** - * Names - **********************************************************************************************************************/ - -QualifiedName - : ID ('.' ID)* - ; - -QualifiedNameWithWildcard - : QualifiedName ('.' '*')? - ; - - - -/********************************************************************************************************************** - * Types - **********************************************************************************************************************/ - -SdsType returns SdsAbstractType - : SdsPrimaryType =>({SdsMemberType.receiver=current} '.' member=SdsNamedType)* - ; - -SdsPrimaryType returns SdsAbstractType - : SdsCallableType - | SdsNamedType - | SdsUnionType - | SdsParenthesizedType - ; - -SdsParenthesizedType - : '(' type=SdsType ')' - ; - -// Callable Types ------------------------------------------------------------------------------------------------------ - -SdsCallableType - : parameterList=SdsParameterList - resultList=SdsResultList - ; - - -// Named Types --------------------------------------------------------------------------------------------------------- - -SdsNamedType - : declaration=[SdsAbstractNamedTypeDeclaration] - typeArgumentList=SdsTypeArgumentList? - (nullable?='?')? - ; - -// Schema Types --------------------------------------------------------------------------------------------------------- - -SdsSchemaType - : '::' declaration=[SdsAbstractNamedTypeDeclaration] - ; - -// Union Types --------------------------------------------------------------------------------------------------------- - -SdsUnionType - : 'union' typeArgumentList=SdsUnionTypeArgumentList - ; - -SdsUnionTypeArgumentList returns SdsTypeArgumentList - : {SdsTypeArgumentList} ('<' (typeArguments+=SdsUnionTypeArgument (',' typeArguments+=SdsUnionTypeArgument)* ','?)? '>') - ; - -SdsUnionTypeArgument returns SdsTypeArgument - : value=SdsUnionTypeArgumentValue - ; - -SdsUnionTypeArgumentValue returns SdsAbstractTypeArgumentValue - : {SdsTypeProjection} type=SdsType - ; - - -// Generics ------------------------------------------------------------------------------------------------------------ - -SdsTypeParameterList - : {SdsTypeParameterList} ('<' (typeParameters+=SdsTypeParameter (',' typeParameters+=SdsTypeParameter)* ','?)? '>') - ; - -SdsTypeParameter - : annotationCalls+=SdsAnnotationCall* - variance=SdsTypeParameterVariance? - name=ID - ('::' kind=SdsTypeParameterKind)? - ; - -SdsTypeParameterVariance - : 'in' - | 'out' - ; - -SdsTypeParameterKind - : '$SchemaType' - | '$ExpressionType' - | '$IntType' - | '$FloatType' - | '$BooleanType' - | '$StringType' - | '$NamedType' - ; - -SdsTypeParameterConstraint - : leftOperand=[SdsTypeParameter] operator=SdsTypeParameterConstraintOperator rightOperand=SdsType - ; - -SdsTypeParameterConstraintOperator - : 'sub' - | 'super' - ; - -SdsTypeArgumentList - : {SdsTypeArgumentList} '<' (typeArguments+=SdsTypeArgument (',' typeArguments+=SdsTypeArgument)* ','?)? '>' - ; - -SdsTypeArgument - : (typeParameter=[SdsTypeParameter] '=')? value=SdsTypeArgumentValue - ; - -SdsTypeArgumentValue returns SdsAbstractTypeArgumentValue - : {SdsStarProjection} '*' - | {SdsTypeProjection} variance=SdsTypeParameterVariance? type=SdsType - ; - - - -/********************************************************************************************************************** - * Terminals - **********************************************************************************************************************/ - -terminal FLOAT returns ecore::EDouble - : DECIMAL_DIGIT+ '.' DECIMAL_DIGIT+ FLOAT_EXPONENT? - | DECIMAL_DIGIT+ FLOAT_EXPONENT - ; - -terminal fragment DECIMAL_DIGIT - : '0'..'9' - ; - -terminal fragment FLOAT_EXPONENT - : ('e'|'E') ('+'|'-')? DECIMAL_DIGIT+ - ; - -terminal ID - : IDENTIFIER - | '`' IDENTIFIER '`' - ; - -terminal fragment IDENTIFIER - : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')* - | SCHEMA_EFFECT - ; - -terminal fragment SCHEMA_EFFECT - : '$readSchema' - | '$checkColumn' - | '$removeColumn' - | '$keepColumn' - | '$renameColumn' - | '$addColumn' - | '$changeColumnType' - ; - -terminal INT returns ecore::EInt - : DECIMAL_DIGIT+ - ; - -terminal ML_COMMENT - : '/*' -> '*/' - ; - -terminal SL_COMMENT - : '//' !('\r'|'\n')* ('\r'? '\n')? - ; - -terminal STRING returns ecore::EString - : STRING_START - STRING_TEXT* - STRING_END - ; - -terminal fragment STRING_START - : STRING_DELIMITER - ; - -terminal fragment STRING_END - : '{'? STRING_DELIMITER - ; - -terminal fragment STRING_DELIMITER - : '"' - ; - -terminal fragment STRING_TEXT - : '{'? ESCAPE_SEQUENCE - | '{'? !('\\'|STRING_DELIMITER|'{') - ; - -terminal fragment ESCAPE_SEQUENCE - : '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\'|'{' */ - ; - -terminal fragment TEMPLATE_EXPRESSION_START - : '{{' - ; - -terminal fragment TEMPLATE_EXPRESSION_END - : '}}' - ; - -terminal TEMPLATE_STRING_START - : STRING_START - STRING_TEXT* - TEMPLATE_EXPRESSION_START - ; - -terminal TEMPLATE_STRING_INNER - : TEMPLATE_EXPRESSION_END - STRING_TEXT* - TEMPLATE_EXPRESSION_START - ; - -terminal TEMPLATE_STRING_END - : TEMPLATE_EXPRESSION_END - STRING_TEXT* - STRING_END - ; - -terminal TEST_MARKER - : '»' - | '«' - ; - -terminal WS - : (' '|'\t'|'\r'|'\n')+ - ; diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDSRuntimeModule.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDSRuntimeModule.kt deleted file mode 100644 index b507af027..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDSRuntimeModule.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.larsreimann.safeds - -import com.google.inject.Binder -import com.google.inject.name.Names -import com.larsreimann.safeds.conversion.SafeDSIDValueConverter -import com.larsreimann.safeds.conversion.SafeDSQualifiedNameValueConverter -import com.larsreimann.safeds.conversion.SafeDSSTRINGValueConverter -import com.larsreimann.safeds.conversion.SafeDSValueConverterService -import com.larsreimann.safeds.naming.QualifiedNameProviderInjectionTarget -import com.larsreimann.safeds.scoping.IndexExtensionsInjectionTarget -import com.larsreimann.safeds.scoping.SafeDSImportedNamespaceAwareLocalScopeProvider -import com.larsreimann.safeds.scoping.SafeDSResourceDescriptionStrategy -import com.larsreimann.safeds.serializer.SafeDSCrossReferenceSerializer -import com.larsreimann.safeds.serializer.SafeDSHiddenTokenSequencer -import com.larsreimann.safeds.serializer.SerializerExtensionsInjectionTarget -import com.larsreimann.safeds.services.SafeDSGrammarAccess -import org.eclipse.xtext.IGrammarAccess -import org.eclipse.xtext.conversion.IValueConverterService -import org.eclipse.xtext.conversion.impl.IDValueConverter -import org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter -import org.eclipse.xtext.conversion.impl.STRINGValueConverter -import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy -import org.eclipse.xtext.scoping.IScopeProvider -import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider -import org.eclipse.xtext.serializer.sequencer.IHiddenTokenSequencer -import org.eclipse.xtext.serializer.tokens.ICrossReferenceSerializer - -/** - * Use this class to register components to be used at runtime / without the Equinox extension registry. - */ -@Suppress("unused") -open class SafeDSRuntimeModule : AbstractSafeDSRuntimeModule() { - fun bindICrossReferenceSerializer(): Class { - return SafeDSCrossReferenceSerializer::class.java - } - - fun bindIDefaultResourceDescriptionStrategy(): Class { - return SafeDSResourceDescriptionStrategy::class.java - } - - override fun bindIGrammarAccess(): Class { - return SafeDSGrammarAccess::class.java - } - - fun bindIHiddenTokenSequencer(): Class { - return SafeDSHiddenTokenSequencer::class.java - } - - override fun bindIValueConverterService(): Class { - return SafeDSValueConverterService::class.java - } - - fun bindIDValueConverter(): Class { - return SafeDSIDValueConverter::class.java - } - - fun bindSTRINGValueConverter(): Class { - return SafeDSSTRINGValueConverter::class.java - } - - fun bindQualifiedNameValueConverter(): Class { - return SafeDSQualifiedNameValueConverter::class.java - } - - override fun configureIScopeProviderDelegate(binder: Binder) { - binder.bind(IScopeProvider::class.java) - .annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)) - .to(SafeDSImportedNamespaceAwareLocalScopeProvider::class.java) - } - - override fun configure(binder: Binder) { - binder.requestStaticInjection(IndexExtensionsInjectionTarget::class.java) - binder.requestStaticInjection(SerializerExtensionsInjectionTarget::class.java) - binder.requestStaticInjection(QualifiedNameProviderInjectionTarget::class.java) - - super.configure(binder) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDSStandaloneSetup.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDSStandaloneSetup.kt deleted file mode 100644 index fe90330d1..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDSStandaloneSetup.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.larsreimann.safeds - -import com.google.inject.Injector -import com.larsreimann.safeds.safeDS.SafeDSPackage -import org.eclipse.emf.ecore.EPackage - -/** - * Initialization support for running Xtext languages without Equinox extension registry. - */ -@Suppress("unused") -open class SafeDSStandaloneSetup : SafeDSStandaloneSetupGenerated() { - - override fun register(injector: Injector) { - EPackage.Registry.INSTANCE.putIfAbsent(SafeDSPackage.eNS_URI, SafeDSPackage.eINSTANCE) - super.register(injector) - } - - companion object { - fun doSetup() { - SafeDSStandaloneSetup().createInjectorAndDoEMFRegistration() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsFileExtension.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsFileExtension.kt deleted file mode 100644 index 9c22efcf1..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsFileExtension.kt +++ /dev/null @@ -1,103 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.emf.OriginalFilePath -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.resource.Resource - -/** - * Different file extensions associated with Safe-DS programs. The dot that separates file name and file extension is - * not included. - */ -enum class SdsFileExtension(val extension: String) { - - /** - * Marks the file as a pipeline file, which can be executed by our runtime component. - * - * @see isInPipelineFile - * @see isPipelineFile - */ - Pipeline("sdspipe"), - - /** - * Marks the file as a schema file. - * - * @see isInSchemaFile - * @see isSchemaFile - */ - Schema("sdsschema"), - - /** - * Marks the file as a stub file, which describes an external API. - * - * @see isInStubFile - * @see isStubFile - */ - Stub("sdsstub"), - - /** - * Marks the file as a test file, which disables some checks to simplify its use as input of test cases. This file - * type is only used by language developers. - * - * @see isInTestFile - * @see isTestFile - */ - Test("sdstest"), - - ; - - override fun toString(): String { - return extension - } -} - -/** - * Returns whether the object is contained in a pipeline file. - */ -fun EObject.isInPipelineFile() = this.eResource().isPipelineFile() - -/** - * Returns whether the object is contained in a schema file. - */ -fun EObject.isInSchemaFile() = this.eResource().isSchemaFile() - -/** - * Returns whether the object is contained in a stub file. - */ -fun EObject.isInStubFile() = this.eResource().isStubFile() - -/** - * Returns whether the object is contained in a test file. - */ -fun EObject.isInTestFile() = this.eResource().isTestFile() - -/** - * Returns whether the resource represents a pipeline file. - */ -fun Resource.isPipelineFile() = this.hasExtension(SdsFileExtension.Pipeline) - -/** - * Returns whether the resource represents a schema file. - */ -fun Resource.isSchemaFile() = this.hasExtension(SdsFileExtension.Schema) - -/** - * Returns whether the resource represents a stub file. - */ -fun Resource.isStubFile() = this.hasExtension(SdsFileExtension.Stub) - -/** - * Returns whether the resource represents a test file. - */ -fun Resource.isTestFile() = this.hasExtension(SdsFileExtension.Test) - -/** - * Returns whether the resource represents a file with the given extension. - */ -private fun Resource.hasExtension(fileExtension: SdsFileExtension): Boolean { - // The original file path is normally lost for dynamic tests, so it's attached as an EMF adapter - this.eAdapters().filterIsInstance().firstOrNull()?.let { - return it.path.endsWith(".$fileExtension") - } - - return this.uri.toString().endsWith(".$fileExtension") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsInfixOperationOperator.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsInfixOperationOperator.kt deleted file mode 100644 index ba9cc3b8e..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsInfixOperationOperator.kt +++ /dev/null @@ -1,87 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsInfixOperation - -/** - * The possible operators for an [SdsInfixOperation]. - */ -enum class SdsInfixOperationOperator(val operator: String) { - - /** - * Disjunction. - */ - Or("or"), - - /** - * Conjunction. - */ - And("and"), - - /** - * Structural equality. - */ - Equals("=="), - - /** - * Negated structural equality. - */ - NotEquals("!="), - - /** - * Both operands point to exactly the same object (referential equality). - */ - IdenticalTo("==="), - - /** - * The two operands point to different objects (negated referential equality). - */ - NotIdenticalTo("!=="), - - LessThan("<"), - - LessThanOrEquals("<="), - - GreaterThanOrEquals(">="), - - GreaterThan(">"), - - /** - * Addition. - */ - Plus("+"), - - /** - * Subtraction. - */ - Minus("-"), - - /** - * Multiplication. - */ - Times("*"), - - /** - * Division. - */ - By("/"), - - /** - * Returns the left operand unless it is null, in which case the right operand is returned. - */ - Elvis("?:"), - ; - - override fun toString(): String { - return operator - } -} - -/** - * Returns the [SdsInfixOperationOperator] of this [SdsInfixOperation]. - * - * @throws IllegalArgumentException If the operator is unknown. - */ -fun SdsInfixOperation.operator(): SdsInfixOperationOperator { - return SdsInfixOperationOperator.values().firstOrNull { it.operator == this.operator } - ?: throw IllegalArgumentException("Unknown infix operator '$operator'.") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsKind.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsKind.kt deleted file mode 100644 index 91bc9a269..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsKind.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.staticAnalysis.typing.ParameterisedType -import com.larsreimann.safeds.utils.ExperimentalSdsApi - -/** - * The possible kinds for an [SdsTypeParameter]. - */ -@ExperimentalSdsApi -@Suppress("ktlint:trailing-comma-on-declaration-site") -enum class SdsKind(val kind: String?) { - NoKind(null), - SchemaKind("\$SchemaType"), - ExpressionKind("\$ExpressionType"), - IntKind("\$IntType"), - FloatKind("\$FloatType"), - BooleanKind("\$BooleanType"), - StringKind("\$StringType"), - NamedKind("\$NamedType"); - - override fun toString(): String { - return kind ?: "NoKind" - } -} - -/** - * Returns the [SdsKind] of this [SdsTypeParameter]. - */ -@ExperimentalSdsApi -fun SdsTypeParameter.kind(): SdsKind { - return stringToKind(this.kind) -} - -/** - * Returns the [SdsKind] of this [ParameterisedType]. - */ -@ExperimentalSdsApi -fun ParameterisedType.kind(): SdsKind { - return stringToKind(this.kind) -} - -@OptIn(ExperimentalSdsApi::class) -private fun stringToKind(string: String?): SdsKind { - return SdsKind.values().firstOrNull { it.kind == string } - ?: SdsKind.NoKind -} - -@ExperimentalSdsApi -fun SdsTypeParameter.hasSchemaKind() = this.kind() == SdsKind.SchemaKind diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsPrefixOperationOperator.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsPrefixOperationOperator.kt deleted file mode 100644 index 6be53e4d0..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsPrefixOperationOperator.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsPrefixOperation - -/** - * The possible operators for an [SdsPrefixOperation]. - */ -enum class SdsPrefixOperationOperator(val operator: String) { - - /** - * Logical negation. - */ - Not("not"), - - /** - * Arithmetic negation. - */ - Minus("-"), - ; - - override fun toString(): String { - return operator - } -} - -/** - * Returns the [SdsPrefixOperationOperator] of this [SdsPrefixOperation]. - * - * @throws IllegalArgumentException If the operator is unknown. - */ -fun SdsPrefixOperation.operator(): SdsPrefixOperationOperator { - return SdsPrefixOperationOperator.values().firstOrNull { it.operator == this.operator } - ?: throw IllegalArgumentException("Unknown prefix operator '$operator'.") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsProtocolQuantifiedTermQuantifier.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsProtocolQuantifiedTermQuantifier.kt deleted file mode 100644 index a09fa5f91..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsProtocolQuantifiedTermQuantifier.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsProtocolQuantifiedTerm -import com.larsreimann.safeds.utils.ExperimentalSdsApi - -/** - * The possible quantifiers for an [SdsProtocolQuantifiedTerm]. - */ -@ExperimentalSdsApi -enum class SdsProtocolQuantifiedTermQuantifier(val quantifier: String) { - ZeroOrOne("?"), - ZeroOrMore("*"), - OneOrMore("+"), - ; - - override fun toString(): String { - return quantifier - } -} - -/** - * Returns the [SdsProtocolQuantifiedTermQuantifier] of this [SdsProtocolQuantifiedTerm]. - * - * @throws IllegalArgumentException If the quantifier is unknown. - */ -@ExperimentalSdsApi -fun SdsProtocolQuantifiedTerm.quantifier(): SdsProtocolQuantifiedTermQuantifier { - return SdsProtocolQuantifiedTermQuantifier.values().firstOrNull { it.quantifier == this.quantifier } - ?: throw IllegalArgumentException("Unknown quantified term quantifier '$quantifier'.") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsProtocolTokenClassValue.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsProtocolTokenClassValue.kt deleted file mode 100644 index e41ced7bd..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsProtocolTokenClassValue.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsProtocolTokenClass -import com.larsreimann.safeds.utils.ExperimentalSdsApi - -/** - * The possible values for an [SdsProtocolTokenClass]. - */ -@ExperimentalSdsApi -enum class SdsProtocolTokenClassValue(val value: String) { - - /** - * Matches any attribute or function. - */ - Anything("."), - - /** - * Matches any attribute. - */ - AnyAttribute("\\a"), - - /** - * Matches any function. - */ - AnyFunction("\\f"), - ; - - override fun toString(): String { - return value - } -} - -/** - * Returns the [SdsProtocolTokenClassValue] of this [SdsProtocolTokenClass]. - * - * @throws IllegalArgumentException If the value is unknown. - */ -@ExperimentalSdsApi -fun SdsProtocolTokenClass.value(): SdsProtocolTokenClassValue { - return SdsProtocolTokenClassValue.values().firstOrNull { it.value == this.value } - ?: throw IllegalArgumentException("Unknown token class value value '$value'.") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsSchemaEffect.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsSchemaEffect.kt deleted file mode 100644 index 800a22ed2..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsSchemaEffect.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.utils.ExperimentalSdsApi - -/** - * The possible [SdsSchemaEffect]. - */ -@ExperimentalSdsApi -@Suppress("ktlint:trailing-comma-on-declaration-site") -enum class SdsSchemaEffect(val effect: String?) { - NoSchemaEffect(null), - ReadSchemaEffect("\$readSchema"), - CheckColumnEffect("\$checkColumn"), - RemoveColumnEffect("\$removeColumn"), - KeepColumnEffect("\$keepColumn"), - RenameColumnEffect("\$renameColumn"), - AddColumnEffect("\$addColumn"), - ChangeColumnTypeEffect("\$changeColumnType"); - - override fun toString(): String { - return effect ?: "NoSchemaEffect" - } -} - -@ExperimentalSdsApi -fun SdsAbstractDeclaration.nameToSchemaEffect(): SdsSchemaEffect { - return SdsSchemaEffect.values().firstOrNull { it.effect == this.name } - ?: SdsSchemaEffect.NoSchemaEffect -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsTypeParameterConstraintOperator.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsTypeParameterConstraintOperator.kt deleted file mode 100644 index ceb82a2f5..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsTypeParameterConstraintOperator.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsTypeParameterConstraint -import com.larsreimann.safeds.utils.ExperimentalSdsApi - -/** - * The possible operators for an [SdsTypeParameterConstraint]. - */ -@ExperimentalSdsApi -@Suppress("ktlint:trailing-comma-on-declaration-site") -enum class SdsTypeParameterConstraintOperator(val operator: String) { - - /** - * Left operand is a subclass of the right operand. Each class is a subclass of itself for the purpose of this - * operator. - */ - SubclassOf("sub"), - - /** - * Left operand is a superclass of the right operand. Each class is a superclass of itself for the purpose of this - * operator. - */ - SuperclassOf("super"); - - override fun toString(): String { - return operator - } -} - -/** - * Returns the [SdsTypeParameterConstraintOperator] of this [SdsTypeParameterConstraint]. - * - * @throws IllegalArgumentException If the operator is unknown. - */ -@ExperimentalSdsApi -fun SdsTypeParameterConstraint.operator(): SdsTypeParameterConstraintOperator { - return SdsTypeParameterConstraintOperator.values().firstOrNull { it.operator == this.operator } - ?: throw IllegalArgumentException("Unknown type parameter constraint operator '$operator'.") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsVariance.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsVariance.kt deleted file mode 100644 index f7fae0527..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsVariance.kt +++ /dev/null @@ -1,73 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.safeDS.SdsTypeProjection -import com.larsreimann.safeds.utils.ExperimentalSdsApi - -/** - * The possible variances for an [SdsTypeParameter] or [SdsTypeProjection]. - */ -@ExperimentalSdsApi -enum class SdsVariance(val variance: String?) { - - /** - * A complex type `G` is invariant if it is neither covariant nor contravariant. - * - * **Example:** A `Transformer` reads and writes values of type `T`. This means we cannot use a - * `Transformer` if we want a `Transformer`, since it cannot deal with `Double` values as input. - * Likewise, we cannot use a `Transformer` if we want a `Transformer`, since it might create `Double` - * values as output. - */ - Invariant(null), - - /** - * A complex type `G` is covariant if `A <= B` implies `G <= G`. The ordering of types is preserved. - * - * **Positive example:** A `Producer` only ever writes values of type `T` values and never reads them. This means - * we can use a `Producer`, where a `Producer` is expected, since `Ints` are just special `Numbers` - * (`Int <= Number`). - * - * **Negative example:** A `Transformer` reads and writes values of type `T`. This means we cannot use a - * `Transformer` if we want a `Transformer`, since it cannot deal with `Double` values as input. - */ - Covariant("out"), - - /** - * A complex type `G` is covariant if `A <= B` implies `G <= G`. The ordering of types is inverted. - * - * **Positive example:** A `Consumer` only ever reads values of type `T` values and never writes them. This means - * we can use a `Consumer`, where a `Consumer` is expected, since it is able to deal with integers - * (`Int <= Number`). - * - * **Negative example:** A `Transformer` reads and writes values of type `T`. This means we cannot use a - * `Transformer` if we want a `Transformer`, since it might create `Double` values as output. - */ - Contravariant("in"), - ; - - override fun toString(): String { - return name - } -} - -/** - * Returns the [SdsVariance] of this [SdsTypeParameter]. - * - * @throws IllegalArgumentException If the variance is unknown. - */ -@ExperimentalSdsApi -fun SdsTypeParameter.variance(): SdsVariance { - return SdsVariance.values().firstOrNull { it.variance == this.variance } - ?: throw IllegalArgumentException("Unknown variance '$variance'.") -} - -/** - * Returns the [SdsVariance] of this [SdsTypeProjection]. - * - * @throws IllegalArgumentException If the variance is unknown. - */ -@ExperimentalSdsApi -fun SdsTypeProjection.variance(): SdsVariance { - return SdsVariance.values().firstOrNull { it.variance == this.variance } - ?: throw IllegalArgumentException("Unknown variance '$variance'.") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsVisibility.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsVisibility.kt deleted file mode 100644 index f4772c3ee..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant/SdsVisibility.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.larsreimann.safeds.constant - -import com.larsreimann.safeds.safeDS.SdsStep - -/** - * The possible visibilities of an [SdsStep]. - */ -enum class SdsVisibility(val visibility: String?) { - - /** - * The [SdsStep] is visible everywhere. - */ - Public(null), - - /** - * The [SdsStep] is only visible in the same package. - */ - Internal("internal"), - - /** - * The [SdsStep] is only visible in the same file. - */ - Private("private"), - ; - - override fun toString(): String { - return name - } -} - -/** - * Returns the [SdsVisibility] of this [SdsStep]. - * - * @throws IllegalArgumentException If the visibility is unknown. - */ -fun SdsStep.visibility(): SdsVisibility { - return SdsVisibility.values().firstOrNull { it.visibility == this.visibility } - ?: throw IllegalArgumentException("Unknown visibility '$visibility'.") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/AbstractSafeDSStringValueConverter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/AbstractSafeDSStringValueConverter.kt deleted file mode 100644 index 7d897dfcd..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/AbstractSafeDSStringValueConverter.kt +++ /dev/null @@ -1,150 +0,0 @@ -package com.larsreimann.safeds.conversion - -import com.google.inject.Singleton -import org.eclipse.xtext.conversion.ValueConverterException -import org.eclipse.xtext.conversion.ValueConverterWithValueException -import org.eclipse.xtext.conversion.impl.STRINGValueConverter -import org.eclipse.xtext.nodemodel.INode - -/** - * Handles the conversion between the textual representation of a string (including delimiters and escape sequences) to - * and its actual value. - * - * Example: The string `"myString \{"` in a DSL program has the value `myString {`. - */ -@Singleton -abstract class AbstractSafeDSStringValueConverter( - private val startDelimiter: String, - private val endDelimiter: String, -) : STRINGValueConverter() { - - /** - * Lazily initializes a single converter implementation. - */ - private val converter by lazy { - Implementation() - } - - /** - * Converts the value to its textual representation by adding delimiters and escaping characters. - */ - override fun toEscapedString(value: String?): String { - return startDelimiter + converter.convertToJavaString(value, false) + endDelimiter - } - - /** - * Converts the textual representation to its value by removing delimiters and unescaping characters. - */ - override fun toValue(string: String?, node: INode?): String? { - if (string == null) { - return null - } - - return try { - if (string.length < startDelimiter.length + endDelimiter.length) { - throw ValueConverterWithValueException(stringNotClosedMessage, node, "", null) - } - convertFromString(string, node) - } catch (e: IllegalArgumentException) { - throw ValueConverterException(e.message, node, e) - } - } - - /** - * Creates the implementation of the converter to unescape characters. This method is **not** called for escaping - * by the superclass, so we need to override [toEscapedString]. - */ - override fun createConverter(): STRINGValueConverter.Implementation { - return converter - } - - /** - * The implementation of the converter to escape/unescape characters. - */ - private inner class Implementation : STRINGValueConverter.Implementation() { - - /** - * Converts the textual representation to its value by removing delimiters and unescaping characters. - */ - override fun convertFromJavaString(literal: String): String? { - val valueBetweenDelimiters = literal.substring(startDelimiter.length, literal.length - endDelimiter.length) - - return if (!valueBetweenDelimiters.contains('\\')) { - valueBetweenDelimiters - } else { - convertFromJavaString( - "\"$valueBetweenDelimiters\"", - true, - 1, - StringBuilder(literal.length), - ) - } - } - - /** - * Escapes the character and adds it to the builder. This is necessary for serialization. - */ - override fun escapeAndAppendTo(c: Char, useUnicode: Boolean, result: StringBuilder) { - val appendMe: String - when (c) { - '\b' -> appendMe = "\\b" - '\t' -> appendMe = "\\t" - '\n' -> appendMe = "\\n" - '\u000c' -> appendMe = "\\u000c" - '\r' -> appendMe = "\\r" - '"' -> appendMe = "\\\"" - // Don't escape "'" - '\\' -> appendMe = "\\\\" - '{' -> appendMe = "\\{" // Necessary due to string templates - else -> { - if (useUnicode && mustEncodeAsEscapeSequence(c)) { - result.append("\\u") - var i = 12 - while (i >= 0) { - result.append(toHex(c.code shr i and 0xF)) - i -= 4 - } - } else { - result.append(c) - } - return - } - } - result.append(appendMe) - } - - /** - * Unescapes the character and adds it to the builder. This method defines which escape sequences are legal. - */ - override fun doUnescapeCharAndAppendTo( - string: String, - useUnicode: Boolean, - index: Int, - result: StringBuilder, - ): Int { - var c = string[index] - when (c) { - 'b' -> c = '\b' - 't' -> c = '\t' - 'n' -> c = '\n' - 'f' -> c = '\u000c' - 'r' -> c = '\r' - '"', '\'', '\\', '{' -> {} // '{' necessary due to string templates - 'u' -> return when { - useUnicode -> unescapeUnicodeSequence(string, index + 1, result) - else -> handleUnknownEscapeSequence(string, c, false, index + 1, result) - } - else -> return handleUnknownEscapeSequence(string, c, useUnicode, index + 1, result) - } - validateAndAppendChar(c, result) - return index + 1 - } - } - - /** - * Error message that is shown if an invalid escape sequence is encountered. - */ - override fun getInvalidEscapeSequenceMessage(): String { - return "Invalid escape sequence (valid ones are \\b \\t \\n \\f \\r \\\" \\' \\\\ \\{ )." - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSIDValueConverter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSIDValueConverter.kt deleted file mode 100644 index 39ad6d577..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSIDValueConverter.kt +++ /dev/null @@ -1,54 +0,0 @@ -package com.larsreimann.safeds.conversion - -import com.google.inject.Singleton -import org.eclipse.xtext.GrammarUtil -import org.eclipse.xtext.conversion.impl.IDValueConverter -import org.eclipse.xtext.nodemodel.INode - -/** - * Handles the conversion between the textual representation of an ID (including the escaping of keywords) and its - * actual value. - * - * __Example__: The ID ``` `fun` ``` in a DSL program has the value `fun`. - * - * __Note__: This converter is not called for qualified names since this is a data type rule and requires another - * converter. See the Eclipse forum for more information: [https://www.eclipse.org/forums/index.php/t/1088504/]. - */ -@Singleton -class SafeDSIDValueConverter : IDValueConverter() { - - /** - * Syntax of valid identifiers. - */ - private val identifier = Regex("[a-zA-Z_][a-zA-Z_0-9]*") - - /** - * Adds surrounding backticks as necessary. - */ - override fun toEscapedString(value: String): String { - return if (mustEscape(value)) "`$value`" else value - } - - /** - * Removes surrounding backticks. - */ - override fun toValue(string: String?, node: INode?): String? { - return string?.removeSurrounding("`") - } - - /** - * Keywords that could be valid identifiers, e.g. `fun`. - */ - private val textualKeywords: Set by lazy { - GrammarUtil.getAllKeywords(grammarAccess.grammar) - .filter { it.matches(identifier) } - .toSet() - } - - /** - * Checks whether the identifier must be escaped because it clashes with a keyword. - */ - override fun mustEscape(value: String): Boolean { - return value in textualKeywords - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSQualifiedNameValueConverter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSQualifiedNameValueConverter.kt deleted file mode 100644 index 3e6457d0e..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSQualifiedNameValueConverter.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.larsreimann.safeds.conversion - -import com.google.inject.Singleton -import org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter - -@Singleton -class SafeDSQualifiedNameValueConverter : QualifiedNameValueConverter() diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSSTRINGValueConverter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSSTRINGValueConverter.kt deleted file mode 100644 index f97ae6cca..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSSTRINGValueConverter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.larsreimann.safeds.conversion - -import com.google.inject.Singleton - -/** - * Handles the conversion between the textual representation of a string (including delimiters and escape sequences) to - * its actual value. - * - * Example: The string `"myString \{"` in a DSL program has the value `myString {`. - */ -@Singleton -class SafeDSSTRINGValueConverter : AbstractSafeDSStringValueConverter("\"", "\"") diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_ENDValueConverter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_ENDValueConverter.kt deleted file mode 100644 index 323cb2d2b..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_ENDValueConverter.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Singleton - -/** - * Handles the conversion between the textual representation of a template string end (including delimiters and escape - * sequences) to its actual value. - * - * Example: The template string end `}}end"` in a DSL program has the value `end`. - */ -@Singleton -class SafeDSTEMPLATE_STRING_ENDValueConverter : AbstractSafeDSStringValueConverter("}}", "\"") diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_INNERValueConverter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_INNERValueConverter.kt deleted file mode 100644 index fbe997bdc..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_INNERValueConverter.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Singleton - -/** - * Handles the conversion between the textual representation of a template string inner part (including delimiters and - * escape sequences) to its actual value. - * - * Example: The template string inner part `}}inner{{` in a DSL program has the value `inner`. - */ -@Singleton -class SafeDSTEMPLATE_STRING_INNERValueConverter : AbstractSafeDSStringValueConverter("}}", "{{") diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_STARTValueConverter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_STARTValueConverter.kt deleted file mode 100644 index 84fdbad6d..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_STARTValueConverter.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Singleton - -/** - * Handles the conversion between the textual representation of a template string start (including delimiters and escape - * sequences) to its actual value. - * - * Example: The template string start `"start{{` in a DSL program has the value `start`. - */ -@Singleton -class SafeDSTEMPLATE_STRING_STARTValueConverter : AbstractSafeDSStringValueConverter("\"", "{{") diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSValueConverterService.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSValueConverterService.kt deleted file mode 100644 index 06c82b0f9..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion/SafeDSValueConverterService.kt +++ /dev/null @@ -1,67 +0,0 @@ -@file:Suppress("FunctionName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.xtext.conversion.IValueConverter -import org.eclipse.xtext.conversion.ValueConverter -import org.eclipse.xtext.conversion.impl.AbstractDeclarativeValueConverterService -import org.eclipse.xtext.conversion.impl.IDValueConverter -import org.eclipse.xtext.conversion.impl.INTValueConverter -import org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter -import org.eclipse.xtext.conversion.impl.STRINGValueConverter - -/** - * Converters for ID, INT, and STRING. - */ -@Singleton -open class SafeDSValueConverterService : AbstractDeclarativeValueConverterService() { - - @Inject - private lateinit var idValueConverter: IDValueConverter - - @ValueConverter(rule = "ID") - fun ID() = idValueConverter - - @Inject - private lateinit var intValueConverter: INTValueConverter - - @ValueConverter(rule = "INT") - fun INT(): IValueConverter { - return intValueConverter - } - - @Inject - private lateinit var stringValueConverter: STRINGValueConverter - - @ValueConverter(rule = "STRING") - fun STRING() = stringValueConverter - - @Inject - private lateinit var templateStringStartValueConverter: SafeDSTEMPLATE_STRING_STARTValueConverter - - @ValueConverter(rule = "TEMPLATE_STRING_START") - fun TEMPLATE_STRING_START() = templateStringStartValueConverter - - @Inject - private lateinit var templateStringInnerValueConverter: SafeDSTEMPLATE_STRING_INNERValueConverter - - @ValueConverter(rule = "TEMPLATE_STRING_INNER") - fun TEMPLATE_STRING_INNER() = templateStringInnerValueConverter - - @Inject - private lateinit var templateStringEndValueConverter: SafeDSTEMPLATE_STRING_ENDValueConverter - - @ValueConverter(rule = "TEMPLATE_STRING_END") - fun TEMPLATE_STRING_END() = templateStringEndValueConverter - - @Inject - private lateinit var qualifiedNameValueConverter: QualifiedNameValueConverter - - @ValueConverter(rule = "QualifiedName") - fun QualifiedName() = qualifiedNameValueConverter - - @ValueConverter(rule = "QualifiedNameWithWildcard") - fun QualifiedNameWithWildcard() = qualifiedNameValueConverter -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/Creators.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/Creators.kt deleted file mode 100644 index 77836d934..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/Creators.kt +++ /dev/null @@ -1,1591 +0,0 @@ -@file:Suppress("unused") - -package com.larsreimann.safeds.emf - -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.constant.SdsInfixOperationOperator -import com.larsreimann.safeds.constant.SdsKind -import com.larsreimann.safeds.constant.SdsPrefixOperationOperator -import com.larsreimann.safeds.constant.SdsProtocolQuantifiedTermQuantifier -import com.larsreimann.safeds.constant.SdsProtocolTokenClassValue -import com.larsreimann.safeds.constant.SdsTypeParameterConstraintOperator -import com.larsreimann.safeds.constant.SdsVariance -import com.larsreimann.safeds.constant.SdsVisibility -import com.larsreimann.safeds.safeDS.SafeDSFactory -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractClassMember -import com.larsreimann.safeds.safeDS.SdsAbstractCompilationUnitMember -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsAbstractLambda -import com.larsreimann.safeds.safeDS.SdsAbstractNamedTypeDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsAbstractProtocolTerm -import com.larsreimann.safeds.safeDS.SdsAbstractProtocolToken -import com.larsreimann.safeds.safeDS.SdsAbstractStatement -import com.larsreimann.safeds.safeDS.SdsAbstractType -import com.larsreimann.safeds.safeDS.SdsAbstractTypeArgumentValue -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsAnnotationCallList -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsArgumentList -import com.larsreimann.safeds.safeDS.SdsAssigneeList -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsBlock -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsBoolean -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsColumn -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsConstraint -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.safeDS.SdsFloat -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsImport -import com.larsreimann.safeds.safeDS.SdsImportAlias -import com.larsreimann.safeds.safeDS.SdsIndexedAccess -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.safeDS.SdsInt -import com.larsreimann.safeds.safeDS.SdsLambdaParameterList -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsMemberType -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsNull -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParameterList -import com.larsreimann.safeds.safeDS.SdsParentTypeList -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsParenthesizedType -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsPrefixOperation -import com.larsreimann.safeds.safeDS.SdsProtocol -import com.larsreimann.safeds.safeDS.SdsProtocolAlternative -import com.larsreimann.safeds.safeDS.SdsProtocolComplement -import com.larsreimann.safeds.safeDS.SdsProtocolParenthesizedTerm -import com.larsreimann.safeds.safeDS.SdsProtocolQuantifiedTerm -import com.larsreimann.safeds.safeDS.SdsProtocolReference -import com.larsreimann.safeds.safeDS.SdsProtocolReferenceList -import com.larsreimann.safeds.safeDS.SdsProtocolSequence -import com.larsreimann.safeds.safeDS.SdsProtocolSubterm -import com.larsreimann.safeds.safeDS.SdsProtocolTokenClass -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsResultList -import com.larsreimann.safeds.safeDS.SdsSchema -import com.larsreimann.safeds.safeDS.SdsSchemaReference -import com.larsreimann.safeds.safeDS.SdsSchemaType -import com.larsreimann.safeds.safeDS.SdsStarProjection -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsString -import com.larsreimann.safeds.safeDS.SdsTemplateString -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeArgumentList -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.safeDS.SdsTypeParameterConstraint -import com.larsreimann.safeds.safeDS.SdsTypeParameterList -import com.larsreimann.safeds.safeDS.SdsTypeProjection -import com.larsreimann.safeds.safeDS.SdsUnionType -import com.larsreimann.safeds.safeDS.SdsWildcard -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.utils.nullIfEmptyElse -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.xtext.resource.XtextResource -import kotlin.math.absoluteValue - -private val factory = SafeDSFactory.eINSTANCE - -/** - * Returns a new [Resource]. - * - * This can be useful to serialize EObjects that were initialized with the creators in this file rather than generated - * by the parser, since serialization requires EObjects to be contained in a resource. - */ -fun createSdsDummyResource( - fileName: String, - fileExtension: SdsFileExtension, - compilationUnit: SdsCompilationUnit, -): Resource { - val uri = URI.createURI("dummy:/$fileName.${fileExtension.extension}") - return XtextResource(uri).apply { - this.contents += compilationUnit - } -} - -/** - * Returns a new [Resource]. - * - * This can be useful to serialize EObjects that were initialized with the creators in this file rather than generated - * by the parser, since serialization requires EObjects to be contained in a resource. - */ -fun createSdsDummyResource( - fileName: String, - fileExtension: SdsFileExtension, - packageName: String, - init: SdsCompilationUnit.() -> Unit = {}, -): Resource { - val uri = URI.createURI("dummy:/$fileName.${fileExtension.extension}") - return XtextResource(uri).apply { - this.contents += createSdsCompilationUnit( - packageName = packageName, - init = init, - ) - } -} - -/** - * Returns a new object of class [SdsAnnotation]. - */ -fun createSdsAnnotation( - name: String, - annotationCalls: List = emptyList(), - parameters: List = emptyList(), -): SdsAnnotation { - return factory.createSdsAnnotation().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - this.parameterList = parameters.nullIfEmptyElse(::createSdsParameterList) - } -} - -/** - * Adds a new object of class [SdsAnnotation] to the receiver. - */ -fun SdsCompilationUnit.sdsAnnotation( - name: String, - annotationCalls: List = emptyList(), - parameters: List = emptyList(), -) { - this.addMember(createSdsAnnotation(name, annotationCalls, parameters)) -} - -/** - * Returns a new object of class [SdsAnnotationCall]. - */ -fun createSdsAnnotationCall( - annotation: SdsAnnotation, - arguments: List = emptyList(), -): SdsAnnotationCall { - return factory.createSdsAnnotationCall().apply { - this.annotation = annotation - this.argumentList = arguments.nullIfEmptyElse(::createSdsArgumentList) - } -} - -/** - * Returns a new object of class [SdsAnnotationCall] that points to an annotation with the given name. - */ -fun createSdsAnnotationCall( - annotationName: String, - arguments: List = emptyList(), -): SdsAnnotationCall { - return createSdsAnnotationCall( - createSdsAnnotation(annotationName), - arguments, - ) -} - -/** - * Returns a new object of class [SdsAnnotationCallList]. - */ -private fun createSdsAnnotationCallList(annotationCalls: List): SdsAnnotationCallList { - return factory.createSdsAnnotationCallList().apply { - this.annotationCalls += annotationCalls - } -} - -/** - * Returns a new object of class [SdsArgument]. - */ -fun createSdsArgument(value: SdsAbstractExpression, parameter: SdsParameter? = null): SdsArgument { - return factory.createSdsArgument().apply { - this.value = value - this.parameter = parameter - } -} - -/** - * Returns a new object of class [SdsArgument] that points to a parameter with the given name. - */ -fun createSdsArgument(value: SdsAbstractExpression, parameterName: String): SdsArgument { - return createSdsArgument( - value, - createSdsParameter(parameterName), - ) -} - -/** - * Returns a new object of class [SdsArgumentList]. - */ -fun createSdsArgumentList(arguments: List): SdsArgumentList { - return factory.createSdsArgumentList().apply { - this.arguments += arguments - } -} - -/** - * Returns a new object of class [SdsAssigneeList]. - */ -fun createSdsAssigneeList(assignees: List): SdsAssigneeList { - return factory.createSdsAssigneeList().apply { - this.assignees += assignees - } -} - -/** - * Returns a new object of class [SdsAssignment]. - * - * @throws IllegalArgumentException If no assignees are passed. - */ -fun createSdsAssignment(assignees: List, expression: SdsAbstractExpression): SdsAssignment { - if (assignees.isEmpty()) { - throw IllegalArgumentException("Must have at least one assignee.") - } - - return factory.createSdsAssignment().apply { - this.assigneeList = createSdsAssigneeList(assignees) - this.expression = expression - } -} - -/** - * Adds a new object of class [SdsAssignment] to the receiver. - */ -fun SdsBlockLambda.sdsAssignment(assignees: List, expression: SdsAbstractExpression) { - this.addStatement(createSdsAssignment(assignees, expression)) -} - -/** - * Adds a new object of class [SdsAssignment] to the receiver. - */ -fun SdsPipeline.sdsAssignment(assignees: List, expression: SdsAbstractExpression) { - this.addStatement(createSdsAssignment(assignees, expression)) -} - -/** - * Adds a new object of class [SdsAssignment] to the receiver. - */ -fun SdsStep.sdsAssignment(assignees: List, expression: SdsAbstractExpression) { - this.addStatement(createSdsAssignment(assignees, expression)) -} - -/** - * Returns a new object of class [SdsAttribute]. - */ -fun createSdsAttribute( - name: String, - annotationCalls: List = emptyList(), - isStatic: Boolean = false, - type: SdsAbstractType? = null, -): SdsAttribute { - return factory.createSdsAttribute().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - this.isStatic = isStatic - this.type = type - } -} - -/** - * Adds a new object of class [SdsAttribute] to the receiver. - */ -fun SdsClass.sdsAttribute( - name: String, - annotationCalls: List = emptyList(), - isStatic: Boolean = false, - type: SdsAbstractType? = null, -) { - this.addMember(createSdsAttribute(name, annotationCalls, isStatic, type)) -} - -/** - * Returns a new object of class [SdsBlock]. - */ -fun createSdsBlock( - statements: List = emptyList(), - init: SdsBlock.() -> Unit = {}, -): SdsBlock { - return factory.createSdsBlock().apply { - this.statements += statements - this.init() - } -} - -/** - * Returns a new object of class [SdsBlockLambda]. - */ -fun createSdsBlockLambda( - parameters: List = emptyList(), - statements: List = emptyList(), - init: SdsBlockLambda.() -> Unit = {}, -): SdsBlockLambda { - return factory.createSdsBlockLambda().apply { - this.parameterList = createSdsLambdaParameterList(parameters) - this.body = factory.createSdsBlock() - statements.forEach { addStatement(it) } - this.init() - } -} - -/** - * Adds a new statement to the receiver. - */ -private fun SdsBlockLambda.addStatement(statement: SdsAbstractStatement) { - if (this.body == null) { - this.body = factory.createSdsBlock() - } - - this.body.statements += statement -} - -/** - * Returns a new object of class [SdsBlockLambdaResult]. - */ -fun createSdsBlockLambdaResult(name: String): SdsBlockLambdaResult { - return factory.createSdsBlockLambdaResult().apply { - this.name = name - } -} - -/** - * Returns a new object of class [SdsBoolean]. - */ -fun createSdsBoolean(value: Boolean): SdsBoolean { - return factory.createSdsBoolean().apply { - this.isTrue = value - } -} - -/** - * Returns a new object of class [SdsCall]. - */ -fun createSdsCall( - receiver: SdsAbstractExpression, - typeArguments: List = emptyList(), - arguments: List = emptyList(), -): SdsCall { - return factory.createSdsCall().apply { - this.receiver = receiver - this.typeArgumentList = typeArguments.nullIfEmptyElse(::createSdsTypeArgumentList) - this.argumentList = createSdsArgumentList(arguments) - } -} - -/** - * Returns a new object of class [SdsCallableType]. - */ -fun createSdsCallableType(parameters: List, results: List): SdsCallableType { - return factory.createSdsCallableType().apply { - this.parameterList = createSdsParameterList(parameters) - this.resultList = createSdsResultList(results) - } -} - -/** - * Returns a new object of class [SdsClass]. - */ -fun createSdsClass( - name: String, - annotationCalls: List = emptyList(), - typeParameters: List = emptyList(), - parameters: List? = null, // null and emptyList() are semantically different - parentTypes: List = emptyList(), - constraint: SdsConstraint? = null, - protocol: SdsProtocol? = null, - members: List = emptyList(), - init: SdsClass.() -> Unit = {}, -): SdsClass { - return factory.createSdsClass().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - this.typeParameterList = typeParameters.nullIfEmptyElse(::createSdsTypeParameterList) - this.parameterList = parameters?.let { createSdsParameterList(it) } - this.parentTypeList = parentTypes.nullIfEmptyElse(::createSdsParentTypeList) - protocol?.let { addMember(it) } - constraint?.let { addMember(it) } - members.forEach { addMember(it) } - this.init() - } -} - -/** - * Adds a new object of class [SdsClass] to the receiver. - */ -fun SdsClass.sdsClass( - name: String, - annotationCalls: List = emptyList(), - typeParameters: List = emptyList(), - parameters: List? = null, - parentTypes: List = emptyList(), - constraint: SdsConstraint? = null, - protocol: SdsProtocol? = null, - members: List = emptyList(), - init: SdsClass.() -> Unit = {}, -) { - this.addMember( - createSdsClass( - name, - annotationCalls, - typeParameters, - parameters, - parentTypes, - constraint, - protocol, - members, - init, - ), - ) -} - -/** - * Adds a new object of class [SdsClass] to the receiver. - */ -fun SdsCompilationUnit.sdsClass( - name: String, - annotationCalls: List = emptyList(), - typeParameters: List = emptyList(), - parameters: List? = null, - parentTypes: List = emptyList(), - constraint: SdsConstraint? = null, - protocol: SdsProtocol? = null, - members: List = emptyList(), - init: SdsClass.() -> Unit = {}, -) { - this.addMember( - createSdsClass( - name, - annotationCalls, - typeParameters, - parameters, - parentTypes, - constraint, - protocol, - members, - init, - ), - ) -} - -/** - * Adds a new member to the receiver. - */ -private fun SdsClass.addMember(member: SdsAbstractObject) { - if (this.body == null) { - this.body = factory.createSdsClassBody() - } - - this.body.members += member -} - -/** - * Returns a new object of class [SdsCompilationUnit]. - */ -fun createSdsCompilationUnit( - packageName: String, - annotationCalls: List = emptyList(), - imports: List = emptyList(), - members: List = emptyList(), - init: SdsCompilationUnit.() -> Unit = {}, -): SdsCompilationUnit { - return factory.createSdsCompilationUnit().apply { - this.name = packageName - this.annotationCalls += annotationCalls - this.imports += imports - members.forEach { addMember(it) } - init() - } -} - -/** - * Adds a new member to the receiver. - */ -private fun SdsCompilationUnit.addMember(member: SdsAbstractCompilationUnitMember) { - this.members += member -} - -/** - * Returns a new object of class [SdsConstraint]. - */ -@ExperimentalSdsApi -fun createSdsConstraint(statements: List = emptyList()): SdsConstraint { - return factory.createSdsConstraint().apply { - this.body = factory.createSdsBlock() - statements.forEach { addStatement(it) } - } -} - -/** - * Adds a new statement to the receiver. - */ -private fun SdsConstraint.addStatement(statement: SdsAbstractStatement) { - if (this.body == null) { - this.body = factory.createSdsBlock() - } - - this.body.statements += statement -} - -/** - * Returns a new object of class [SdsColumn]. - */ -@ExperimentalSdsApi -fun createSdsColumn( - columnName: String, - columnType: SdsAbstractType, -): SdsColumn { - return factory.createSdsColumn().apply { - this.columnName = createSdsString(columnName) - this.columnType = columnType - } -} - -/** - * Returns a new object of class [SdsEnum]. - */ -fun createSdsEnum( - name: String, - annotationCalls: List = emptyList(), - variants: List = emptyList(), - init: SdsEnum.() -> Unit = {}, -): SdsEnum { - return factory.createSdsEnum().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - variants.forEach { addVariant(it) } - this.init() - } -} - -/** - * Adds a new object of class [SdsEnum] to the receiver. - */ -fun SdsClass.sdsEnum( - name: String, - annotationCalls: List = emptyList(), - variants: List = emptyList(), - init: SdsEnum.() -> Unit = {}, -) { - this.addMember(createSdsEnum(name, annotationCalls, variants, init)) -} - -/** - * Adds a new object of class [SdsEnum] to the receiver. - */ -fun SdsCompilationUnit.sdsEnum( - name: String, - annotationCalls: List = emptyList(), - variants: List = emptyList(), - init: SdsEnum.() -> Unit = {}, -) { - this.addMember(createSdsEnum(name, annotationCalls, variants, init)) -} - -/** - * Adds a new variant to the receiver. - */ -private fun SdsEnum.addVariant(variant: SdsEnumVariant) { - if (this.body == null) { - this.body = factory.createSdsEnumBody() - } - - this.body.variants += variant -} - -/** - * Returns a new object of class [SdsEnumVariant]. - */ -fun createSdsEnumVariant( - name: String, - annotationCalls: List = emptyList(), - typeParameters: List = emptyList(), - parameters: List = emptyList(), - constraint: SdsConstraint? = null, -): SdsEnumVariant { - return factory.createSdsEnumVariant().apply { - this.name = name - this.annotationCalls += annotationCalls - this.typeParameterList = typeParameters.nullIfEmptyElse(::createSdsTypeParameterList) - this.parameterList = parameters.nullIfEmptyElse(::createSdsParameterList) - this.constraint = constraint - } -} - -/** - * Adds a new object of class [SdsEnumVariant] to the receiver. - */ -fun SdsEnum.sdsEnumVariant( - name: String, - annotationCalls: List = emptyList(), - typeParameters: List = emptyList(), - parameters: List = emptyList(), - constraint: SdsConstraint? = null, -) { - this.addVariant(createSdsEnumVariant(name, annotationCalls, typeParameters, parameters, constraint)) -} - -/** - * Returns a new object of class [SdsExpressionLambda]. - */ -fun createSdsExpressionLambda( - parameters: List = emptyList(), - result: SdsAbstractExpression, -): SdsExpressionLambda { - return factory.createSdsExpressionLambda().apply { - this.parameterList = createSdsLambdaParameterList(parameters) - this.result = result - } -} - -/** - * Returns a new object of class [SdsExpressionStatement]. - */ -fun createSdsExpressionStatement(expression: SdsAbstractExpression): SdsExpressionStatement { - return factory.createSdsExpressionStatement().apply { - this.expression = expression - } -} - -/** - * Adds a new object of class [SdsExpressionStatement] to the receiver. - */ -fun SdsBlockLambda.sdsExpressionStatement(expression: SdsAbstractExpression) { - this.addStatement(createSdsExpressionStatement(expression)) -} - -/** - * Adds a new object of class [SdsExpressionStatement] to the receiver. - */ -fun SdsPipeline.sdsExpressionStatement(expression: SdsAbstractExpression) { - this.addStatement(createSdsExpressionStatement(expression)) -} - -/** - * Adds a new object of class [SdsExpressionStatement] to the receiver. - */ -fun SdsStep.sdsExpressionStatement(expression: SdsAbstractExpression) { - this.addStatement(createSdsExpressionStatement(expression)) -} - -/** - * Returns a new object of class [SdsFloat] if the value is non-negative. Otherwise, the absolute value will be wrapped - * in a [SdsPrefixOperation] to negate it. - */ -fun createSdsFloat(value: Double): SdsAbstractExpression { - val float = factory.createSdsFloat().apply { - this.value = value.absoluteValue - } - - return when { - value < 0 -> createSdsPrefixOperation(SdsPrefixOperationOperator.Minus, float) - else -> float - } -} - -/** - * Returns a new object of class [SdsFunction]. - */ -fun createSdsFunction( - name: String, - annotationCalls: List = emptyList(), - isStatic: Boolean = false, - typeParameters: List = emptyList(), - parameters: List = emptyList(), - results: List = emptyList(), - constraint: SdsConstraint? = null, -): SdsFunction { - return factory.createSdsFunction().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - this.isStatic = isStatic - this.typeParameterList = typeParameters.nullIfEmptyElse(::createSdsTypeParameterList) - this.parameterList = createSdsParameterList(parameters) - this.resultList = results.nullIfEmptyElse(::createSdsResultList) - constraint?.let { addStatement(it) } - } -} - -/** - * Adds a new statement to the receiver. - */ -private fun SdsFunction.addStatement(statement: SdsAbstractObject) { - if (this.body == null) { - this.body = factory.createSdsFunctionBody() - } - - this.body.statements += statement -} - -/** - * Adds a new object of class [SdsFunction] to the receiver. - */ -fun SdsClass.sdsFunction( - name: String, - annotationCalls: List = emptyList(), - isStatic: Boolean = false, - typeParameters: List = emptyList(), - parameters: List = emptyList(), - results: List = emptyList(), - constraint: SdsConstraint? = null, -) { - this.addMember( - createSdsFunction( - name, - annotationCalls, - isStatic, - typeParameters, - parameters, - results, - constraint, - ), - ) -} - -/** - * Adds a new object of class [SdsFunction] to the receiver. - */ -fun SdsCompilationUnit.sdsFunction( - name: String, - annotationCalls: List = emptyList(), - isStatic: Boolean = false, - typeParameters: List = emptyList(), - parameters: List = emptyList(), - results: List = emptyList(), - constraint: SdsConstraint? = null, -) { - this.addMember( - createSdsFunction( - name, - annotationCalls, - isStatic, - typeParameters, - parameters, - results, - constraint, - ), - ) -} - -/** - * Returns a new object of class [SdsImport]. - */ -fun createSdsImport(importedNamespace: String, alias: String? = null): SdsImport { - return factory.createSdsImport().apply { - this.importedNamespace = importedNamespace - this.alias = createSdsImportAlias(alias) - } -} - -/** - * Returns a new object of class [SdsImportAlias] or `null` if the parameter is `null`. - */ -private fun createSdsImportAlias(name: String?): SdsImportAlias? { - if (name == null) { - return null - } - - return factory.createSdsImportAlias().apply { - this.name = name - } -} - -/** - * Returns a new object of class [SdsIndexedAccess]. - */ -fun createSdsIndexedAccess( - index: SdsAbstractExpression, -): SdsIndexedAccess { - return factory.createSdsIndexedAccess().apply { - this.index = index - } -} - -/** - * Returns a new object of class [SdsInfixOperation]. - */ -fun createSdsInfixOperation( - leftOperand: SdsAbstractExpression, - operator: SdsInfixOperationOperator, - rightOperand: SdsAbstractExpression, -): SdsInfixOperation { - return factory.createSdsInfixOperation().apply { - this.leftOperand = leftOperand - this.operator = operator.operator - this.rightOperand = rightOperand - } -} - -/** - * Returns a new object of class [SdsInt] if the value is non-negative. Otherwise, the absolute value will be wrapped in - * a [SdsPrefixOperation] to negate it. - */ -fun createSdsInt(value: Int): SdsAbstractExpression { - val int = factory.createSdsInt().apply { - this.value = value.absoluteValue - } - - return when { - value < 0 -> createSdsPrefixOperation(SdsPrefixOperationOperator.Minus, int) - else -> int - } -} - -/** - * Returns a new object of class [SdsMemberAccess]. - */ -fun createSdsMemberAccess( - receiver: SdsAbstractExpression, - member: SdsReference, - isNullSafe: Boolean = false, -): SdsMemberAccess { - return factory.createSdsMemberAccess().apply { - this.receiver = receiver - this.member = member - this.isNullSafe = isNullSafe - } -} - -/** - * Returns a new object of class [SdsMemberType]. - */ -fun createSdsMemberType(receiver: SdsAbstractType, member: SdsNamedType): SdsMemberType { - return factory.createSdsMemberType().apply { - this.receiver = receiver - this.member = member - } -} - -/** - * Returns a new object of class [SdsNamedType]. - */ -fun createSdsNamedType( - declaration: SdsAbstractNamedTypeDeclaration, - typeArguments: List = emptyList(), - isNullable: Boolean = false, -): SdsNamedType { - return factory.createSdsNamedType().apply { - this.declaration = declaration - this.typeArgumentList = typeArguments.nullIfEmptyElse(::createSdsTypeArgumentList) - this.isNullable = isNullable - } -} - -/** - * Returns a new object of class [SdsNull]. - */ -fun createSdsNull(): SdsNull { - return factory.createSdsNull() -} - -/** - * Returns a new object of class [SdsParameter]. - */ -fun createSdsParameter( - name: String, - annotationCalls: List = emptyList(), - isVariadic: Boolean = false, - type: SdsAbstractType? = null, - defaultValue: SdsAbstractExpression? = null, -): SdsParameter { - return factory.createSdsParameter().apply { - this.name = name - this.annotationCalls += annotationCalls - this.isVariadic = isVariadic - this.type = type - this.defaultValue = defaultValue - } -} - -/** - * Returns a new object of class [SdsParameterList]. - */ -fun createSdsParameterList(parameters: List): SdsParameterList { - return factory.createSdsParameterList().apply { - this.parameters += parameters - } -} - -/** - * Returns a new object of class [SdsLambdaParameterList]. These have to be used as parameter lists of an - * [SdsAbstractLambda] - */ -fun createSdsLambdaParameterList(parameters: List): SdsLambdaParameterList { - return factory.createSdsLambdaParameterList().apply { - this.parameters += parameters - } -} - -/** - * Returns a new object of class [SdsParenthesizedExpression]. - */ -fun createSdsParenthesizedExpression(expression: SdsAbstractExpression): SdsParenthesizedExpression { - return factory.createSdsParenthesizedExpression().apply { - this.expression = expression - } -} - -/** - * Returns a new object of class [SdsParenthesizedType]. - */ -fun createSdsParenthesizedType(type: SdsAbstractType): SdsParenthesizedType { - return factory.createSdsParenthesizedType().apply { - this.type = type - } -} - -/** - * Returns a new object of class [SdsParentTypeList]. - */ -fun createSdsParentTypeList(parentTypes: List): SdsParentTypeList { - return factory.createSdsParentTypeList().apply { - this.parentTypes += parentTypes - } -} - -/** - * Returns a new object of class [SdsPipeline]. - */ -fun createSdsPipeline( - name: String, - annotationCalls: List = emptyList(), - statements: List = emptyList(), - init: SdsPipeline.() -> Unit = {}, -): SdsPipeline { - return factory.createSdsPipeline().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - this.body = factory.createSdsBlock() - statements.forEach { addStatement(it) } - this.init() - } -} - -/** - * Adds a new object of class [SdsPipeline] to the receiver. - */ -fun SdsCompilationUnit.sdsPipeline( - name: String, - annotationCalls: List = emptyList(), - statements: List = emptyList(), - init: SdsPipeline.() -> Unit = {}, -) { - this.addMember(createSdsPipeline(name, annotationCalls, statements, init)) -} - -/** - * Adds a new statement to the receiver. - */ -private fun SdsPipeline.addStatement(statement: SdsAbstractStatement) { - if (this.body == null) { - this.body = factory.createSdsBlock() - } - - this.body.statements += statement -} - -/** - * Returns a new object of class [SdsPlaceholder]. - */ -fun createSdsPlaceholder(name: String): SdsPlaceholder { - return factory.createSdsPlaceholder().apply { - this.name = name - } -} - -/** - * Returns a new object of class [SdsPredicate]. - */ -fun createSdsPredicate( - name: String, - annotationCalls: List = emptyList(), - typeParameters: List = emptyList(), - parameters: List = emptyList(), - results: List = emptyList(), - statements: List = emptyList(), -): SdsPredicate { - return factory.createSdsPredicate().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - this.typeParameterList = typeParameters.nullIfEmptyElse(::createSdsTypeParameterList) - this.parameterList = createSdsParameterList(parameters) - this.resultList = results.nullIfEmptyElse(::createSdsResultList) - this.body = factory.createSdsBlock() - statements.forEach { addStatement(it) } - } -} - -/** - * Adds a new object of class [SdsPredicate] to the receiver. - */ -fun SdsCompilationUnit.sdsPredicate( - name: String, - annotationCalls: List = emptyList(), - typeParameters: List = emptyList(), - parameters: List = emptyList(), - results: List = emptyList(), - statements: List = emptyList(), -) { - this.addMember( - createSdsPredicate( - name, - annotationCalls, - typeParameters, - parameters, - results, - statements, - ), - ) -} - -/** - * Adds a new statements to the receiver. - */ -private fun SdsPredicate.addStatement(statement: SdsAbstractStatement) { - if (this.body == null) { - this.body = factory.createSdsBlock() - } - - this.body.statements += statement -} - -/** - * Returns a new object of class [SdsPrefixOperation]. - */ -fun createSdsPrefixOperation(operator: SdsPrefixOperationOperator, operand: SdsAbstractExpression): SdsPrefixOperation { - return factory.createSdsPrefixOperation().apply { - this.operator = operator.operator - this.operand = operand - } -} - -/** - * Returns a new object of class [SdsProtocol]. - */ -@ExperimentalSdsApi -fun createSdsProtocol( - subterms: List = emptyList(), - term: SdsAbstractProtocolTerm? = null, - init: SdsProtocol.() -> Unit = {}, -): SdsProtocol { - return factory.createSdsProtocol().apply { - this.body = factory.createSdsProtocolBody() - subterms.forEach { addSubterm(it) } - this.body.term = term - this.init() - } -} - -/** - * Adds a new object of class [SdsProtocol] to the receiver. - */ -@ExperimentalSdsApi -fun SdsClass.sdsProtocol( - subterms: List = emptyList(), - term: SdsAbstractProtocolTerm? = null, - init: SdsProtocol.() -> Unit = {}, -) { - this.addMember(createSdsProtocol(subterms, term, init)) -} - -/** - * Adds a new subterm to the receiver. - */ -@ExperimentalSdsApi -private fun SdsProtocol.addSubterm(subterm: SdsProtocolSubterm) { - if (this.body == null) { - this.body = factory.createSdsProtocolBody() - } - - if (this.body.subtermList == null) { - this.body.subtermList = factory.createSdsProtocolSubtermList() - } - - this.body.subtermList.subterms += subterm -} - -/** - * Returns a new object of class [SdsProtocolAlternative]. - */ -@ExperimentalSdsApi -fun createSdsProtocolAlternative(terms: List): SdsProtocolAlternative { - if (terms.size < 2) { - throw IllegalArgumentException("Must have at least two terms.") - } - - return factory.createSdsProtocolAlternative().apply { - this.terms += terms - } -} - -/** - * Returns a new object of class [SdsProtocolComplement]. - */ -@ExperimentalSdsApi -fun createSdsProtocolComplement( - universe: SdsProtocolTokenClass? = null, - references: List = emptyList(), -): SdsProtocolComplement { - return factory.createSdsProtocolComplement().apply { - this.universe = universe - this.referenceList = references.nullIfEmptyElse(::createSdsProtocolReferenceList) - } -} - -/** - * Returns a new object of class [SdsProtocolParenthesizedTerm]. - */ -@ExperimentalSdsApi -fun createSdsProtocolParenthesizedTerm(term: SdsAbstractProtocolTerm): SdsProtocolParenthesizedTerm { - return factory.createSdsProtocolParenthesizedTerm().apply { - this.term = term - } -} - -/** - * Returns a new object of class [SdsProtocolQuantifiedTerm]. - */ -@ExperimentalSdsApi -fun createSdsProtocolQuantifiedTerm( - term: SdsAbstractProtocolTerm, - quantifier: SdsProtocolQuantifiedTermQuantifier, -): SdsProtocolQuantifiedTerm { - return factory.createSdsProtocolQuantifiedTerm().apply { - this.term = term - this.quantifier = quantifier.quantifier - } -} - -/** - * Returns a new object of class [SdsProtocolReference]. - */ -@ExperimentalSdsApi -fun createSdsProtocolReference(token: SdsAbstractProtocolToken): SdsProtocolReference { - return factory.createSdsProtocolReference().apply { - this.token = token - } -} - -/** - * Returns a new object of class [SdsProtocolReferenceList]. - */ -@ExperimentalSdsApi -fun createSdsProtocolReferenceList(references: List): SdsProtocolReferenceList { - return factory.createSdsProtocolReferenceList().apply { - this.references += references - } -} - -/** - * Returns a new object of class [SdsProtocolSequence]. - * - * @throws IllegalArgumentException If `terms.size < 2`. - */ -@ExperimentalSdsApi -fun createSdsProtocolSequence(terms: List): SdsProtocolSequence { - if (terms.size < 2) { - throw IllegalArgumentException("Must have at least two terms.") - } - - return factory.createSdsProtocolSequence().apply { - this.terms += terms - } -} - -/** - * Returns a new object of class [SdsProtocolSubterm]. - */ -@ExperimentalSdsApi -fun createSdsProtocolSubterm(name: String, term: SdsAbstractProtocolTerm): SdsProtocolSubterm { - return factory.createSdsProtocolSubterm().apply { - this.name = name - this.term = term - } -} - -/** - * Returns a new object of class [SdsProtocolSubterm]. - */ -@ExperimentalSdsApi -fun SdsProtocol.sdsProtocolSubterm(name: String, term: SdsAbstractProtocolTerm) { - this.addSubterm(createSdsProtocolSubterm(name, term)) -} - -/** - * Returns a new object of class [SdsProtocolTokenClass]. - */ -@ExperimentalSdsApi -fun createSdsProtocolTokenClass(value: SdsProtocolTokenClassValue): SdsProtocolTokenClass { - return factory.createSdsProtocolTokenClass().apply { - this.value = value.value - } -} - -/** - * Returns a new object of class [SdsReference]. - */ -fun createSdsReference(declaration: SdsAbstractDeclaration): SdsReference { - return factory.createSdsReference().apply { - this.declaration = declaration - } -} - -/** - * Returns a new object of class [SdsResult]. - */ -fun createSdsResult( - name: String, - annotationCalls: List = emptyList(), - type: SdsAbstractType? = null, -): SdsResult { - return factory.createSdsResult().apply { - this.name = name - this.annotationCalls += annotationCalls - this.type = type - } -} - -/** - * Returns a new object of class [SdsResultList]. - */ -fun createSdsResultList(results: List): SdsResultList { - return factory.createSdsResultList().apply { - this.results += results - } -} - -/** - * Returns a new object of class [SdsSchemaReference]. - */ -fun createSdsSchemaReference(type: SdsSchemaType): SdsSchemaReference { - return factory.createSdsSchemaReference().apply { - this.type = type - } -} - -/** - * Returns a new object of class [SdsStarProjection]. - */ -fun createSdsStarProjection(): SdsStarProjection { - return factory.createSdsStarProjection() -} - -/** - * Returns a new object of class [SdsSchema]. - */ -@ExperimentalSdsApi -fun createSdsSchema( - name: String, - annotationCalls: List = emptyList(), - columns: List = emptyList(), -): SdsSchema { - return factory.createSdsSchema().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - columns.forEach { addColumn(it) } - } -} - -/** - * Adds a new object of class [SdsSchema] to the receiver. - */ -@ExperimentalSdsApi -fun SdsCompilationUnit.sdsSchema( - name: String, - annotationCalls: List = emptyList(), - columns: List = emptyList(), -) { - this.addMember( - createSdsSchema( - name, - annotationCalls, - columns, - ), - ) -} - -/** - * Adds a new column to the receiver. - */ -@ExperimentalSdsApi -private fun SdsSchema.addColumn(column: SdsColumn) { - if (this.columnList == null) { - this.columnList = factory.createSdsColumnList() - } - this.columnList.columns += column -} - -/** - * Returns a new object of class [SdsStep]. - */ -fun createSdsStep( - name: String, - annotationCalls: List = emptyList(), - visibility: SdsVisibility = SdsVisibility.Public, - parameters: List = emptyList(), - results: List = emptyList(), - statements: List = emptyList(), - init: SdsStep.() -> Unit = {}, -): SdsStep { - return factory.createSdsStep().apply { - this.name = name - this.annotationCallList = createSdsAnnotationCallList(annotationCalls) - this.visibility = visibility.visibility - this.parameterList = createSdsParameterList(parameters) - this.resultList = results.nullIfEmptyElse(::createSdsResultList) - this.body = factory.createSdsBlock() - statements.forEach { addStatement(it) } - this.init() - } -} - -/** - * Adds a new object of class [SdsStep] to the receiver. - */ -fun SdsCompilationUnit.sdsStep( - name: String, - annotationCalls: List = emptyList(), - visibility: SdsVisibility = SdsVisibility.Public, - parameters: List = emptyList(), - results: List = emptyList(), - statements: List = emptyList(), - init: SdsStep.() -> Unit = {}, -) { - this.addMember( - createSdsStep( - name, - annotationCalls, - visibility, - parameters, - results, - statements, - init, - ), - ) -} - -/** - * Adds a new statement to the receiver. - */ -private fun SdsStep.addStatement(statement: SdsAbstractStatement) { - if (this.body == null) { - this.body = factory.createSdsBlock() - } - - this.body.statements += statement -} - -/** - * Returns a new object of class [SdsString]. - */ -fun createSdsString(value: String): SdsString { - return factory.createSdsString().apply { - this.value = value - } -} - -/** - * Returns a new object of class [SdsTemplateString]. String parts should not include delimiters (`"`, `{{`, `}}`). - * Template expressions are inserted between the string parts. - * - * @throws IllegalArgumentException If `stringParts.size < 2`. - * @throws IllegalArgumentException If `templateExpressions` is empty. - * @throws IllegalArgumentException If `stringsParts.size` != `templateExpressions.size + 1`. - */ -fun createSdsTemplateString( - stringParts: List, - templateExpressions: List, -): SdsTemplateString { - // One of the first two checks is sufficient but this allows better error messages. - if (stringParts.size < 2) { - throw IllegalArgumentException("Must have at least two string parts.") - } else if (templateExpressions.isEmpty()) { - throw IllegalArgumentException("Must have at least one template expression.") - } else if (stringParts.size != templateExpressions.size + 1) { - throw IllegalArgumentException("Must have exactly one more string part than there are template expressions.") - } - - return factory.createSdsTemplateString().apply { - stringParts.forEachIndexed { index, value -> - - // Next template string part - this.expressions += when (index) { - 0 -> { - factory.createSdsTemplateStringStart().apply { - this.value = value - } - } - stringParts.size - 1 -> { - factory.createSdsTemplateStringEnd().apply { - this.value = value - } - } - else -> { - factory.createSdsTemplateStringInner().apply { - this.value = value - } - } - } - - // Next template expression - if (index < templateExpressions.size) { - this.expressions += templateExpressions[index] - } - } - - this.expressions += expressions - } -} - -/** - * Returns a new object of class [SdsTypeArgument]. - */ -fun createSdsTypeArgument( - value: SdsAbstractTypeArgumentValue, - typeParameter: SdsTypeParameter? = null, -): SdsTypeArgument { - return factory.createSdsTypeArgument().apply { - this.value = value - this.typeParameter = typeParameter - } -} - -/** - * Returns a new object of class [SdsTypeArgument] that points to a type parameter with the given name. - */ -@OptIn(ExperimentalSdsApi::class) -fun createSdsTypeArgument( - value: SdsAbstractTypeArgumentValue, - typeParameterName: String, -): SdsTypeArgument { - return createSdsTypeArgument( - value, - createSdsTypeParameter(typeParameterName), - ) -} - -/** - * Returns a new object of class [SdsTypeArgumentList]. - */ -fun createSdsTypeArgumentList(typeArguments: List): SdsTypeArgumentList { - return factory.createSdsTypeArgumentList().apply { - this.typeArguments += typeArguments - } -} - -/** - * Returns a new object of class [SdsTypeParameter]. - */ -@ExperimentalSdsApi -fun createSdsTypeParameter( - name: String, - annotationCalls: List = emptyList(), - variance: SdsVariance = SdsVariance.Invariant, - kind: SdsKind = SdsKind.NoKind, -): SdsTypeParameter { - return factory.createSdsTypeParameter().apply { - this.name = name - this.annotationCalls += annotationCalls - this.variance = variance.variance - this.kind = kind.kind - } -} - -/** - * Returns a new object of class [SdsTypeParameterList]. - */ -fun createSdsTypeParameterList(typeParameters: List): SdsTypeParameterList { - return factory.createSdsTypeParameterList().apply { - this.typeParameters += typeParameters - } -} - -/** - * Returns a new object of class [SdsTypeParameterConstraint]. - */ -@ExperimentalSdsApi -fun createSdsTypeParameterConstraint( - leftOperand: SdsTypeParameter, - operator: SdsTypeParameterConstraintOperator, - rightOperand: SdsAbstractType, -): SdsTypeParameterConstraint { - return factory.createSdsTypeParameterConstraint().apply { - this.leftOperand = leftOperand - this.operator = operator.operator - this.rightOperand = rightOperand - } -} - -/** - * Returns a new object of class [SdsTypeParameterConstraint] that points to a type parameter with the given name. - */ -@ExperimentalSdsApi -fun createSdsTypeParameterConstraint( - leftOperandName: String, - operator: SdsTypeParameterConstraintOperator, - rightOperand: SdsAbstractType, -): SdsTypeParameterConstraint { - return createSdsTypeParameterConstraint( - createSdsTypeParameter(leftOperandName), - operator, - rightOperand, - ) -} - -/** - * Returns a new object of class [SdsTypeProjection]. - */ -@ExperimentalSdsApi -fun createSdsTypeProjection(type: SdsAbstractType, variance: SdsVariance = SdsVariance.Invariant): SdsTypeProjection { - return factory.createSdsTypeProjection().apply { - this.type = type - this.variance = variance.variance - } -} - -/** - * Returns a new object of class [SdsUnionType]. - * - * @throws IllegalArgumentException If no type arguments are passed. - */ -fun createSdsUnionType(typeArguments: List): SdsUnionType { - if (typeArguments.isEmpty()) { - throw IllegalArgumentException("Must have at least one type argument.") - } - - return factory.createSdsUnionType().apply { - this.typeArgumentList = createSdsTypeArgumentList(typeArguments) - } -} - -/** - * Returns a new object of class [SdsWildcard]. - */ -fun createSdsWildcard(): SdsWildcard { - return factory.createSdsWildcard() -} - -/** - * Returns a new object of class [SdsYield]. - */ -fun createSdsYield(result: SdsResult): SdsYield { - return factory.createSdsYield().apply { - this.result = result - } -} - -/** - * Returns a new object of class [SdsYield] that points to a result with the given name. - */ -fun createSdsYield(resultName: String): SdsYield { - return createSdsYield(createSdsResult(resultName)) -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/OriginalFilePath.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/OriginalFilePath.kt deleted file mode 100644 index 659519688..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/OriginalFilePath.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.larsreimann.safeds.emf - -import org.eclipse.emf.common.notify.impl.AdapterImpl - -/** - * Stores the original file path. This is necessary since synthetic resources always have the `sdspipe` extension. - */ -class OriginalFilePath(val path: String) : AdapterImpl() diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/SimpleShortcuts.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/SimpleShortcuts.kt deleted file mode 100644 index a099e0421..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/SimpleShortcuts.kt +++ /dev/null @@ -1,513 +0,0 @@ -@file:Suppress("unused") - -/** - * Contains shortcuts that simplify working with the EMF model. Since most of these are very straightforward, unit tests - * are usually not required. - */ - -package com.larsreimann.safeds.emf - -import com.larsreimann.safeds.constant.hasSchemaKind -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractCallable -import com.larsreimann.safeds.safeDS.SdsAbstractClassMember -import com.larsreimann.safeds.safeDS.SdsAbstractCompilationUnitMember -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractLambda -import com.larsreimann.safeds.safeDS.SdsAbstractLocalVariable -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsAbstractProtocolTerm -import com.larsreimann.safeds.safeDS.SdsAbstractStatement -import com.larsreimann.safeds.safeDS.SdsAbstractType -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsAnnotationCallList -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsClassBody -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsConstraint -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsFunctionBody -import com.larsreimann.safeds.safeDS.SdsImport -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsProtocol -import com.larsreimann.safeds.safeDS.SdsProtocolBody -import com.larsreimann.safeds.safeDS.SdsProtocolComplement -import com.larsreimann.safeds.safeDS.SdsProtocolReference -import com.larsreimann.safeds.safeDS.SdsProtocolSubterm -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsSchemaType -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.safeDS.SdsUnionType -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.utils.uniqueOrNull -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.emf.ecore.resource.ResourceSet -import kotlin.contracts.ExperimentalContracts -import kotlin.contracts.contract - -/* ******************************************************************************************************************** - * Accessing descendants * - * ********************************************************************************************************************/ - -// EObject ----------------------------------------------------------------------------------------- - -fun EObject.resourceSetOrNull(): ResourceSet? { - return eResource()?.resourceSet -} - -// Resource ---------------------------------------------------------------------------------------- - -fun Resource.compilationUnitOrNull(): SdsCompilationUnit? { - return this.allContents - ?.asSequence() - ?.filterIsInstance() - ?.firstOrNull() -} - -// SdsAbstractCallable ----------------------------------------------------------------------------- - -fun SdsAbstractCallable?.parametersOrEmpty(): List { - return this?.parameterList?.parameters.orEmpty() -} - -/** - * Returns all calls that are actually executed immediately when this [SdsAbstractCallable] is called. - */ -fun SdsAbstractCallable.immediateCalls(): List { - return descendants { it is SdsAbstractLambda }.toList() -} - -// SdsAbstractDeclaration -------------------------------------------------------------------------- - -fun SdsAbstractDeclaration?.annotationCallsOrEmpty(): List { - return this?.annotationCallList?.annotationCalls ?: this?.annotationCalls.orEmpty() -} - -// SdsAnnotationCall ------------------------------------------------------------------------------- - -fun SdsAnnotationCall?.argumentsOrEmpty(): List { - return this?.argumentList?.arguments.orEmpty() -} - -// SdsAssignment ----------------------------------------------------------------------------------- - -fun SdsAssignment?.assigneesOrEmpty(): List { - return this?.assigneeList?.assignees - ?.filterIsInstance() - .orEmpty() -} - -fun SdsAssignment?.blockLambdaResultsOrEmpty(): List { - return this.assigneesOrEmpty().filterIsInstance() -} - -fun SdsAssignment?.placeholdersOrEmpty(): List { - return this.assigneesOrEmpty().filterIsInstance() -} - -fun SdsAssignment?.yieldsOrEmpty(): List { - return this.assigneesOrEmpty().filterIsInstance() -} - -// SdsBlockLambda ---------------------------------------------------------------------------------- - -fun SdsBlockLambda?.blockLambdaResultsOrEmpty(): List { - return this.statementsOrEmpty() - .filterIsInstance() - .flatMap { it.blockLambdaResultsOrEmpty() } -} - -fun SdsBlockLambda?.localVariablesOrEmpty(): List { - return this.parametersOrEmpty() + this.placeholdersOrEmpty() -} - -fun SdsBlockLambda?.placeholdersOrEmpty(): List { - return this.statementsOrEmpty() - .filterIsInstance() - .flatMap { it.placeholdersOrEmpty() } -} - -fun SdsBlockLambda?.statementsOrEmpty(): List { - return this?.body?.statements.orEmpty() -} - -// SdsCall ----------------------------------------------------------------------------------------- - -fun SdsCall?.argumentsOrEmpty(): List { - return this?.argumentList?.arguments.orEmpty() -} - -fun SdsCall?.typeArgumentsOrEmpty(): List { - return this?.typeArgumentList?.typeArguments.orEmpty() -} - -// SdsCallableType --------------------------------------------------------------------------------- - -fun SdsCallableType?.resultsOrEmpty(): List { - return this?.resultList?.results.orEmpty() -} - -// SdsClass ---------------------------------------------------------------------------------------- - -fun SdsClass?.typeParametersOrEmpty(): List { - return this?.typeParameterList?.typeParameters.orEmpty() -} - -fun SdsClass?.parentTypesOrEmpty(): List { - return this?.parentTypeList?.parentTypes.orEmpty() -} - -fun SdsClass?.objectsInBodyOrEmpty(): List { - return this?.body?.members.orEmpty() -} - -fun SdsClass?.classMembersOrEmpty(): List { - return this?.body?.members - ?.filterIsInstance() - .orEmpty() -} - -@ExperimentalSdsApi -fun SdsClass?.protocolsOrEmpty(): List { - return this?.body?.members - ?.filterIsInstance() - .orEmpty() -} - -@ExperimentalSdsApi -fun SdsClass.uniqueProtocolOrNull(): SdsProtocol? { - return this.protocolsOrEmpty().uniqueOrNull() -} - -// SdsCompilationUnit ------------------------------------------------------------------------------ - -fun SdsCompilationUnit?.compilationUnitMembersOrEmpty(): List { - return this?.members - ?.filterIsInstance() - .orEmpty() -} - -// SdsEnum ----------------------------------------------------------------------------------------- - -fun SdsEnum?.variantsOrEmpty(): List { - return this?.body?.variants.orEmpty() -} - -// SdsEnumVariant ---------------------------------------------------------------------------------- - -fun SdsEnumVariant?.typeParametersOrEmpty(): List { - return this?.typeParameterList?.typeParameters.orEmpty() -} - -// SdsFunction ------------------------------------------------------------------------------------- - -fun SdsFunction?.resultsOrEmpty(): List { - return this?.resultList?.results.orEmpty() -} - -fun SdsFunction?.typeParametersOrEmpty(): List { - return this?.typeParameterList?.typeParameters.orEmpty() -} - -@ExperimentalSdsApi -fun SdsFunction?.constraintStatementsOrEmpty(): List { - return this?.body?.statements - ?.filterIsInstance()?.first() - ?.body?.statements - .orEmpty() -} - -// SdsImport --------------------------------------------------------------------------------------- - -fun SdsImport.aliasNameOrNull(): String? { - return this.alias?.name -} - -fun SdsImport.importedNameOrNull(): String? { - return when (alias) { - null -> when { - isQualified() -> importedNamespace.split(".").last() - else -> null - } - else -> aliasNameOrNull() - } -} - -// SdsNamedType ------------------------------------------------------------------------------------ - -fun SdsNamedType?.typeArgumentsOrEmpty(): List { - return this?.typeArgumentList?.typeArguments.orEmpty() -} - -// SdsPredicate ------------------------------------------------------------------------------------ - -@ExperimentalSdsApi -fun SdsPredicate?.parametersOrEmpty(): List { - return this?.parameterList?.parameters.orEmpty() -} - -fun SdsPredicate?.typeParametersOrEmpty(): List { - return this?.typeParameterList?.typeParameters.orEmpty() -} - -@ExperimentalSdsApi -fun SdsPredicate?.resultsOrEmpty(): List { - return this?.resultList?.results.orEmpty() -} - -@ExperimentalSdsApi -fun SdsPredicate?.assignmentsOrEmpty(): List { - return this?.body?.statements?.filterIsInstance().orEmpty() -} - -// SdsProtocol ------------------------------------------------------------------------------------- - -@ExperimentalSdsApi -fun SdsProtocol?.subtermsOrEmpty(): List { - return this?.body.subtermsOrEmpty() -} - -@ExperimentalSdsApi -fun SdsProtocol.termOrNull(): SdsAbstractProtocolTerm? { - return this.body?.term -} - -// SdsProtocolBody --------------------------------------------------------------------------------- - -@ExperimentalSdsApi -fun SdsProtocolBody?.subtermsOrEmpty(): List { - return this?.subtermList?.subterms.orEmpty() -} - -// SdsProtocolComplement --------------------------------------------------------------------------- - -@ExperimentalSdsApi -fun SdsProtocolComplement?.referencesOrEmpty(): List { - return this?.referenceList?.references.orEmpty() -} - -// SdsUnionType ------------------------------------------------------------------------------------ - -fun SdsUnionType?.typeArgumentsOrEmpty(): List { - return this?.typeArgumentList?.typeArguments.orEmpty() -} - -// SdsPipeline ------------------------------------------------------------------------------------- - -fun SdsPipeline?.placeholdersOrEmpty(): List { - return this.statementsOrEmpty() - .filterIsInstance() - .flatMap { it.placeholdersOrEmpty() } -} - -fun SdsPipeline?.statementsOrEmpty(): List { - return this?.body?.statements.orEmpty() -} - -// SdsStep ----------------------------------------------------------------------------------------- - -fun SdsStep?.localVariablesOrEmpty(): List { - return this.parametersOrEmpty() + this.placeholdersOrEmpty() -} - -fun SdsStep?.placeholdersOrEmpty(): List { - return this.statementsOrEmpty() - .filterIsInstance() - .flatMap { it.placeholdersOrEmpty() } -} - -fun SdsStep?.resultsOrEmpty(): List { - return this?.resultList?.results.orEmpty() -} - -fun SdsStep?.statementsOrEmpty(): List { - return this?.body?.statements.orEmpty() -} - -fun SdsStep?.yieldsOrEmpty(): List { - return this.statementsOrEmpty() - .filterIsInstance() - .flatMap { it.yieldsOrEmpty() } -} - -/* ******************************************************************************************************************** - * Accessing ancestors * - * ********************************************************************************************************************/ - -fun EObject.containingBlockLambdaOrNull() = this.closestAncestorOrNull() -fun EObject.containingCallableOrNull() = this.closestAncestorOrNull() -fun EObject.containingClassOrNull() = this.closestAncestorOrNull() -fun EObject.containingCompilationUnitOrNull() = this.closestAncestorOrNull() -fun EObject.containingDeclarationOrNull() = this.closestAncestorOrNull() -fun EObject.containingEnumOrNull() = this.closestAncestorOrNull() -fun EObject.containingExpressionLambdaOrNull() = this.closestAncestorOrNull() -fun EObject.containingFunctionOrNull() = this.closestAncestorOrNull() -fun EObject.containingProtocolOrNull() = this.closestAncestorOrNull() -fun EObject.containingPipelineOrNull() = this.closestAncestorOrNull() -fun EObject.containingStepOrNull() = this.closestAncestorOrNull() - -fun SdsAnnotationCall.targetOrNull(): SdsAbstractDeclaration? { - return when (val declaration = this.containingDeclarationOrNull() ?: return null) { - is SdsAnnotationCallList -> declaration.containingDeclarationOrNull() - else -> declaration - } -} - -/* ******************************************************************************************************************** - * Accessing siblings * - * ********************************************************************************************************************/ - -fun SdsConstraint.typeParametersOrNull(): List? { - return when (val parent = this.eContainer()) { - is SdsClassBody -> { - val parentClass: EObject = parent.eContainer() - if (parentClass is SdsClass) { - parentClass.typeParametersOrEmpty() - } else { - null - } - } - is SdsEnumVariant -> return parent.typeParametersOrEmpty() - is SdsFunctionBody -> { - val parentFunction: EObject = parent.eContainer() - if (parentFunction is SdsFunction) { - parentFunction.typeParametersOrEmpty() - } else { - null - } - } - else -> null - } -} - -/* ******************************************************************************************************************** - * Checks * - * ********************************************************************************************************************/ - -// SdsAbstractClassMember -------------------------------------------------------------------------- - -/** - * Returns whether this [SdsAbstractClassMember] is truly contained in a class and static. - */ -fun SdsAbstractClassMember.isStatic(): Boolean { - return when { - !this.isClassMember() -> false - this is SdsClass || this is SdsEnum -> true - this is SdsAttribute && this.isStatic -> true - this is SdsFunction && this.isStatic -> true - else -> false - } -} - -// SdsAbstractDeclaration -------------------------------------------------------------------------- - -/** - * Returns whether this [SdsAbstractDeclaration] is contained in a class. - */ -fun SdsAbstractDeclaration.isClassMember(): Boolean { - return this is SdsAbstractClassMember && containingClassOrNull() != null -} - -/** - * Returns whether this [SdsAbstractDeclaration] is a global declaration. - */ -fun SdsAbstractDeclaration.isGlobal(): Boolean { - return !isClassMember() && this is SdsAbstractCompilationUnitMember -} - -/** - * Returns whether this [SdsAbstractDeclaration] is resolved, i.e. not a proxy. - */ -@OptIn(ExperimentalContracts::class) -fun SdsAbstractDeclaration?.isResolved(): Boolean { - contract { - returns(true) implies (this@isResolved != null) - } - - return (this != null) && !this.eIsProxy() -} - -// SdsArgument ------------------------------------------------------------------------------------- - -fun SdsArgument.isNamed() = parameter != null -fun SdsArgument.isPositional() = parameter == null - -// SdsEnum ----------------------------------------------------------------------------------------- - -/** - * Returns whether no [SdsEnumVariant]s of this [SdsEnum] have non-empty parameter list. Only those enums can be - * processed by the compiler, so non-constant [SdsEnum]s cannot be used as the type of parameters of annotations. - */ -fun SdsEnum.isConstant(): Boolean { - return variantsOrEmpty().all { it.parametersOrEmpty().isEmpty() } -} - -// SdsFunction ------------------------------------------------------------------------------------- - -fun SdsFunction.isMethod() = containingClassOrNull() != null - -// SdsImport --------------------------------------------------------------------------------------- - -fun SdsImport.isQualified() = !importedNamespace.endsWith(".*") -fun SdsImport.isWildcard() = importedNamespace.endsWith(".*") - -// SdsParameter ------------------------------------------------------------------------------------ - -fun SdsParameter.isRequired() = defaultValue == null && !isVariadic -fun SdsParameter.isOptional() = defaultValue != null - -// SdsPredicate ------------------------------------------------------------------------------------ - -@ExperimentalSdsApi -fun SdsPredicate?.isAbstract(): Boolean { - return this?.body == null -} - -// SdsSchemaType ------------------------------------------------------------------------------------ - -@OptIn(ExperimentalSdsApi::class) -fun SdsSchemaType.hasSchemaKind(): Boolean { - val declaration = this.declaration - return declaration is SdsTypeParameter && declaration.hasSchemaKind() -} - -// SdsTypeArgument --------------------------------------------------------------------------------- - -fun SdsTypeArgument.isNamed() = typeParameter != null -fun SdsTypeArgument.isPositional() = typeParameter == null - -/* ******************************************************************************************************************** - * Conversions * - * ********************************************************************************************************************/ - -// SdsAbstractDeclaration -------------------------------------------------------------------------- - -/** - * Returns this [SdsAbstractDeclaration] if it is resolved, otherwise `null`. - * - * @see isResolved - */ -fun T.asResolvedOrNull(): T? { - return when { - isResolved() -> this - else -> null - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/Traversal.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/Traversal.kt deleted file mode 100644 index 52f861e78..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/Traversal.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.larsreimann.safeds.emf - -import org.eclipse.emf.ecore.EObject - -/** - * Returns all descendants of this [EObject] with the given type. - * - * @param prune Whether the subtree with the current object as root should be pruned. - */ -inline fun EObject.descendants(crossinline prune: (EObject) -> Boolean = { false }) = sequence { - val iterator = this@descendants.eAllContents() - for (obj in iterator) { - if (prune(obj)) { - iterator.prune() - } else if (obj is T) { - yield(obj) - } - } -} - -/** - * Returns the closest ancestor of this [EObject] with the given type or `null` if none exists. This cannot return the - * receiver. - */ -inline fun EObject.closestAncestorOrNull(): T? { - var current: EObject? = this.eContainer() - while (current != null && current !is T) { - current = current.eContainer() - } - return current as T? -} - -/** - * Returns the closest ancestor of this [EObject] that matches the given [predicate] or `null` if none - * exists. This cannot return the receiver. - */ -inline fun EObject.closestAncestorOrNull(crossinline predicate: (EObject) -> Boolean = { true }): EObject? { - var current: EObject? = this.eContainer() - while (current != null && !predicate(current)) { - current = current.eContainer() - } - return current -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/formatting2/SafeDSFormatter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/formatting2/SafeDSFormatter.kt deleted file mode 100644 index 94ac3e2b2..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/formatting2/SafeDSFormatter.kt +++ /dev/null @@ -1,1281 +0,0 @@ -package com.larsreimann.safeds.formatting2 - -import com.larsreimann.safeds.emf.annotationCallsOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_ABSTRACT_DECLARATION__NAME -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_ANNOTATION_CALL__ANNOTATION -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_ARGUMENT__PARAMETER -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_IMPORT_ALIAS__NAME -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_IMPORT__IMPORTED_NAMESPACE -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_INFIX_OPERATION__OPERATOR -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_MEMBER_ACCESS__NULL_SAFE -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_NAMED_TYPE__DECLARATION -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_NAMED_TYPE__NULLABLE -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_PREFIX_OPERATION__OPERATOR -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_PROTOCOL_QUANTIFIED_TERM__QUANTIFIER -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_STEP__VISIBILITY -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_TYPE_ARGUMENT__TYPE_PARAMETER -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_TYPE_PARAMETER_CONSTRAINT__LEFT_OPERAND -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_TYPE_PARAMETER_CONSTRAINT__OPERATOR -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_TYPE_PARAMETER__KIND -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_TYPE_PARAMETER__VARIANCE -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_TYPE_PROJECTION__VARIANCE -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals.SDS_YIELD__RESULT -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractTemplateStringPart -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsArgumentList -import com.larsreimann.safeds.safeDS.SdsAssigneeList -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsBlock -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsClassBody -import com.larsreimann.safeds.safeDS.SdsColumn -import com.larsreimann.safeds.safeDS.SdsColumnList -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsConstraint -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumBody -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsFunctionBody -import com.larsreimann.safeds.safeDS.SdsImport -import com.larsreimann.safeds.safeDS.SdsImportAlias -import com.larsreimann.safeds.safeDS.SdsIndexedAccess -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsMemberType -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParameterList -import com.larsreimann.safeds.safeDS.SdsParentTypeList -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsParenthesizedType -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsPrefixOperation -import com.larsreimann.safeds.safeDS.SdsProtocol -import com.larsreimann.safeds.safeDS.SdsProtocolAlternative -import com.larsreimann.safeds.safeDS.SdsProtocolBody -import com.larsreimann.safeds.safeDS.SdsProtocolComplement -import com.larsreimann.safeds.safeDS.SdsProtocolParenthesizedTerm -import com.larsreimann.safeds.safeDS.SdsProtocolQuantifiedTerm -import com.larsreimann.safeds.safeDS.SdsProtocolReferenceList -import com.larsreimann.safeds.safeDS.SdsProtocolSequence -import com.larsreimann.safeds.safeDS.SdsProtocolSubterm -import com.larsreimann.safeds.safeDS.SdsProtocolSubtermList -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsResultList -import com.larsreimann.safeds.safeDS.SdsSchema -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTemplateString -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeArgumentList -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.safeDS.SdsTypeParameterConstraint -import com.larsreimann.safeds.safeDS.SdsTypeParameterList -import com.larsreimann.safeds.safeDS.SdsTypeProjection -import com.larsreimann.safeds.safeDS.SdsUnionType -import com.larsreimann.safeds.safeDS.SdsYield -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.EStructuralFeature -import org.eclipse.xtext.TerminalRule -import org.eclipse.xtext.formatting2.AbstractFormatter2 -import org.eclipse.xtext.formatting2.FormatterPreferenceKeys.indentation -import org.eclipse.xtext.formatting2.IFormattableDocument -import org.eclipse.xtext.formatting2.ITextReplacer -import org.eclipse.xtext.formatting2.ITextReplacerContext -import org.eclipse.xtext.formatting2.internal.AbstractTextReplacer -import org.eclipse.xtext.formatting2.internal.CommentReplacer -import org.eclipse.xtext.formatting2.internal.WhitespaceReplacer -import org.eclipse.xtext.formatting2.regionaccess.IComment -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion -import org.eclipse.xtext.formatting2.regionaccess.ITextReplacement -import org.eclipse.xtext.preferences.MapBasedPreferenceValues -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.xbase.lib.Procedures -import kotlin.reflect.KFunction1 -import org.eclipse.xtext.formatting2.IHiddenRegionFormatter as Format - -class SafeDSFormatter : AbstractFormatter2() { - - private val indent = Format::indent - private val noSpace = Format::noSpace - private val oneSpace = Format::oneSpace - private val newLine = Format::newLine - - @Suppress("SameParameterValue") - private fun newLines(n: Int): Procedures.Procedure1 { - return Procedures.Procedure1 { it.setNewLines(n) } - } - - /** - * We follow the rule here that an object never formats its preceding or following region. This is left to the - * parent. - */ - override fun format(obj: Any?, doc: IFormattableDocument) { - if (obj == null) { - return - } - - when (obj) { - is XtextResource -> { - useSpacesForIndentation() - _format(obj, doc) - } - - is SdsCompilationUnit -> { - // Feature "annotations" - obj.annotationCallsOrEmpty().forEach { - doc.format(it) - - if (obj.annotationCallsOrEmpty().last() == it) { - doc.append(it, newLines(2)) - } else { - doc.append(it, newLine) - } - } - - // Keyword "package" - doc.formatKeyword(obj, "package", noSpace, oneSpace) - - // Feature "name" - val name = obj.regionForFeature(SDS_ABSTRACT_DECLARATION__NAME) - if (name != null) { - doc.addReplacer(WhitespaceCollapser(doc, name)) - - if (obj.imports.isNotEmpty() || obj.members.isNotEmpty()) { - doc.append(name, newLines(2)) - } else { - doc.append(name, noSpace) - } - } - - // Feature "imports" - obj.imports.forEach { - doc.format(it) - - if (obj.imports.last() == it && obj.members.isNotEmpty()) { - doc.append(it, newLines(2)) - } else if (obj.imports.last() != it) { - doc.append(it, newLine) - } else { - doc.append(it, noSpace) - } - } - - // Feature "members" - obj.members.forEach { - doc.format(it) - - if (obj.members.last() != it) { - doc.append(it, newLines(2)) - } else { - doc.append(it, noSpace) - } - } - - doc.append(obj, newLine) - } - - /********************************************************************************************************** - * Declarations - **********************************************************************************************************/ - - is SdsImport -> { - // Keyword "import" - doc.formatKeyword(obj, "import", noSpace, oneSpace) - - // Feature "importedNamespace" - val importedNamespace = obj.regionForFeature(SDS_IMPORT__IMPORTED_NAMESPACE) - if (importedNamespace != null) { - doc.addReplacer(WhitespaceCollapser(doc, importedNamespace)) - } - - // EObject "aliasDeclaration" - doc.formatObject(obj.alias, oneSpace, noSpace) - } - is SdsImportAlias -> { - // Keyword "as" - doc.formatKeyword(obj, "as", null, oneSpace) - - // Feature "alias" - doc.formatFeature(obj, SDS_IMPORT_ALIAS__NAME, null, noSpace) - } - is SdsAnnotation -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "annotation" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatKeyword(obj, "annotation", null, oneSpace) - } else { - doc.formatKeyword(obj, "annotation", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, null) - - // EObject "parameterList" - doc.formatObject(obj.parameterList, noSpace, null) - - // EObject "constraint" - doc.formatObject(obj.constraint, oneSpace, null) - } - is SdsAnnotationCall -> { - // Keyword "@" - doc.formatKeyword(obj, "@", null, noSpace) - - // Feature "annotation" - doc.formatFeature(obj, SDS_ANNOTATION_CALL__ANNOTATION, noSpace, null) - - // EObject "argumentList" - doc.formatObject(obj.argumentList, noSpace, null) - } - is SdsAttribute -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "static" - if (obj.annotationCallsOrEmpty().isNotEmpty()) { - doc.formatKeyword(obj, "static", oneSpace, null) - } - - // Keyword "attr" - if (obj.annotationCallsOrEmpty().isEmpty() && !obj.isStatic) { - doc.formatKeyword(obj, "attr", null, oneSpace) - } else { - doc.formatKeyword(obj, "attr", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, noSpace) - - // Keyword ":" - doc.formatKeyword(obj, ":", noSpace, oneSpace) - - // EObject "type" - doc.formatObject(obj.type, oneSpace, null) - } - is SdsClass -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "class" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatKeyword(obj, "class", null, oneSpace) - } else { - doc.formatKeyword(obj, "class", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, null) - - // EObject "typeParameterList" - doc.formatObject(obj.typeParameterList, noSpace, null) - - // EObject "constructor" - doc.formatObject(obj.parameterList, noSpace, null) - - // EObject "parentTypeList" - doc.formatObject(obj.parentTypeList, oneSpace, null) - - // EObject "body" - doc.formatObject(obj.body, oneSpace, null) - } - is SdsParentTypeList -> { - // Keyword "sub" - doc.formatKeyword(obj, "sub", null, oneSpace) - - // Feature "parentTypes" - obj.parentTypes.forEach { - doc.formatObject(it) - } - - // Keywords "," - doc.formatCommas(obj) - } - is SdsClassBody -> { - // Keyword "{" - val openingBrace = obj.regionForKeyword("{") - if (obj.members.isEmpty()) { - doc.append(openingBrace, noSpace) - } else { - doc.append(openingBrace, newLine) - } - - // Feature "members" - obj.members.forEach { - doc.format(it) - if (obj.members.last() == it) { - doc.append(it, newLine) - } else { - doc.append(it, newLines(2)) - } - } - - // Keyword "}" - val closingBrace = obj.regionForKeyword("}") - doc.prepend(closingBrace, noSpace) - - doc.interior(openingBrace, closingBrace, indent) - } - is SdsEnum -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "enum" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatKeyword(obj, "enum", null, oneSpace) - } else { - doc.formatKeyword(obj, "enum", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, null) - - // EObject "body" - doc.formatObject(obj.body, oneSpace, null) - } - is SdsEnumBody -> { - // Keyword "{" - val openingBrace = obj.regionForKeyword("{") - if (obj.variants.isEmpty()) { - doc.append(openingBrace, noSpace) - } else { - doc.append(openingBrace, newLine) - } - - // Feature "variants" - obj.variants.forEach { - doc.format(it) - if (obj.variants.first() != it) { - doc.prepend(it, newLines(2)) - } - } - - // Keywords "," - val commas = textRegionExtensions.allRegionsFor(obj).keywords(",") - commas.forEach { - doc.prepend(it, noSpace) - } - - // Keyword "}" - val closingBrace = obj.regionForKeyword("}") - if (obj.variants.isEmpty()) { - doc.prepend(closingBrace, noSpace) - } else { - doc.prepend(closingBrace, newLine) - } - - doc.interior(openingBrace, closingBrace, indent) - } - is SdsEnumVariant -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Feature "name" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME) - } else { - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, null) - } - - // EObject "typeParameterList" - doc.formatObject(obj.typeParameterList, noSpace, null) - - // EObject "parameterList" - doc.formatObject(obj.parameterList, noSpace, null) - - // EObject "constraint" - doc.formatObject(obj.constraint, oneSpace, null) - } - is SdsFunction -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "static" - if (obj.annotationCallsOrEmpty().isNotEmpty()) { - doc.formatKeyword(obj, "static", oneSpace, null) - } - - // Keyword "fun" - if (obj.annotationCallsOrEmpty().isEmpty() && !obj.isStatic) { - doc.formatKeyword(obj, "fun", null, oneSpace) - } else { - doc.formatKeyword(obj, "fun", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, null) - - // EObject "typeParameterList" - doc.formatObject(obj.typeParameterList, noSpace, null) - - // EObject "parameterList" - doc.formatObject(obj.parameterList, noSpace, null) - - // EObject "resultList" - doc.formatObject(obj.resultList, oneSpace, null) - - // EObject "body" - doc.formatObject(obj.body, oneSpace, null) - } - is SdsFunctionBody -> { - // Keyword "{" - val openingBrace = obj.regionForKeyword("{") - if (obj.statements.isEmpty()) { - doc.append(openingBrace, noSpace) - } else { - doc.append(openingBrace, newLine) - } - - // Feature "statements" - obj.statements.forEach { - doc.format(it) - if (obj.statements.last() == it) { - doc.append(it, newLine) - } else { - doc.append(it, newLines(2)) - } - } - - // Keyword "}" - val closingBrace = obj.regionForKeyword("}") - doc.prepend(closingBrace, noSpace) - - doc.interior(openingBrace, closingBrace, indent) - } - is SdsPipeline -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "pipeline" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatKeyword(obj, "pipeline", noSpace, oneSpace) - } else { - doc.formatKeyword(obj, "pipeline", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, null, oneSpace) - - // EObject "body" - doc.formatObject(obj.body) - } - is SdsStep -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Feature "visibility" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatFeature(obj, SDS_STEP__VISIBILITY, noSpace, null) - } - - // Keyword "step" - if (obj.annotationCallsOrEmpty().isEmpty() && obj.visibility == null) { - doc.formatKeyword(obj, "step", noSpace, oneSpace) - } else { - doc.formatKeyword(obj, "step", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, null, noSpace) - - // EObject "parameterList" - doc.formatObject(obj.parameterList) - - // EObject "resultList" - doc.formatObject(obj.resultList) - - // EObject "body" - doc.formatObject(obj.body, oneSpace, null) - } - is SdsArgumentList -> { - // Keyword "(" - doc.formatKeyword(obj, "(", null, noSpace) - - // Feature "arguments" - obj.arguments.forEach { - doc.formatObject(it) - } - - // Keywords "," - doc.formatCommas(obj) - - // Keyword ")" - doc.formatKeyword(obj, ")", noSpace, null) - } - is SdsArgument -> { - // Feature "parameter" - doc.formatFeature(obj, SDS_ARGUMENT__PARAMETER) - - // Keyword "=" - doc.formatKeyword(obj, "=", oneSpace, oneSpace) - - // EObject "value" - doc.formatObject(obj.value) - } - is SdsParameterList -> { - // Keyword "(" - doc.formatKeyword(obj, "(", null, noSpace) - - // Feature "parameters" - obj.parameters.forEach { - doc.formatObject(it) - } - - // Keywords "," - doc.formatCommas(obj) - - // Keyword ")" - doc.formatKeyword(obj, ")", noSpace, null) - } - is SdsParameter -> { - // Features "annotations" - doc.formatAnnotations(obj, inlineAnnotations = true) - - // Keyword "vararg" - if (obj.annotationCallsOrEmpty().isNotEmpty()) { - doc.formatKeyword(obj, "vararg", oneSpace, null) - } - - // Feature "name" - val name = obj.regionForFeature(SDS_ABSTRACT_DECLARATION__NAME) - if (obj.annotationCallsOrEmpty().isNotEmpty() || obj.isVariadic) { - doc.prepend(name, oneSpace) - } - - // Keyword ":" - doc.formatKeyword(obj, ":", noSpace, oneSpace) - - // EObject "type" - doc.formatObject(obj.type) - - // Keyword "=" - doc.formatKeyword(obj, "=", oneSpace, oneSpace) - - // EObject "defaultValue" - doc.formatObject(obj.defaultValue) - } - is SdsResultList -> { - // Keyword "->" - doc.formatKeyword(obj, "->", oneSpace, oneSpace) - - // Keyword "(" - doc.formatKeyword(obj, "(", null, noSpace) - - // Feature "results" - obj.results.forEach { - doc.formatObject(it) - } - - // Keywords "," - doc.formatCommas(obj) - - // Keyword ")" - doc.formatKeyword(obj, ")", noSpace, null) - } - is SdsResult -> { - // Features "annotations" - doc.formatAnnotations(obj, inlineAnnotations = true) - - // Feature "name" - val name = obj.regionForFeature(SDS_ABSTRACT_DECLARATION__NAME) - if (obj.annotationCallsOrEmpty().isNotEmpty()) { - doc.prepend(name, oneSpace) - } - - // Keyword ":" - doc.formatKeyword(obj, ":", noSpace, oneSpace) - - // EObject "type" - doc.formatObject(obj.type) - } - - /********************************************************************************************************** - * Predicate - **********************************************************************************************************/ - - is SdsPredicate -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "predicate" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatKeyword(obj, "predicate", noSpace, oneSpace) - } else { - doc.formatKeyword(obj, "predicate", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, null, noSpace) - - // EObject "typeParameterList" - doc.formatObject(obj.typeParameterList, noSpace, null) - - // EObject "parameterList" - doc.formatObject(obj.parameterList, noSpace, null) - - // EObject "resultList" - doc.formatObject(obj.resultList, oneSpace, null) - - // EObject "body" - doc.formatObject(obj.body, oneSpace, null) - } - - /********************************************************************************************************** - * Protocols - **********************************************************************************************************/ - - is SdsProtocol -> { - // Keyword "protocol" - doc.formatKeyword(obj, "protocol", null, oneSpace) - - // EObject "body" - doc.formatObject(obj.body) - } - is SdsProtocolBody -> { - // Keyword "{" - val openingBrace = obj.regionForKeyword("{") - if (obj.subtermList == null && obj.term == null) { - doc.append(openingBrace, noSpace) - } else { - doc.append(openingBrace, newLine) - } - - // EObject "subtermList" - if (obj.term == null) { - doc.formatObject(obj.subtermList, null, newLine) - } else { - doc.format(obj.subtermList) - doc.append(obj.subtermList, newLines(2)) - } - - // EObject "term" - doc.formatObject(obj.term, null, newLine) - - // Keyword "}" - val closingBrace = obj.regionForKeyword("}") - doc.prepend(closingBrace, noSpace) - - doc.interior(openingBrace, closingBrace, indent) - } - is SdsProtocolSubtermList -> { - obj.subterms.forEach { - if (it === obj.subterms.last()) { - doc.formatObject(it, null, null) - } else { - doc.formatObject(it, null, newLine) - } - } - } - is SdsProtocolSubterm -> { - // Keyword "subterm" - doc.formatKeyword(obj, "subterm", null, oneSpace) - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, oneSpace) - - // Keyword "=" - doc.formatKeyword(obj, "=", oneSpace, oneSpace) - - // EObject "term" - doc.formatObject(obj.term, oneSpace, noSpace) - - // Keyword ";" - doc.formatKeyword(obj, ";", noSpace, null) - } - is SdsProtocolAlternative -> { - // Keywords '|' - val pipes = textRegionExtensions.allRegionsFor(obj).keywords("|") - pipes.forEach { - doc.prepend(it, oneSpace) - doc.append(it, oneSpace) - } - - // EObject "terms" - obj.terms.forEach { - doc.formatObject(it) - } - } - is SdsProtocolComplement -> { - // Keyword "[" - doc.formatKeyword(obj, "[", null, noSpace) - - // Keyword "^" - doc.formatKeyword(obj, "^", noSpace, null) - - // EObject "referenceList" - doc.formatObject(obj.referenceList, oneSpace, null) - - // Keyword "]" - doc.formatKeyword(obj, "]", noSpace, null) - } - is SdsProtocolReferenceList -> { - // EObject "terms" - obj.references.forEach { - if (it == obj.references.last()) { - doc.formatObject(it) - } else { - doc.formatObject(it, null, oneSpace) - } - } - } - is SdsProtocolParenthesizedTerm -> { - // Keyword "(" - doc.formatKeyword(obj, "(", null, noSpace) - - // EObject "term" - doc.formatObject(obj.term, noSpace, noSpace) - - // Keyword ")" - doc.formatKeyword(obj, ")", noSpace, null) - } - is SdsProtocolQuantifiedTerm -> { - // EObject "term" - doc.formatObject(obj.term) - - // Feature "quantifier" - doc.formatFeature(obj, SDS_PROTOCOL_QUANTIFIED_TERM__QUANTIFIER, noSpace, null) - } - is SdsProtocolSequence -> { - // EObject "terms" - obj.terms.forEach { - if (it == obj.terms.last()) { - doc.formatObject(it) - } else { - doc.formatObject(it, null, oneSpace) - } - } - } - - /********************************************************************************************************** - * Schema - **********************************************************************************************************/ - - is SdsSchema -> { - // Features "annotations" - doc.formatAnnotations(obj) - - // Keyword "schema" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatKeyword(obj, "schema", noSpace, oneSpace) - } else { - doc.formatKeyword(obj, "schema", oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, null, oneSpace) - - // EObject "columnList" - doc.formatObject(obj.columnList, oneSpace, null) - } - is SdsColumnList -> { - // Keyword "{" - val openingBrace = obj.regionForKeyword("{") - if (obj.columns.isEmpty()) { - doc.append(openingBrace, noSpace) - } else { - doc.append(openingBrace, newLine) - } - - // Feature "columns" - obj.columns.forEach { - doc.formatObject(it, newLine, noSpace) - } - - // Keywords "," - doc.formatKeyword(obj, ",", noSpace, newLine) - - // Keyword "}" - val closingBrace = obj.regionForKeyword("}") - if (obj.columns.isEmpty()) { - doc.prepend(closingBrace, noSpace) - } else { - doc.prepend(closingBrace, newLine) - } - doc.interior(openingBrace, closingBrace, indent) - } - is SdsColumn -> { - // EObject "columnName" - doc.formatObject(obj.columnName, null, oneSpace) - - // Keyword ":" - doc.formatKeyword(obj, ":", oneSpace, oneSpace) - - // EObject "columnType" - doc.formatObject(obj.columnType) - } - - /********************************************************************************************************** - * Statements - **********************************************************************************************************/ - - is SdsBlock -> { - val internalPadding: KFunction1 - if (obj.statements.isEmpty()) { - internalPadding = noSpace - } else { - internalPadding = newLine - } - - val statementsSuffix: KFunction1 - if (obj.eContainer() is SdsConstraint || obj.eContainer() is SdsPredicate) { - statementsSuffix = noSpace - } else { - statementsSuffix = newLine - } - - // Keyword "{" - val openingBrace = obj.regionForKeyword("{") - doc.append(openingBrace, internalPadding) - - // Feature "statements" - obj.statements.forEach { - doc.formatObject(it, null, statementsSuffix) - } - - // Keywords "," (for SdsConstraint or SdsPredicate) - if (statementsSuffix == noSpace) { - doc.formatKeyword(obj, ",", noSpace, newLine) - } - - // Keyword "}" - val closingBrace = obj.regionForKeyword("}") - doc.prepend(closingBrace, internalPadding) - - doc.interior(openingBrace, closingBrace, indent) - } - is SdsAssignment -> { - // EObject "assigneeList" - doc.formatObject(obj.assigneeList, null, oneSpace) - - // Keyword "=" - doc.formatKeyword(obj, "=", oneSpace, oneSpace) - - // EObject "expression" - doc.formatObject(obj.expression) - - // Keyword ";" - doc.formatKeyword(obj, ";", noSpace, null) - } - is SdsAssigneeList -> { - // Feature "assignees" - obj.assignees.forEach { - doc.formatObject(it) - } - - // Keywords "," - doc.formatCommas(obj) - } - is SdsBlockLambdaResult -> { - // Keyword "yield" - doc.formatKeyword(obj, "yield", null, oneSpace) - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, null) - } - is SdsPlaceholder -> { - // Keyword "val" - doc.formatKeyword(obj, "val", null, oneSpace) - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME, oneSpace, null) - } - is SdsYield -> { - // Keyword "yield" - doc.formatKeyword(obj, "yield", null, oneSpace) - - // Feature "result" - doc.formatFeature(obj, SDS_YIELD__RESULT) - } - is SdsExpressionStatement -> { - // EObject "expression" - doc.formatObject(obj.expression) - - // Keyword ";" - doc.formatKeyword(obj, ";", noSpace, null) - } - - /********************************************************************************************************** - * Expressions - **********************************************************************************************************/ - - is SdsBlockLambda -> { - // EObject "parameterList" - doc.formatObject(obj.parameterList, null, oneSpace) - - // EObject "body" - doc.formatObject(obj.body, oneSpace, null) - } - is SdsCall -> { - // EObject "receiver" - doc.formatObject(obj.receiver, null, noSpace) - - // EObject "typeArgumentList" - doc.formatObject(obj.typeArgumentList, null, noSpace) - - // EObject "argumentList" - doc.formatObject(obj.argumentList) - } - is SdsExpressionLambda -> { - // EObject "parameterList" - doc.formatObject(obj.parameterList, null, oneSpace) - - // Keyword "->" - doc.formatKeyword(obj, "->", oneSpace, oneSpace) - - // EObject "result" - doc.formatObject(obj.result, oneSpace, null) - } - is SdsIndexedAccess -> { - // EObject "receiver" - doc.formatObject(obj.receiver, null, noSpace) - - // Keyword "[" - doc.formatKeyword(obj, "[", noSpace, noSpace) - - // EObject "index" - doc.formatObject(obj.index, noSpace, noSpace) - - // Keyword "]" - doc.formatKeyword(obj, "]", noSpace, null) - } - is SdsInfixOperation -> { - // EObject "leftOperand" - doc.formatObject(obj.leftOperand, null, oneSpace) - - // Feature "operator" - doc.formatFeature(obj, SDS_INFIX_OPERATION__OPERATOR, oneSpace, oneSpace) - - // EObject "rightOperand" - doc.formatObject(obj.rightOperand, oneSpace, null) - } - is SdsMemberAccess -> { - // EObject "receiver" - doc.formatObject(obj.receiver, null, noSpace) - - // Feature "nullable" - doc.formatFeature(obj, SDS_MEMBER_ACCESS__NULL_SAFE, noSpace, noSpace) - - // Keyword "." - doc.formatKeyword(obj, ".", noSpace, noSpace) - - // EObject "member" - doc.formatObject(obj.member, noSpace, null) - } - is SdsParenthesizedExpression -> { - // Keyword "(" - doc.formatKeyword(obj, "(", null, noSpace) - - // EObject "expression" - doc.formatObject(obj.expression, noSpace, noSpace) - - // Keyword ")" - doc.formatKeyword(obj, ")", noSpace, null) - } - is SdsPrefixOperation -> { - // Feature "operator" - doc.formatFeature( - obj, - SDS_PREFIX_OPERATION__OPERATOR, - prepend = null, - append = if (obj.operator == "not") oneSpace else noSpace, - ) - - // EObject "operand" - doc.formatObject(obj.operand) - } - is SdsTemplateString -> { - // Feature expressions - obj.expressions.forEach { - if (it !is SdsAbstractTemplateStringPart) { - doc.formatObject(it, oneSpace, oneSpace) - } - } - } - - /********************************************************************************************************** - * Types - **********************************************************************************************************/ - - is SdsCallableType -> { - // Keyword "callable" - doc.formatKeyword(obj, "callable", null, oneSpace) - - // EObject "parameterList" - doc.formatObject(obj.parameterList, oneSpace, oneSpace) - - // EObject "resultList" - doc.formatObject(obj.resultList, oneSpace, null) - } - is SdsMemberType -> { - // EObject "receiver" - doc.formatObject(obj.receiver, null, noSpace) - - // Keyword "." - doc.formatKeyword(obj, ".", noSpace, noSpace) - - // EObject "member" - doc.formatObject(obj.member, noSpace, null) - } - is SdsNamedType -> { - // Feature "declaration" - doc.formatFeature(obj, SDS_NAMED_TYPE__DECLARATION) - - // EObject "typeArgumentList" - doc.formatObject(obj.typeArgumentList, noSpace, noSpace) - - // Feature "nullable" - doc.formatFeature(obj, SDS_NAMED_TYPE__NULLABLE, noSpace, null) - } - is SdsParenthesizedType -> { - // Keyword "(" - doc.formatKeyword(obj, "(", null, noSpace) - - // EObject "type" - doc.formatObject(obj.type, noSpace, noSpace) - - // Keyword ")" - doc.formatKeyword(obj, ")", noSpace, null) - } - is SdsUnionType -> { - // Keyword "union" - doc.formatKeyword(obj, "union", null, noSpace) - - // EObject "typeArgumentList" - doc.formatObject(obj.typeArgumentList, noSpace, null) - } - is SdsTypeArgumentList -> { - // Keyword "<" - doc.formatKeyword(obj, "<", null, noSpace) - - // Feature "typeArguments" - obj.typeArguments.forEach { - doc.formatObject(it) - } - - // Keywords "," - doc.formatCommas(obj) - - // Keyword ">" - doc.formatKeyword(obj, ">", noSpace, null) - } - is SdsTypeArgument -> { - // Feature "typeParameter" - doc.formatFeature(obj, SDS_TYPE_ARGUMENT__TYPE_PARAMETER) - - // Keyword "=" - doc.formatKeyword(obj, "=", oneSpace, oneSpace) - - // EObject "value" - doc.formatObject(obj.value) - } - is SdsTypeProjection -> { - // Feature "variance" - doc.formatFeature(obj, SDS_TYPE_PROJECTION__VARIANCE, null, oneSpace) - - // EObject "type" - doc.formatObject(obj.type) - } - is SdsTypeParameterList -> { - // Keyword "<" - doc.formatKeyword(obj, "<", null, noSpace) - - // Feature "typeParameters" - obj.typeParameters.forEach { - doc.formatObject(it) - } - - // Keywords "," - doc.formatCommas(obj) - - // Keyword ">" - doc.formatKeyword(obj, ">", noSpace, null) - } - is SdsTypeParameter -> { - // Features "annotations" - doc.formatAnnotations(obj, inlineAnnotations = true) - - // Feature "variance" - if (obj.annotationCallsOrEmpty().isEmpty()) { - doc.formatFeature(obj, SDS_TYPE_PARAMETER__VARIANCE, null, oneSpace) - } else { - doc.formatFeature(obj, SDS_TYPE_PARAMETER__VARIANCE, oneSpace, oneSpace) - } - - // Feature "name" - doc.formatFeature(obj, SDS_ABSTRACT_DECLARATION__NAME) - - // Feature "kind" - doc.formatKeyword(obj, "::", oneSpace, oneSpace) - doc.formatFeature(obj, SDS_TYPE_PARAMETER__KIND) - } - is SdsConstraint -> { - // Keyword "constraint" - doc.formatKeyword(obj, "constraint", null, oneSpace) - - // EObject "body" - doc.formatObject(obj.body) - } - is SdsTypeParameterConstraint -> { - // Feature "leftOperand" - doc.formatFeature(obj, SDS_TYPE_PARAMETER_CONSTRAINT__LEFT_OPERAND, null, oneSpace) - - // Feature "operator" - doc.formatFeature(obj, SDS_TYPE_PARAMETER_CONSTRAINT__OPERATOR, oneSpace, oneSpace) - - // EObject "rightOperand" - doc.formatObject(obj.rightOperand, oneSpace, null) - } - } - } - - /** - * Formats comments, including test markers. Without this override formatting a file with test markers throws an - * exception in VS Code. - */ - override fun createCommentReplacer(comment: IComment): ITextReplacer? { - val grammarElement = comment.grammarElement - if (grammarElement is TerminalRule && grammarElement.name == "TEST_MARKER") { - return TestMarkerReplacer(comment) - } - - return super.createCommentReplacer(comment) - } - - /****************************************************************************************************************** - * Helpers - ******************************************************************************************************************/ - - private fun useSpacesForIndentation() { - val newPreferences = mutableMapOf() - newPreferences[indentation.id] = " " - request.preferences = MapBasedPreferenceValues(preferences, newPreferences) - } - - private fun EObject.regionForFeature(feature: EStructuralFeature): ISemanticRegion? { - return textRegionExtensions.regionFor(this).feature(feature) - } - - private fun EObject.regionForKeyword(keyword: String): ISemanticRegion? { - return textRegionExtensions.regionFor(this).keyword(keyword) - } - - private fun IFormattableDocument.formatObject( - obj: EObject?, - prepend: KFunction1? = null, - append: KFunction1? = null, - ) { - if (obj != null) { - if (prepend != null) { - this.prepend(obj, prepend) - } - this.format(obj) - if (append != null) { - this.append(obj, append) - } - } - } - - private fun IFormattableDocument.formatFeature( - obj: EObject?, - feature: EStructuralFeature, - prepend: KFunction1? = null, - append: KFunction1? = null, - ) { - if (obj == null) { - return - } - - val featureRegion = obj.regionForFeature(feature) - if (featureRegion != null) { - if (prepend != null) { - this.prepend(featureRegion, prepend) - } - if (append != null) { - this.append(featureRegion, append) - } - } - } - - private fun IFormattableDocument.formatKeyword( - obj: EObject?, - keyword: String, - prepend: KFunction1? = null, - append: KFunction1? = null, - ) { - if (obj == null) { - return - } - - val keywordRegion = obj.regionForKeyword(keyword) - if (keywordRegion != null) { - if (prepend != null) { - this.prepend(keywordRegion, prepend) - } - if (append != null) { - this.append(keywordRegion, append) - } - } - } - - private fun IFormattableDocument.formatAnnotations( - obj: SdsAbstractDeclaration, - inlineAnnotations: Boolean = false, - ) { - // Feature "annotations" - obj.annotationCallsOrEmpty().forEach { - format(it) - - if (inlineAnnotations) { - append(it, oneSpace) - } else { - append(it, newLine) - } - } - } - - private fun IFormattableDocument.formatCommas(obj: EObject) { - val commas = textRegionExtensions.allRegionsFor(obj).keywords(",") - commas.forEach { - prepend(it, noSpace) - append(it, oneSpace) - } - } -} - -class TestMarkerReplacer(comment: IComment) : CommentReplacer(comment) { - override fun createReplacements(context: ITextReplacerContext): ITextReplacerContext { - return context - } - - override fun configureWhitespace(leading: WhitespaceReplacer, trailing: WhitespaceReplacer) { - if (comment.text == "»") { - trailing.formatting.space = "" - } else if (comment.text == "«") { - leading.formatting.space = "" - } - } -} - -class WhitespaceCollapser(doc: IFormattableDocument, name: ISemanticRegion?) : AbstractTextReplacer(doc, name) { - override fun createReplacements(context: ITextReplacerContext): ITextReplacerContext { - context.addReplacement(collapseWhitespace()) - return context - } - - private fun collapseWhitespace(): ITextReplacement { - return region.replaceWith(region.text.replace(Regex("\\s+"), "")) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/GeneratorUtils.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/GeneratorUtils.kt deleted file mode 100644 index 806ac8be2..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/GeneratorUtils.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.larsreimann.safeds.generator - -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.compilationUnitOrNull -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.stdlibAccess.pythonModuleOrNull -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.resource.Resource - -/** - * Returns the base file name of the resource, i.e. the last segment of its [URI] with any Safe-DS extension removed, - * or `null` if the resource has no [URI]. - */ -fun Resource.baseFileNameOrNull(): String? { - return uri - ?.lastSegment() - ?.removeSuffix(".${SdsFileExtension.Pipeline}") - ?.removeSuffix(".${SdsFileExtension.Schema}") - ?.removeSuffix(".${SdsFileExtension.Stub}") - ?.removeSuffix(".${SdsFileExtension.Test}") - ?.replace(Regex("%2520"), "_") // Twice URL encoded space - ?.replace(Regex("[ .-]"), "_") - ?.replace(Regex("\\W"), "") -} - -/** - * Returns the prefix of the path of all generated files, or `null` if this [Resource] does not provide enough - * information to deduce this prefix. This can be caused if either - * - the [Resource] contains no [SdsCompilationUnit], - * - the [SdsCompilationUnit] has no package, - * - the [Resource] has no [URI]. - */ -fun Resource.baseGeneratedFilePathOrNull(): String? { - val compilationUnit = compilationUnitOrNull() ?: return null - - val compilationUnitPythonName = compilationUnit.pythonModuleOrNull() ?: compilationUnit.name - val packagePart = compilationUnitPythonName - ?.replace(".", "/") - ?: return null - - val filePart = baseFileNameOrNull() ?: return null - - return "$packagePart/gen_$filePart" -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/Main.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/Main.kt deleted file mode 100644 index 501417eef..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/Main.kt +++ /dev/null @@ -1,72 +0,0 @@ -package com.larsreimann.safeds.generator - -import com.google.inject.Inject -import com.google.inject.Provider -import com.larsreimann.safeds.SafeDSStandaloneSetup -import com.larsreimann.safeds.stdlibAccess.loadStdlib -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.xtext.diagnostics.Severity -import org.eclipse.xtext.generator.GeneratorContext -import org.eclipse.xtext.generator.GeneratorDelegate -import org.eclipse.xtext.generator.JavaIoFileSystemAccess -import org.eclipse.xtext.util.CancelIndicator -import org.eclipse.xtext.validation.CheckMode -import org.eclipse.xtext.validation.IResourceValidator -import kotlin.system.exitProcess - -@Suppress("unused") -class Main @Inject constructor( - private val fileAccess: JavaIoFileSystemAccess, - private val generator: GeneratorDelegate, - private val resourceSetProvider: Provider, - private val validator: IResourceValidator, -) { - - fun runCodeGenerator(files: List) { - // Load the resources - val resourceSet = resourceSetProvider.get() - files.forEach { - resourceSet.getResource(URI.createFileURI(it), true) - ?: throw IllegalArgumentException("Could not create resource for $it.") - } - - // Load the library - resourceSet.loadStdlib() - - // Configure the generator - fileAccess.setOutputPath("src-gen/") - val context = GeneratorContext().apply { - cancelIndicator = CancelIndicator.NullImpl - } - - // Generate all resources - resourceSet.resources.forEach { resource -> - - // Validate the resource - val issues = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl) - if (issues.any { it.severity == Severity.ERROR }) { - issues.forEach { println(it) } - - System.err.println("Aborting: A resource has errors.") - exitProcess(20) - } - - // Start the generator - generator.generate(resource, fileAccess, context) - } - - println("Code generation finished.") - } -} - -fun main(args: Array) { - if (args.isEmpty()) { - System.err.println("Aborting: No path to EMF resource provided.") - exitProcess(10) - } - - val injector = SafeDSStandaloneSetup().createInjectorAndDoEMFRegistration() - val main = injector.getInstance(Main::class.java) - main.runCodeGenerator(args.toList()) -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/SafeDSGenerator.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/SafeDSGenerator.kt deleted file mode 100644 index 12417ad86..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/SafeDSGenerator.kt +++ /dev/null @@ -1,712 +0,0 @@ -package com.larsreimann.safeds.generator - -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.And -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Elvis -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.IdenticalTo -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.NotIdenticalTo -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Or -import com.larsreimann.safeds.constant.SdsPrefixOperationOperator -import com.larsreimann.safeds.constant.isInPipelineFile -import com.larsreimann.safeds.constant.isInTestFile -import com.larsreimann.safeds.constant.isPipelineFile -import com.larsreimann.safeds.constant.isTestFile -import com.larsreimann.safeds.constant.operator -import com.larsreimann.safeds.emf.assigneesOrEmpty -import com.larsreimann.safeds.emf.blockLambdaResultsOrEmpty -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.compilationUnitOrNull -import com.larsreimann.safeds.emf.containingBlockLambdaOrNull -import com.larsreimann.safeds.emf.containingCompilationUnitOrNull -import com.larsreimann.safeds.emf.createSdsWildcard -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.isGlobal -import com.larsreimann.safeds.emf.isOptional -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.placeholdersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.emf.statementsOrEmpty -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsAbstractStatement -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsArgumentList -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.safeDS.SdsIndexedAccess -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPrefixOperation -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsResultList -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTemplateString -import com.larsreimann.safeds.safeDS.SdsTemplateStringEnd -import com.larsreimann.safeds.safeDS.SdsTemplateStringInner -import com.larsreimann.safeds.safeDS.SdsTemplateStringStart -import com.larsreimann.safeds.safeDS.SdsWildcard -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.parametersOrNull -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantBoolean -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantEnumVariant -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantFloat -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantInt -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantNull -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantString -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.toConstantExpressionOrNull -import com.larsreimann.safeds.staticAnalysis.resultsOrNull -import com.larsreimann.safeds.staticAnalysis.statementHasNoSideEffects -import com.larsreimann.safeds.stdlibAccess.pythonModuleOrNull -import com.larsreimann.safeds.stdlibAccess.pythonNameOrNull -import com.larsreimann.safeds.utils.IdManager -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.xtext.generator.AbstractGenerator -import org.eclipse.xtext.generator.IFileSystemAccess2 -import org.eclipse.xtext.generator.IGeneratorContext - -/** - * Generates code from your model files on save. - * - * See [Xtext Code Generation](https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation). - */ -class SafeDSGenerator : AbstractGenerator() { - - private val codegenPackage = "safeds_runner.codegen" - private val runtimeBridgePackage = "runtimeBridge" - private val indent = " " - - /** - * Creates Python pipeline and declaration files if the [resource] is either a Safe-DS pipeline or test file. - */ - override fun doGenerate(resource: Resource, fsa: IFileSystemAccess2, context: IGeneratorContext) { - if (resource.isPipelineFile() || resource.isTestFile()) { - generatePipelineFiles(resource, fsa, context) - generateDeclarationFile(resource, fsa, context) - } - } - - /** - * Creates one Python file for each pipeline in the given resource that just contains a main block that calls the - * pipeline. This way we can run the Python interpreter with the created file to run the pipeline. - * - * **Example:** Given the following situation - * * Safe-DS package: "com.example" - * * Safe-DS file: "test.safeds" - * * Pipeline names: "pipeline1", "pipeline2" - * - * we create two files in the folder "com/example" (determined by the Safe-DS package). The file for "pipeline1" - * is called "test_pipeline1.py" and the file for "pipeline2" is called "test_pipeline2.py". The names are created - * by taking the Safe-DS file name, removing the file extension, appending an underscore, and then the pipeline - * name. - */ - private fun generatePipelineFiles(resource: Resource, fsa: IFileSystemAccess2, context: IGeneratorContext) { - resource.allContents.asSequence() - .filterIsInstance() - .forEach { - if (context.cancelIndicator.isCanceled) { - return - } - - val fileName = "${resource.baseGeneratedFilePathOrNull()}_${it.correspondingPythonName()}.py" - val content = """ - |from gen_${resource.baseFileNameOrNull()} import ${it.correspondingPythonName()} - | - |if __name__ == '__main__': - |$indent${it.correspondingPythonName()}() - | - """.trimMargin() - - fsa.generateFile(fileName, content) - } - } - - private fun generateDeclarationFile(resource: Resource, fsa: IFileSystemAccess2, context: IGeneratorContext) { - if (context.cancelIndicator.isCanceled) { - return - } - - val fileName = "${resource.baseGeneratedFilePathOrNull()}.py" - val compilationUnit = resource.compilationUnitOrNull() ?: return - val content = compile(compilationUnit) - - fsa.generateFile(fileName, content) - } - - private fun compile(compilationUnit: SdsCompilationUnit): String { - val imports = mutableSetOf() - - // Compile steps - val stepString = compilationUnit - .descendants() - .sortedBy { it.name } - .joinToString("\n") { - compileSteps(it, imports) - } - - // Compile pipelines - val pipelineString = compilationUnit - .descendants() - .sortedBy { it.name } - .joinToString("\n") { - compilePipeline(it, imports) - } - - return buildString { - // Imports - val importsString = compileImports(imports) - if (importsString.isNotBlank()) { - appendLine("# Imports ----------------------------------------------------------------------\n") - appendLine(importsString) - } - - // Steps - if (stepString.isNotBlank()) { - appendLine("# Steps ------------------------------------------------------------------------\n") - append(stepString) - } - - // Pipelines - if (pipelineString.isNotBlank()) { - if (stepString.isNotBlank()) { - appendLine() - } - appendLine("# Pipelines --------------------------------------------------------------------\n") - append(pipelineString) - } - } - } - - private fun compileImports(imports: Set) = buildString { - // Qualified imports - imports - .filter { it.declarationName == null } - .sortedBy { it.importPath } - .forEach { - appendLine(it.toString()) - } - - // From-imports - imports - .filter { it.declarationName != null } - .groupBy { it.importPath } - .entries - .sortedBy { it.key } - .forEach { (key, value) -> - val declarationNames = value - .sortedBy { it.declarationName } - .joinToString { - when (it.alias) { - null -> it.declarationName!! - else -> "${it.declarationName} as ${it.alias}" - } - } - appendLine("from $key import $declarationNames") - } - } - - @OptIn(ExperimentalStdlibApi::class) - private fun compileSteps(step: SdsStep, imports: MutableSet) = buildString { - val blockLambdaIdManager = IdManager() - - append("def ${step.correspondingPythonName()}(") - append( - step.parametersOrEmpty().joinToString { - compileParameter(CompileParameterFrame(it, imports, blockLambdaIdManager)) - }, - ) - appendLine("):") - - if (step.statementsOrEmpty().withEffect().isEmpty()) { - appendLine("${indent}pass") - } else { - step.statementsOrEmpty().withEffect().forEach { - val statement = compileStatement( - CompileStatementFrame( - it, - imports, - blockLambdaIdManager, - shouldSavePlaceholders = false, - ), - ).prependIndent(indent) - appendLine(statement) - } - - if (step.resultsOrEmpty().isNotEmpty()) { - appendLine("${indent}return ${step.resultsOrEmpty().joinToString { it.name }}") - } - } - } - - @OptIn(ExperimentalStdlibApi::class) - private fun compilePipeline(pipeline: SdsPipeline, imports: MutableSet) = buildString { - val blockLambdaIdManager = IdManager() - - appendLine("def ${pipeline.correspondingPythonName()}():") - if (pipeline.statementsOrEmpty().withEffect().isEmpty()) { - appendLine("${indent}pass") - } else { - pipeline.statementsOrEmpty().withEffect().forEach { - appendLine( - compileStatement( - CompileStatementFrame(it, imports, blockLambdaIdManager, shouldSavePlaceholders = true), - ).prependIndent(indent), - ) - } - } - } - - private data class CompileStatementFrame( - val stmt: SdsAbstractStatement, - val imports: MutableSet, - val blockLambdaIdManager: IdManager, - val shouldSavePlaceholders: Boolean, - ) - - @OptIn(ExperimentalStdlibApi::class) - private val compileStatement: DeepRecursiveFunction = - DeepRecursiveFunction { (stmt, imports, blockLambdaIdManager, shouldSavePlaceholders) -> - val stringBuilder = StringBuilder() - when (stmt) { - is SdsAssignment -> { - for (lambda in stmt.expression.descendants()) { - stringBuilder.append( - compileBlockLambda.callRecursive( - CompileBlockLambdaFrame( - lambda, - imports, - blockLambdaIdManager, - ), - ), - ) - } - - if (stmt.assigneesOrEmpty().any { it !is SdsWildcard }) { - val assignees = stmt.paddedAssignees().joinToString { - when (it) { - is SdsBlockLambdaResult -> it.name - is SdsPlaceholder -> it.name - is SdsYield -> it.result.name - else -> "_" - } - } - stringBuilder.append("$assignees = ") - } - stringBuilder.append( - compileExpression.callRecursive( - CompileExpressionFrame(stmt.expression, imports, blockLambdaIdManager), - ), - ) - - if (shouldSavePlaceholders) { - stmt.placeholdersOrEmpty().forEach { - imports += ImportData(runtimeBridgePackage) - stringBuilder.append("\n$runtimeBridgePackage.save_placeholder('${it.name}', ${it.name})") - } - } - } - is SdsExpressionStatement -> { - for (lambda in stmt.expression.descendants()) { - stringBuilder.append( - compileBlockLambda.callRecursive( - CompileBlockLambdaFrame( - lambda, - imports, - blockLambdaIdManager, - ), - ), - ) - } - - stringBuilder.append( - compileExpression.callRecursive( - CompileExpressionFrame(stmt.expression, imports, blockLambdaIdManager), - ), - ) - } - else -> throw java.lang.IllegalStateException("Missing case to handle statement $stmt.") - } - - stringBuilder.toString() - } - - private data class CompileBlockLambdaFrame( - val lambda: SdsBlockLambda, - val imports: MutableSet, - val blockLambdaIdManager: IdManager, - ) - - @OptIn(ExperimentalStdlibApi::class) - private val compileBlockLambda: DeepRecursiveFunction = - DeepRecursiveFunction { (lambda, imports, blockLambdaIdManager) -> - val stringBuilder = StringBuilder() - - // Header - stringBuilder.append("def ${lambda.uniqueName(blockLambdaIdManager)}(") - val parameters = mutableListOf() - for (parameter in lambda.parametersOrEmpty()) { - parameters += compileParameter.callRecursive( - CompileParameterFrame( - parameter, - imports, - blockLambdaIdManager, - ), - ) - } - stringBuilder.append(parameters.joinToString()) - stringBuilder.appendLine("):") - - // Statements - if (lambda.statementsOrEmpty().withEffect().isEmpty()) { - stringBuilder.appendLine("${indent}pass") - } else { - for (stmt in lambda.statementsOrEmpty().withEffect()) { - stringBuilder.appendLine( - compileStatement.callRecursive( - CompileStatementFrame( - stmt, - imports, - blockLambdaIdManager, - shouldSavePlaceholders = false, - ), - ).prependIndent(indent), - ) - } - - if (lambda.blockLambdaResultsOrEmpty().isNotEmpty()) { - stringBuilder.appendLine( - "${indent}return ${ - lambda.blockLambdaResultsOrEmpty().joinToString { it.name } - }", - ) - } - } - - stringBuilder.toString() - } - - private data class CompileParameterFrame( - val parameter: SdsParameter, - val imports: MutableSet, - val blockLambdaIdManager: IdManager, - ) - - @OptIn(ExperimentalStdlibApi::class) - private val compileParameter: DeepRecursiveFunction = - DeepRecursiveFunction { (parameter, imports, blockLambdaIdManager) -> - when { - parameter.isOptional() -> { - val defaultValue = compileExpression.callRecursive( - CompileExpressionFrame(parameter.defaultValue, imports, blockLambdaIdManager), - ) - "${parameter.correspondingPythonName()}=$defaultValue" - } - parameter.isVariadic -> "*${parameter.correspondingPythonName()}" - else -> parameter.correspondingPythonName() - } - } - - private data class CompileExpressionFrame( - val expression: SdsAbstractExpression, - val imports: MutableSet, - val blockLambdaIdManager: IdManager, - ) - - @OptIn(ExperimentalStdlibApi::class) - private val compileExpression: DeepRecursiveFunction = - DeepRecursiveFunction { (expr, imports, blockLambdaIdManager) -> - - // Template string parts - when (expr) { - is SdsTemplateStringStart -> return@DeepRecursiveFunction "${expr.value.toSingleLine()}{ " - is SdsTemplateStringInner -> return@DeepRecursiveFunction " }${expr.value.toSingleLine()}{ " - is SdsTemplateStringEnd -> return@DeepRecursiveFunction " }${expr.value.toSingleLine()}" - } - - // Constant expressions - val constantExpr = expr.toConstantExpressionOrNull() - if (constantExpr != null) { - when (constantExpr) { - is SdsConstantBoolean -> return@DeepRecursiveFunction if (constantExpr.value) "True" else "False" - is SdsConstantEnumVariant -> { - /* let remaining code handle this */ - } - is SdsConstantFloat -> return@DeepRecursiveFunction constantExpr.value.toString() - is SdsConstantInt -> return@DeepRecursiveFunction constantExpr.value.toString() - is SdsConstantNull -> return@DeepRecursiveFunction "None" - is SdsConstantString -> return@DeepRecursiveFunction "'${constantExpr.value.toSingleLine()}'" - } - } - - // Other - return@DeepRecursiveFunction when (expr) { - is SdsBlockLambda -> { - expr.uniqueName(blockLambdaIdManager) - } - is SdsCall -> { - val receiver = callRecursive(CompileExpressionFrame(expr.receiver, imports, blockLambdaIdManager)) - val arguments = mutableListOf() - for (argument in expr.argumentList.sortedByParameter()) { - val value = callRecursive(CompileExpressionFrame(argument.value, imports, blockLambdaIdManager)) - arguments += if (argument.parameterOrNull()?.isOptional() == true) { - "${argument.parameterOrNull()?.correspondingPythonName()}=$value" - } else { - value - } - } - - "$receiver(${arguments.joinToString()})" - } - is SdsExpressionLambda -> { - val parameters = mutableListOf() - for (parameter in expr.parametersOrEmpty()) { - parameters += compileParameter.callRecursive( - CompileParameterFrame( - parameter, - imports, - blockLambdaIdManager, - ), - ) - } - val result = callRecursive(CompileExpressionFrame(expr.result, imports, blockLambdaIdManager)) - - "lambda ${parameters.joinToString()}: $result" - } - is SdsInfixOperation -> { - val leftOperand = - callRecursive(CompileExpressionFrame(expr.leftOperand, imports, blockLambdaIdManager)) - val rightOperand = - callRecursive(CompileExpressionFrame(expr.rightOperand, imports, blockLambdaIdManager)) - when (expr.operator()) { - Or -> { - imports += ImportData(codegenPackage) - "$codegenPackage.eager_or($leftOperand, $rightOperand)" - } - And -> { - imports += ImportData(codegenPackage) - "$codegenPackage.eager_and($leftOperand, $rightOperand)" - } - IdenticalTo -> "($leftOperand) is ($rightOperand)" - NotIdenticalTo -> "($leftOperand) is not ($rightOperand)" - Elvis -> { - imports += ImportData(codegenPackage) - "$codegenPackage.eager_elvis($leftOperand, $rightOperand)" - } - else -> "($leftOperand) ${expr.operator} ($rightOperand)" - } - } - is SdsIndexedAccess -> { - val receiver = callRecursive(CompileExpressionFrame(expr.receiver, imports, blockLambdaIdManager)) - val index = callRecursive(CompileExpressionFrame(expr.index, imports, blockLambdaIdManager)) - "$receiver[$index]" - } - is SdsMemberAccess -> { - val receiver = callRecursive(CompileExpressionFrame(expr.receiver, imports, blockLambdaIdManager)) - when (val memberDeclaration = expr.member.declaration) { - is SdsBlockLambdaResult -> { - val allResults = memberDeclaration.containingBlockLambdaOrNull()!!.blockLambdaResultsOrEmpty() - if (allResults.size == 1) { - receiver - } else { - val thisIndex = allResults.indexOf(memberDeclaration) - "$receiver[$thisIndex]" - } - } - is SdsEnumVariant -> { - val member = - callRecursive(CompileExpressionFrame(expr.member, imports, blockLambdaIdManager)) - - val suffix = when (expr.eContainer()) { - is SdsCall -> "" - else -> "()" - } - - when { - expr.isNullSafe -> { - imports += ImportData(codegenPackage) - "$codegenPackage.safe_access($receiver, '$member')$suffix" - } - else -> "$receiver.$member$suffix" - } - } - is SdsResult -> { - val allResults = memberDeclaration.closestAncestorOrNull()!!.results - if (allResults.size == 1) { - receiver - } else { - val thisIndex = allResults.indexOf(memberDeclaration) - "$receiver[$thisIndex]" - } - } - else -> { - val member = - callRecursive(CompileExpressionFrame(expr.member, imports, blockLambdaIdManager)) - when { - expr.isNullSafe -> { - imports += ImportData(codegenPackage) - "$codegenPackage.safe_access($receiver, '$member')" - } - else -> "$receiver.$member" - } - } - } - } - is SdsParenthesizedExpression -> { - callRecursive(CompileExpressionFrame(expr.expression, imports, blockLambdaIdManager)) - } - is SdsPrefixOperation -> { - val operand = callRecursive(CompileExpressionFrame(expr.operand, imports, blockLambdaIdManager)) - when (expr.operator()) { - SdsPrefixOperationOperator.Not -> "not ($operand)" - SdsPrefixOperationOperator.Minus -> "-($operand)" - } - } - is SdsReference -> { - val importAlias = expr.containingCompilationUnitOrNull() - ?.imports - ?.firstOrNull { it.importedNamespace == expr.declaration.qualifiedNameOrNull().toString() } - ?.alias - ?.name - - // Add import as needed - val declaration = expr.declaration - if (declaration.isGlobal() && declaration.containingCompilationUnitOrNull() != expr.containingCompilationUnitOrNull()) { - val importPath = declaration - .containingCompilationUnitOrNull() - ?.correspondingPythonModule() - ?.split(".") - .orEmpty() - .toMutableList() - - if (importPath.isNotEmpty()) { - if (declaration.isInPipelineFile() || declaration.isInTestFile()) { - val fileName = declaration.eResource().baseFileNameOrNull() - importPath += "gen_$fileName" - - if (fileName != null) { - imports += ImportData( - importPath.joinToString("."), - declaration.correspondingPythonName(), - importAlias, - ) - } - } else { - imports += ImportData( - importPath.joinToString("."), - declaration.correspondingPythonName(), - importAlias, - ) - } - } - } - - importAlias ?: declaration.correspondingPythonName() - } - is SdsTemplateString -> { - val substrings = mutableListOf() - for (expression in expr.expressions) { - substrings += callRecursive(CompileExpressionFrame(expression, imports, blockLambdaIdManager)) - } - "f'${substrings.joinToString("")}'" - } - else -> throw java.lang.IllegalStateException("Missing case to handle expression $expr.") - } - } -} - -/** - * Returns the name of the Python declaration that corresponds to this [SdsAbstractDeclaration]. - */ -private fun SdsAbstractDeclaration.correspondingPythonName(): String { - return pythonNameOrNull() ?: name -} - -/** - * Returns the name of the Python module that corresponds to this [SdsCompilationUnit]. - */ -private fun SdsCompilationUnit.correspondingPythonModule(): String { - return pythonModuleOrNull() ?: name -} - -/** - * Adds wildcards at the end of the assignee list until every value of the right-hand side is captured. - */ -private fun SdsAssignment.paddedAssignees(): List { - val desiredNumberOfAssignees = when (val expression = this.expression) { - is SdsCall -> expression.resultsOrNull()?.size ?: 0 - else -> 1 - } - - return buildList { - addAll(assigneesOrEmpty()) - while (size < desiredNumberOfAssignees) { - add(createSdsWildcard()) - } - } -} - -/** - * Returns a unique but consistent name for this lambda. - */ -private fun SdsBlockLambda.uniqueName(blockLambdaIdManager: IdManager): String { - val id = blockLambdaIdManager.assignIdIfAbsent(this).value - return "__block_lambda_$id" -} - -/** - * Returns a new list that only contains the [SdsAbstractStatement] that have some effect. - */ -private fun List.withEffect(): List { - return this.filter { !it.statementHasNoSideEffects() } -} - -/** - * Returns a new list with the arguments in the same order as the corresponding parameters. - */ -private fun SdsArgumentList?.sortedByParameter(): List { - val parameters = this?.parametersOrNull() ?: return emptyList() - val arguments = this.arguments - - return buildList { - parameters.forEach { parameter -> - addAll(arguments.filter { it.parameterOrNull() == parameter }) - } - } -} - -/** - * Escapes newlines. - */ -private fun String.toSingleLine(): String { - return replace("\n", "\\n") -} - -/** - * Stores information about the imports that should be generated - */ -private data class ImportData( - val importPath: String, - val declarationName: String? = null, - val alias: String? = null, -) { - override fun toString(): String { - return when { - declarationName == null && alias == null -> "import $importPath" - declarationName == null && alias != null -> "import $importPath as $alias" - declarationName != null && alias == null -> "from $importPath import $declarationName" - else -> "from $importPath import $declarationName as $alias" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/LspPosition.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/LspPosition.kt deleted file mode 100644 index 8e1536457..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/LspPosition.kt +++ /dev/null @@ -1,85 +0,0 @@ -package com.larsreimann.safeds.location - -/** - * A specific position in a program using the zero-based indexing of LSP. - */ -data class LspPosition(val line: LspLine, val column: LspColumn) : Comparable { - companion object { - - @JvmStatic - fun fromInts(line: Int, column: Int): LspPosition { - return LspPosition( - LspLine(line), - LspColumn(column), - ) - } - } - - fun toXtextPosition(): XtextPosition { - return XtextPosition( - line.toXtextLine(), - column.toXtextColumn(), - ) - } - - override fun toString(): String { - return "[$line, $column]" - } - - override operator fun compareTo(other: LspPosition): Int { - val lineComparison = this.line.compareTo(other.line) - if (lineComparison != 0) { - return lineComparison - } - - return this.column.compareTo(other.column) - } -} - -/** - * A line in a program. Counting starts at 0. - * - * @throws IllegalArgumentException If value is negative. - */ -@JvmInline -value class LspLine(val value: Int) : Comparable { - init { - require(value >= 0) { "Line must be at least 0." } - } - - fun toXtextLine(): XtextLine { - return XtextLine(value + 1) - } - - override fun toString(): String { - return value.toString() - } - - override operator fun compareTo(other: LspLine): Int { - return this.value.compareTo(other.value) - } -} - -/** - * A column in a program. Counting starts at 0. - * - * @throws IllegalArgumentException If value is negative. - */ -@JvmInline -value class LspColumn(val value: Int) : Comparable { - init { - require(value >= 0) { "Column must be at least 0." } - } - - fun toXtextColumn(): XtextColumn { - return XtextColumn(value + 1) - } - - override fun toString(): String { - return value.toString() - } - - override operator fun compareTo(other: LspColumn): Int { - return this.value.compareTo(other.value) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/LspRange.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/LspRange.kt deleted file mode 100644 index acc6b0e7f..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/LspRange.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.larsreimann.safeds.location - -/** - * A range in a program from a start to an end position with some length using the zero-based indexing of LSP. - * - * @see LspPosition - * @see ProgramRangeLength - */ -data class LspRange(val start: LspPosition, val end: LspPosition, val length: ProgramRangeLength) { - - companion object { - - @JvmStatic - fun fromInts(startLine: Int, startColumn: Int, endLine: Int, endColumn: Int, length: Int): LspRange { - return LspRange( - LspPosition.fromInts(startLine, startColumn), - LspPosition.fromInts(endLine, endColumn), - ProgramRangeLength(length), - ) - } - } - - fun toXtextRange(): XtextRange { - return XtextRange( - start.toXtextPosition(), - end.toXtextPosition(), - length, - ) - } - - override fun toString(): String { - return "[$start .. $end]" - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/ProgramRangeLength.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/ProgramRangeLength.kt deleted file mode 100644 index 3847635a3..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/ProgramRangeLength.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.larsreimann.safeds.location - -/** - * The number of characters in a program range (Xtext/LSP). This value must be non-negative. - * - * @throws IllegalArgumentException If value is negative. - * - * @see XtextRange - * @see LspRange - */ -@JvmInline -value class ProgramRangeLength(val value: Int) { - init { - require(value >= 0) { "Length must be at least 0." } - } - - override fun toString(): String { - val chars = if (value == 1) "char" else "chars" - return "$value $chars" - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/XtextPosition.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/XtextPosition.kt deleted file mode 100644 index 241ad765c..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/XtextPosition.kt +++ /dev/null @@ -1,85 +0,0 @@ -package com.larsreimann.safeds.location - -/** - * A specific position in a program using the one-based indexing of Xtext. - */ -data class XtextPosition(val line: XtextLine, val column: XtextColumn) : Comparable { - companion object { - - @JvmStatic - fun fromInts(line: Int, column: Int): XtextPosition { - return XtextPosition( - XtextLine(line), - XtextColumn(column), - ) - } - } - - fun toLspPosition(): LspPosition { - return LspPosition( - line.toLspLine(), - column.toLspColumn(), - ) - } - - override fun toString(): String { - return "$line:$column" - } - - override operator fun compareTo(other: XtextPosition): Int { - val lineComparison = this.line.compareTo(other.line) - if (lineComparison != 0) { - return lineComparison - } - - return this.column.compareTo(other.column) - } -} - -/** - * A line in a program. Counting starts at 1. - * - * @throws IllegalArgumentException If value is less than 1. - */ -@JvmInline -value class XtextLine(val value: Int) : Comparable { - init { - require(value >= 1) { "Line must be at least 1." } - } - - fun toLspLine(): LspLine { - return LspLine(value - 1) - } - - override fun toString(): String { - return value.toString() - } - - override operator fun compareTo(other: XtextLine): Int { - return this.value.compareTo(other.value) - } -} - -/** - * A column in a program. Counting starts at 1. - * - * @throws IllegalArgumentException If value is less than 1. - */ -@JvmInline -value class XtextColumn(val value: Int) : Comparable { - init { - require(value >= 1) { "Column must be at least 1." } - } - - fun toLspColumn(): LspColumn { - return LspColumn(value - 1) - } - - override fun toString(): String { - return value.toString() - } - - override operator fun compareTo(other: XtextColumn): Int { - return this.value.compareTo(other.value) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/XtextRange.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/XtextRange.kt deleted file mode 100644 index 0f73c88f5..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/location/XtextRange.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.larsreimann.safeds.location - -/** - * A range in a program from a start to an end position with some length using the one-based indexing of Xtext. - * - * @see XtextPosition - * @see ProgramRangeLength - */ -data class XtextRange(val start: XtextPosition, val end: XtextPosition, val length: ProgramRangeLength) { - - companion object { - - @JvmStatic - fun fromInts(startLine: Int, startColumn: Int, endLine: Int, endColumn: Int, length: Int): XtextRange { - return XtextRange( - XtextPosition.fromInts(startLine, startColumn), - XtextPosition.fromInts(endLine, endColumn), - ProgramRangeLength(length), - ) - } - } - - fun toLspRange(): LspRange { - return LspRange( - start.toLspPosition(), - end.toLspPosition(), - length, - ) - } - - override fun toString(): String { - return "$start .. $end ($length)" - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/naming/QualifiedNameProvider.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/naming/QualifiedNameProvider.kt deleted file mode 100644 index f99d1c2b3..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/naming/QualifiedNameProvider.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.larsreimann.safeds.naming - -import com.google.inject.Inject -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import org.eclipse.xtext.naming.IQualifiedNameConverter -import org.eclipse.xtext.naming.IQualifiedNameProvider -import org.eclipse.xtext.naming.QualifiedName - -internal object QualifiedNameProviderInjectionTarget { - - @Inject - lateinit var qualifiedNameConverter: IQualifiedNameConverter - - @Inject - lateinit var qualifiedNameProvider: IQualifiedNameProvider -} - -/** - * Returns the qualified name of the declaration. - */ -fun SdsAbstractDeclaration.qualifiedNameOrNull(): QualifiedName? { - return QualifiedNameProviderInjectionTarget.qualifiedNameProvider.getFullyQualifiedName(this) -} - -/** - * Converts a string to a qualified name. - */ -fun String.toQualifiedName(): QualifiedName { - return QualifiedNameProviderInjectionTarget.qualifiedNameConverter.toQualifiedName(this) -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/IndexExtensions.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/IndexExtensions.kt deleted file mode 100644 index 1aa9bcd43..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/IndexExtensions.kt +++ /dev/null @@ -1,101 +0,0 @@ -package com.larsreimann.safeds.scoping - -import com.google.inject.Inject -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.scoping.IndexExtensionsInjectionTarget.containerManager -import com.larsreimann.safeds.scoping.IndexExtensionsInjectionTarget.resourceDescriptionsProvider -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.xtext.resource.IContainer -import org.eclipse.xtext.resource.IEObjectDescription -import org.eclipse.xtext.resource.IResourceDescription -import org.eclipse.xtext.resource.IResourceDescriptions -import org.eclipse.xtext.resource.IResourceDescriptionsProvider - -internal object IndexExtensionsInjectionTarget { - - @Inject - lateinit var containerManager: IContainer.Manager - - @Inject - lateinit var resourceDescriptionsProvider: IResourceDescriptionsProvider -} - -/** - * Returns all global declarations that are visible from this context. If this [EObject] is not in a [Resource] or the - * [Resource] not in a [ResourceSet] an empty list is returned. - */ -fun EObject.allGlobalDeclarations(): List { - return eResource() - ?.visibleContainers() - ?.asSequence() - ?.map { it.exportedObjects } - ?.flatten() - ?.filter { it.isGlobalDeclaration() } - ?.toList() - .orEmpty() -} - -/** - * Returns all global declarations that are visible from this context and in the same [Resource]. If this [EObject] is - * not in a [Resource] or the [Resource] not in a [ResourceSet] an empty list is returned. - */ -fun EObject.ownGlobalDeclarations(): List { - return eResource() - ?.resourceDescriptionOrNull() - ?.exportedObjects - ?.asSequence() - ?.filter { it.isGlobalDeclaration() } - ?.toList() - .orEmpty() -} - -/** - * Returns all global declarations that are visible from this context but in another [Resource]. If this [EObject] is - * not in a [Resource] or the [Resource] not in a [ResourceSet] and empty list is returned. - */ -fun EObject.externalGlobalDeclarations(): List { - return allGlobalDeclarations() - ownGlobalDeclarations().toSet() -} - -/** - * Returns a list of [IContainer]s that are visible from this [Resource], including this [Resource]. If this [Resource] - * is not in a [ResourceSet], an empty list is returned. An [IContainer] describes [Resource]s that should be treated - * as visible on the same level during the scoping stage. - */ -private fun Resource.visibleContainers(): List { - val resourceSet = this.resourceSet ?: return emptyList() - - return containerManager.getVisibleContainers( - resourceDescriptionOrNull(), - resourceSet.resourceDescriptions(), - ) -} - -/** - * Returns information about this [Resource] or `null` if the [Resource] is not in a [ResourceSet]. - */ -private fun Resource.resourceDescriptionOrNull(): IResourceDescription? { - return resourceSet?.resourceDescriptions()?.getResourceDescription(uri) -} - -/** - * Returns the information about the [Resource]s in this [ResourceSet]. - */ -private fun ResourceSet.resourceDescriptions(): IResourceDescriptions { - return resourceDescriptionsProvider.getResourceDescriptions(this) -} - -/** - * Returns whether this [IEObjectDescription] should be available in other [Resource]s. - */ -private fun IEObjectDescription.isGlobalDeclaration(): Boolean { - return this.eClass in setOf( - Literals.SDS_ANNOTATION, - Literals.SDS_CLASS, - Literals.SDS_ENUM, - Literals.SDS_FUNCTION, - Literals.SDS_STEP, - ) -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSImportedNamespaceAwareLocalScopeProvider.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSImportedNamespaceAwareLocalScopeProvider.kt deleted file mode 100644 index 235f10adb..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSImportedNamespaceAwareLocalScopeProvider.kt +++ /dev/null @@ -1,128 +0,0 @@ -package com.larsreimann.safeds.scoping - -import com.larsreimann.safeds.emf.aliasNameOrNull -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.naming.QualifiedName -import org.eclipse.xtext.scoping.impl.ImportNormalizer -import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider - -class SafeDSImportedNamespaceAwareLocalScopeProvider : ImportedNamespaceAwareLocalScopeProvider() { - - /** - * Import all declarations from the listed packages implicitly, such as "safeds.lang". - */ - override fun getImplicitImports(ignoreCase: Boolean): List { - return listOf( - ImportNormalizer(QualifiedName.create("safeds", "lang"), true, ignoreCase), - ) - } - - /** - * Import all declarations in the same package implicitly. - * - * See Xtext book page 278 for more information. - */ - override fun internalGetImportedNamespaceResolvers( - context: EObject, - ignoreCase: Boolean, - ): List { - if (context !is SdsCompilationUnit) { - return emptyList() - } - - // Resolve imports - including aliases - val resolvers = context.imports.mapNotNull { - createImportedNamespaceResolver(it.importedNamespace, it.aliasNameOrNull(), ignoreCase) - }.toMutableList() - - // Implicitly import declarations in same package - context.qualifiedNameOrNull()?.let { - resolvers += ImportNormalizer( - it, - true, - ignoreCase, - ) - } - - return resolvers - } - - private fun createImportedNamespaceResolver( - namespace: String, - alias: String?, - ignoreCase: Boolean, - ): ImportNormalizer? { - if (namespace.isEmpty()) { - return null - } else if (alias == null) { - return createImportedNamespaceResolver(namespace, ignoreCase) - } - - val importedNamespace = qualifiedNameConverter.toQualifiedName(namespace) - if (importedNamespace == null || importedNamespace.isEmpty) { - return null - } - - return when { - hasWildCard(importedNamespace, ignoreCase) -> null - else -> ImportWithAliasNormalizer(importedNamespace, QualifiedName.create(alias), ignoreCase) - } - } - - private fun hasWildCard(importedNamespace: QualifiedName, ignoreCase: Boolean): Boolean { - return when { - ignoreCase -> importedNamespace.lastSegment.equals(wildCard, ignoreCase = true) - else -> importedNamespace.lastSegment == wildCard - } - } -} - -data class ImportWithAliasNormalizer( - val importedNamespace: QualifiedName, - val alias: QualifiedName, - val ignoreCase: Boolean, -) : ImportNormalizer(importedNamespace, false, ignoreCase) { - - init { - require(!(importedNamespace.isEmpty)) { "Imported namespace must not be empty." } - require(alias.segmentCount == 1) { "Alias must have exactly one segment." } - } - - /** - * Converts a fully qualified name to the simple alias that can be used to refer to a declaration. If this - * normalizer is not responsible for the given fully qualified name, null is returned instead. - */ - override fun deresolve(fullyQualifiedName: QualifiedName): QualifiedName? { - return when { - ignoreCase && fullyQualifiedName.equalsIgnoreCase(importedNamespacePrefix) -> alias - !ignoreCase && fullyQualifiedName == importedNamespacePrefix -> alias - else -> null - } - } - - /** - * Converts a simple alias to the fully qualified name of the declaration. If this normalizer is not responsible for - * the given alias, null is returned instead. - */ - override fun resolve(relativeName: QualifiedName): QualifiedName? { - if (relativeName.segmentCount != 1) { - return null - } - - return when { - ignoreCase && relativeName.lastSegment.equals(alias.lastSegment, ignoreCase = true) -> { - importedNamespacePrefix.skipLast(1).append(relativeName.lastSegment) - } - !ignoreCase && relativeName.lastSegment == alias.lastSegment -> { - return importedNamespace - } - else -> null - } - } - - override fun toString(): String { - return "import $importedNamespace as $alias" - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSResourceDescriptionStrategy.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSResourceDescriptionStrategy.kt deleted file mode 100644 index 370ed7189..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSResourceDescriptionStrategy.kt +++ /dev/null @@ -1,72 +0,0 @@ -package com.larsreimann.safeds.scoping - -import com.larsreimann.safeds.constant.SdsVisibility -import com.larsreimann.safeds.constant.visibility -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.resource.IEObjectDescription -import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy -import org.eclipse.xtext.util.IAcceptor - -/** - * Describes which objects are exported to other resources. - */ -class SafeDSResourceDescriptionStrategy : DefaultResourceDescriptionStrategy() { - override fun createEObjectDescriptions(eObject: EObject, acceptor: IAcceptor): Boolean { - return when (eObject) { - is SdsCompilationUnit -> { - super.createEObjectDescriptions(eObject, acceptor) - } - is SdsAnnotation -> { - super.createEObjectDescriptions(eObject, acceptor) - } - is SdsAttribute -> { - super.createEObjectDescriptions(eObject, acceptor) - false - } - is SdsClass -> { - super.createEObjectDescriptions(eObject, acceptor) - } - is SdsEnum -> { - super.createEObjectDescriptions(eObject, acceptor) - } - is SdsEnumVariant -> { - super.createEObjectDescriptions(eObject, acceptor) - } - is SdsFunction -> { - super.createEObjectDescriptions(eObject, acceptor) - } - is SdsPredicate -> { - super.createEObjectDescriptions(eObject, acceptor) - } - is SdsParameter -> { - super.createEObjectDescriptions(eObject, acceptor) - false - } - is SdsTypeParameter -> { - super.createEObjectDescriptions(eObject, acceptor) - false - } - is SdsStep -> { - if (eObject.visibility() != SdsVisibility.Private) { - super.createEObjectDescriptions(eObject, acceptor) - } else { - false - } - } - else -> { - false - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSScopeProvider.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSScopeProvider.kt deleted file mode 100644 index 66d5e6676..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSScopeProvider.kt +++ /dev/null @@ -1,344 +0,0 @@ -package com.larsreimann.safeds.scoping - -import com.larsreimann.safeds.constant.SdsVisibility -import com.larsreimann.safeds.constant.visibility -import com.larsreimann.safeds.emf.classMembersOrEmpty -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.compilationUnitOrNull -import com.larsreimann.safeds.emf.containingCallableOrNull -import com.larsreimann.safeds.emf.containingClassOrNull -import com.larsreimann.safeds.emf.containingCompilationUnitOrNull -import com.larsreimann.safeds.emf.containingProtocolOrNull -import com.larsreimann.safeds.emf.isStatic -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.placeholdersOrEmpty -import com.larsreimann.safeds.emf.subtermsOrEmpty -import com.larsreimann.safeds.emf.typeParametersOrNull -import com.larsreimann.safeds.emf.variantsOrEmpty -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage -import com.larsreimann.safeds.safeDS.SdsAbstractLambda -import com.larsreimann.safeds.safeDS.SdsAbstractNamedTypeDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractProtocolToken -import com.larsreimann.safeds.safeDS.SdsAbstractStatement -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsArgumentList -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsBlock -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsConstraint -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsMemberType -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsProtocol -import com.larsreimann.safeds.safeDS.SdsProtocolReference -import com.larsreimann.safeds.safeDS.SdsProtocolSubterm -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsSchemaType -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeArgumentList -import com.larsreimann.safeds.safeDS.SdsTypeParameterConstraint -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.staticAnalysis.classHierarchy.superClassMembers -import com.larsreimann.safeds.staticAnalysis.linking.parametersOrNull -import com.larsreimann.safeds.staticAnalysis.linking.typeParametersOrNull -import com.larsreimann.safeds.staticAnalysis.resultsOrNull -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.EnumType -import com.larsreimann.safeds.staticAnalysis.typing.EnumVariantType -import com.larsreimann.safeds.staticAnalysis.typing.NamedType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.EReference -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.xtext.naming.QualifiedName -import org.eclipse.xtext.resource.IEObjectDescription -import org.eclipse.xtext.scoping.IScope -import org.eclipse.xtext.scoping.Scopes -import org.eclipse.xtext.scoping.impl.FilteringScope - -/** - * This class contains custom scoping description. - * - * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping - * on how and when to use it. - */ -class SafeDSScopeProvider : AbstractSafeDSScopeProvider() { - - override fun getScope(context: EObject, reference: EReference): IScope { - return when (context) { - is SdsArgument -> scopeForArgumentParameter(context) - is SdsNamedType -> scopeForNamedTypeDeclaration(context) - is SdsProtocolReference -> scopeForProtocolReferenceToken(context) - is SdsReference -> scopeForReferenceDeclaration(context) - is SdsSchemaType -> scopeForSchemaTypeDeclaration(context) - is SdsTypeArgument -> scopeForTypeArgumentTypeParameter(context) - is SdsTypeParameterConstraint -> scopeForTypeParameterConstraintLeftOperand(context) - is SdsAnnotationCall, is SdsYield -> { - super.getScope(context, reference) - } - else -> IScope.NULLSCOPE - } - } - - private fun scopeForArgumentParameter(sdsArgument: SdsArgument): IScope { - val parameters = sdsArgument - .closestAncestorOrNull() - ?.parametersOrNull() - ?: emptyList() - return Scopes.scopeFor(parameters) - } - - private fun scopeForReferenceDeclaration(context: SdsReference): IScope { - val container = context.eContainer() - return when { - container is SdsMemberAccess && container.member == context -> scopeForMemberAccessDeclaration(container) - else -> { - val resource = context.eResource() - val packageName = context.containingCompilationUnitOrNull()?.qualifiedNameOrNull() - - // Declarations in other files - var result: IScope = FilteringScope( - super.delegateGetScope(context, SafeDSPackage.Literals.SDS_REFERENCE__DECLARATION), - ) { - it.isReferencableExternalDeclaration(resource, packageName) - } - - // Declarations in this file - result = declarationsInSameFile(resource, result) - - // Declarations in containing classes - context.containingClassOrNull()?.let { - result = classMembers(it, result) - } - - // Declarations in containing blocks - localDeclarations(context, result) - } - } - } - - /** - * Removes declarations in this [Resource], [SdsAnnotation]s, and internal [SdsStep]s located in other - * [SdsCompilationUnit]s. - */ - private fun IEObjectDescription?.isReferencableExternalDeclaration( - fromResource: Resource, - fromPackageWithQualifiedName: QualifiedName?, - ): Boolean { - // Resolution failed in delegate scope - if (this == null) return false - - val obj = this.eObjectOrProxy - - // Local declarations are added later using custom scoping rules - if (obj.eResource() == fromResource) return false - - // Annotations cannot be referenced - if (obj is SdsAnnotation) return false - - // Internal steps in another package cannot be referenced - return !( - obj is SdsStep && - obj.visibility() == SdsVisibility.Internal && - obj.containingCompilationUnitOrNull()?.qualifiedNameOrNull() != fromPackageWithQualifiedName - ) - } - - private fun scopeForMemberAccessDeclaration(context: SdsMemberAccess): IScope { - val receiver = context.receiver - - // Static access - val receiverDeclaration = when (receiver) { - is SdsReference -> receiver.declaration - is SdsMemberAccess -> receiver.member.declaration - else -> null - } - if (receiverDeclaration != null) { - when (receiverDeclaration) { - is SdsClass -> { - val members = receiverDeclaration.classMembersOrEmpty().filter { it.isStatic() } - val superTypeMembers = receiverDeclaration.superClassMembers() - .filter { it.isStatic() } - .toList() - - return Scopes.scopeFor(members, Scopes.scopeFor(superTypeMembers)) - } - is SdsEnum -> { - return Scopes.scopeFor(receiverDeclaration.variantsOrEmpty()) - } - } - } - - // Call results - var resultScope = IScope.NULLSCOPE - if (receiver is SdsCall) { - val results = receiver.resultsOrNull() - when { - results == null -> return IScope.NULLSCOPE - results.size > 1 -> return Scopes.scopeFor(results) - results.size == 1 -> resultScope = Scopes.scopeFor(results) - } - } - - // Members - val type = (receiver.type() as? NamedType) ?: return resultScope - - return when { - type.isNullable && !context.isNullSafe -> resultScope - type is ClassType -> { - val members = type.sdsClass.classMembersOrEmpty().filter { !it.isStatic() } - val superTypeMembers = type.sdsClass.superClassMembers() - .filter { !it.isStatic() } - .toList() - - Scopes.scopeFor(members, Scopes.scopeFor(superTypeMembers, resultScope)) - } - type is EnumVariantType -> Scopes.scopeFor(type.sdsEnumVariant.parametersOrEmpty()) - else -> resultScope - } - } - - private fun declarationsInSameFile(resource: Resource, parentScope: IScope): IScope { - val members = resource.compilationUnitOrNull() - ?.members - ?.filter { it !is SdsAnnotation && it !is SdsPipeline } - ?: emptyList() - - return Scopes.scopeFor( - members, - parentScope, - ) - } - - private fun classMembers(context: SdsClass, parentScope: IScope): IScope { - return when (val containingClassOrNull = context.containingClassOrNull()) { - is SdsClass -> Scopes.scopeFor( - context.classMembersOrEmpty(), - classMembers(containingClassOrNull, parentScope), - ) - else -> Scopes.scopeFor(context.classMembersOrEmpty(), parentScope) - } - } - - private fun localDeclarations(context: EObject, parentScope: IScope): IScope { - // Placeholders - val placeholders = when (val containingStatement = context.closestAncestorOrNull()) { - null -> emptyList() - else -> - containingStatement - .closestAncestorOrNull() - ?.placeholdersUpTo(containingStatement) - .orEmpty() - } - - // Parameters - val containingCallable = context.containingCallableOrNull() - val parameters = containingCallable.parametersOrEmpty() - - // Local declarations - val localDeclarations = placeholders + parameters - - return when (containingCallable) { - // Lambdas can be nested - is SdsAbstractLambda -> Scopes.scopeFor( - localDeclarations, - localDeclarations(containingCallable, parentScope), - ) - else -> Scopes.scopeFor(localDeclarations, parentScope) - } - } - - private fun SdsBlock.placeholdersUpTo(containingStatement: SdsAbstractStatement): List { - return this.statements - .takeWhile { it !== containingStatement } - .filterIsInstance() - .flatMap { it.placeholdersOrEmpty() } - } - - private fun scopeForNamedTypeDeclaration(context: SdsNamedType): IScope { - val container = context.eContainer() - return when { - container is SdsMemberType && container.member == context -> scopeForMemberTypeDeclaration(container) - else -> { - super.getScope(context, SafeDSPackage.Literals.SDS_NAMED_TYPE__DECLARATION) - } - } - } - - private fun scopeForMemberTypeDeclaration(context: SdsMemberType): IScope { - val type = (context.receiver.type() as? NamedType) ?: return IScope.NULLSCOPE - - return when { - type.isNullable -> IScope.NULLSCOPE - type is ClassType -> { - val members = - type.sdsClass.classMembersOrEmpty().filterIsInstance() - val superTypeMembers = type.sdsClass.superClassMembers() - .filterIsInstance() - .toList() - - Scopes.scopeFor(members, Scopes.scopeFor(superTypeMembers)) - } - type is EnumType -> Scopes.scopeFor(type.sdsEnum.variantsOrEmpty()) - else -> IScope.NULLSCOPE - } - } - - private fun scopeForProtocolReferenceToken(context: SdsProtocolReference): IScope { - val containingClass = context.containingClassOrNull() ?: return IScope.NULLSCOPE - val containingProtocol = context.containingProtocolOrNull() ?: return IScope.NULLSCOPE - val containingSubtermOrNull = context.closestAncestorOrNull() - - // Own & inherited class members - val members = containingClass.classMembersOrEmpty().filterIsInstance() - val superTypeMembers = containingClass.superClassMembers() - .filterIsInstance() - .toList() - - val resultScope = Scopes.scopeFor(members, Scopes.scopeFor(superTypeMembers)) - - // Subterms - return Scopes.scopeFor(containingProtocol.subtermsUpTo(containingSubtermOrNull), resultScope) - } - - @OptIn(ExperimentalSdsApi::class) - private fun SdsProtocol.subtermsUpTo(containingSubtermOrNull: SdsProtocolSubterm?): List { - if (containingSubtermOrNull == null) { - return this.subtermsOrEmpty() - } - - return this.subtermsOrEmpty().takeWhile { it !== containingSubtermOrNull } - } - - private fun scopeForSchemaTypeDeclaration(context: SdsSchemaType): IScope { - return super.getScope(context, SafeDSPackage.Literals.SDS_SCHEMA_TYPE__DECLARATION) - } - - private fun scopeForTypeArgumentTypeParameter(sdsTypeArgument: SdsTypeArgument): IScope { - val typeParameters = sdsTypeArgument - .closestAncestorOrNull() - ?.typeParametersOrNull() - ?: emptyList() - - return Scopes.scopeFor(typeParameters) - } - - private fun scopeForTypeParameterConstraintLeftOperand(sdsTypeParameterConstraint: SdsTypeParameterConstraint): IScope { - val typeParameters = sdsTypeParameterConstraint - .closestAncestorOrNull() - ?.typeParametersOrNull() - ?: emptyList() - - return Scopes.scopeFor(typeParameters) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/CommentAdapters.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/CommentAdapters.kt deleted file mode 100644 index 1bc45400d..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/CommentAdapters.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.larsreimann.safeds.serializer - -import org.eclipse.emf.common.notify.impl.AdapterImpl -import org.eclipse.emf.ecore.EObject - -/** - * Stores a comment that is attached to an [EObject]. - */ -sealed class CommentAdapter(val text: String) : AdapterImpl() - -/** - * Stores a single-line comment that is attached to an [EObject]. - */ -class SingleLineCommentAdapter(text: String) : CommentAdapter(text) { - override fun toString(): String { - return "// $text" - } -} - -/** - * Stores a multi-line comment that is attached to an [EObject]. - */ -class MultiLineCommentAdapter(text: String) : CommentAdapter(text) { - override fun toString(): String { - return if (text.lines().size == 1) { - "/* $text */" - } else { - buildString { - appendLine("/*") - text.lineSequence().forEach { - appendLine(" * $it") - } - appendLine(" */") - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSCrossReferenceSerializer.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSCrossReferenceSerializer.kt deleted file mode 100644 index 8974465a6..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSCrossReferenceSerializer.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.larsreimann.safeds.serializer - -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.CrossReference -import org.eclipse.xtext.nodemodel.INode -import org.eclipse.xtext.scoping.IScope -import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic -import org.eclipse.xtext.serializer.tokens.CrossReferenceSerializer - -class SafeDSCrossReferenceSerializer : CrossReferenceSerializer() { - - override fun getCrossReferenceNameFromScope( - semanticObject: EObject, - crossref: CrossReference, - target: EObject, - scope: IScope, - errors: ISerializationDiagnostic.Acceptor?, - ): String { - return when (target) { - is SdsAbstractDeclaration -> target.name - else -> super.getCrossReferenceNameFromScope(semanticObject, crossref, target, scope, errors) - } - } - - override fun isValid( - semanticObject: EObject, - crossref: CrossReference, - target: EObject, - node: INode, - errors: ISerializationDiagnostic.Acceptor?, - ): Boolean { - return target is SdsAbstractDeclaration - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSHiddenTokenSequencer.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSHiddenTokenSequencer.kt deleted file mode 100644 index 465130c5f..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSHiddenTokenSequencer.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.larsreimann.safeds.serializer - -import com.google.inject.Inject -import com.larsreimann.safeds.services.SafeDSGrammarAccess -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.RuleCall -import org.eclipse.xtext.nodemodel.ICompositeNode -import org.eclipse.xtext.serializer.sequencer.HiddenTokenSequencer - -@Suppress("unused") -class SafeDSHiddenTokenSequencer @Inject constructor( - private val grammarAccess: SafeDSGrammarAccess, -) : HiddenTokenSequencer() { - - override fun enterAssignedParserRuleCall(rc: RuleCall, semanticChild: EObject, node: ICompositeNode?): Boolean { - semanticChild.eAdapters() - .filterIsInstance() - .forEach { - val rule = when (it) { - is SingleLineCommentAdapter -> grammarAccess.sL_COMMENTRule - is MultiLineCommentAdapter -> grammarAccess.mL_COMMENTRule - } - delegate.acceptComment(rule, it.toString(), null) - } - return super.enterAssignedParserRuleCall(rc, semanticChild, node) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSSemanticSequencer.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSSemanticSequencer.kt deleted file mode 100644 index 1cf33c9ce..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSSemanticSequencer.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.larsreimann.safeds.serializer - -internal class SafeDSSemanticSequencer : AbstractSafeDSSemanticSequencer() diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSSyntacticSequencer.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSSyntacticSequencer.kt deleted file mode 100644 index f7c9a290a..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SafeDSSyntacticSequencer.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.larsreimann.safeds.serializer - -class SafeDSSyntacticSequencer : AbstractSafeDSSyntacticSequencer() diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SerializerExtensions.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SerializerExtensions.kt deleted file mode 100644 index 5653b20bd..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/serializer/SerializerExtensions.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.larsreimann.safeds.serializer - -import com.google.inject.Inject -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.xtext.resource.SaveOptions -import org.eclipse.xtext.serializer.impl.Serializer - -internal object SerializerExtensionsInjectionTarget { - - @Inject - lateinit var serializer: Serializer -} - -private val WithFormatting = SaveOptions.newBuilder().format().options - -/** - * Serializes a subtree of the EMF model and applies the formatter to it. This only works if the [EObject] is part of a - * [Resource]. - * - * @receiver The root of the subtree. - * @return A result object indicating success or failure. - */ -fun EObject.serializeToFormattedString(): SerializationResult { - if (this.eResource() == null) { - return SerializationResult.NotInResourceFailure - } - - return try { - val code = SerializerExtensionsInjectionTarget.serializer - .serialize(this, WithFormatting) - .trim() - .replace(System.lineSeparator(), "\n") - - SerializationResult.Success(code) - } catch (e: RuntimeException) { - SerializationResult.WrongEmfModelStructureFailure(e.message ?: "") - } -} - -/** - * Result of calling [serializeToFormattedString]. - */ -sealed interface SerializationResult { - - /** - * Serialization was successful. - * - * @param code The created DSL code. - */ - class Success(val code: String) : SerializationResult - - /** - * Something went wrong while serializing the [EObject]. - */ - sealed interface Failure : SerializationResult { - - /** - * A message that describes the failure. - */ - val message: String - } - - /** - * The [EObject] is not part of a [Resource] and cannot be serialized. - */ - object NotInResourceFailure : Failure { - override val message: String - get() = "The EObject is not part of a Resource and cannot be serialized." - } - - /** - * The EMF model is not configured correctly. - */ - class WrongEmfModelStructureFailure(override val message: String) : Failure -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/AssigneeToValue.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/AssigneeToValue.kt deleted file mode 100644 index 26330d018..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/AssigneeToValue.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis - -import com.larsreimann.safeds.emf.assigneesOrEmpty -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsCall - -fun SdsAbstractAssignee.assignedOrNull(): SdsAbstractObject? { - return when (val maybeAssigned = this.maybeAssigned()) { - is AssignedResult.Assigned -> maybeAssigned.assigned - else -> null - } -} - -sealed interface AssignedResult { - object Unresolved : AssignedResult - object NotAssigned : AssignedResult - sealed class Assigned : AssignedResult { - abstract val assigned: SdsAbstractObject - } - - class AssignedExpression(override val assigned: SdsAbstractExpression) : Assigned() - class AssignedDeclaration(override val assigned: SdsAbstractObject) : Assigned() -} - -fun SdsAbstractAssignee.maybeAssigned(): AssignedResult { - val assignment = this.closestAncestorOrNull() ?: return AssignedResult.Unresolved - val expression = assignment.expression ?: return AssignedResult.NotAssigned - - val thisIndex = assignment.assigneeList.assignees.indexOf(this) - return when (expression) { - is SdsCall -> { - val results = expression.resultsOrNull() ?: return AssignedResult.Unresolved - val result = results.getOrNull(thisIndex) ?: return AssignedResult.NotAssigned - AssignedResult.AssignedDeclaration(result) - } - else -> when (thisIndex) { - 0 -> AssignedResult.AssignedExpression(expression) - else -> AssignedResult.NotAssigned - } - } -} - -fun SdsAbstractAssignee.indexOrNull(): Int? { - val assignment = closestAncestorOrNull() ?: return null - return assignment.assigneesOrEmpty().indexOf(this) -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/CallToCallable.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/CallToCallable.kt deleted file mode 100644 index f592e7b3f..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/CallToCallable.kt +++ /dev/null @@ -1,116 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis - -import com.larsreimann.safeds.emf.blockLambdaResultsOrEmpty -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractCallable -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import org.eclipse.emf.ecore.EObject - -fun SdsCall.callableOrNull(): SdsAbstractCallable? { - return when (val maybeCallable = this.maybeCallable()) { - is CallableResult.Callable -> maybeCallable.callable - else -> null - } -} - -sealed interface CallableResult { - object Unresolvable : CallableResult - object NotCallable : CallableResult - class Callable(val callable: SdsAbstractCallable) : CallableResult -} - -fun SdsCall.maybeCallable(): CallableResult { - val visited = mutableSetOf() - var current: EObject? = this.receiver - while (current != null && current !in visited) { - visited += current - - current = when { - current.eIsProxy() -> return CallableResult.Unresolvable - current is SdsAbstractCallable -> return CallableResult.Callable(current) - current is SdsCall -> { - val results = current.resultsOrNull() - if (results == null || results.size != 1) { - return CallableResult.Unresolvable - } - - results.first() - } - current is SdsAbstractAssignee -> current.assignedOrNull() - current is SdsMemberAccess -> current.member.declaration - current is SdsParameter -> return when (val typeOrNull = current.type) { - null -> CallableResult.Unresolvable - is SdsCallableType -> CallableResult.Callable(typeOrNull) - else -> CallableResult.NotCallable - } - current is SdsParenthesizedExpression -> current.expression - current is SdsReference -> current.declaration - current is SdsResult -> return when (val typeOrNull = current.type) { - null -> CallableResult.Unresolvable - is SdsCallableType -> CallableResult.Callable(typeOrNull) - else -> CallableResult.NotCallable - } - current is SdsPredicate -> return CallableResult.Callable(current) - else -> return CallableResult.NotCallable - } - } - - return CallableResult.Unresolvable -} - -/** - * Returns the list of [SdsParameter]s of the called callable or `null` if it cannot be resolved. - */ -fun SdsCall.parametersOrNull(): List? { - return callableOrNull()?.parametersOrEmpty() -} - -/** - * Returns the list of [SdsAbstractObject]s that are returned by the called callable or `null` if it cannot be resolved. - * Possible types depend on the called callable: - * - [SdsBlockLambda] -> [SdsBlockLambdaResult] - * - [SdsCallableType] -> [SdsResult] - * - [SdsClass] -> [SdsClass] - * - [SdsEnumVariant] -> [SdsEnumVariant] - * - [SdsExpressionLambda] -> [SdsAbstractExpression] - * - [SdsFunction] -> [SdsResult] - * - [SdsStep] -> [SdsResult] - */ -@OptIn(ExperimentalSdsApi::class) -fun SdsCall.resultsOrNull(): List? { - return when (val callable = this.callableOrNull()) { - is SdsBlockLambda -> callable.blockLambdaResultsOrEmpty() - is SdsCallableType -> callable.resultsOrEmpty() - is SdsClass -> listOf(callable) - is SdsEnumVariant -> listOf(callable) - is SdsExpressionLambda -> listOf(callable.result) - is SdsFunction -> callable.resultsOrEmpty() - is SdsPredicate -> callable.resultsOrEmpty() - is SdsStep -> callable.resultsOrEmpty() - else -> null - } -} - -sealed interface ResultsResult { - object Unresolved : ResultsResult - object NotCallable : ResultsResult -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/LocalDeclarationToReferences.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/LocalDeclarationToReferences.kt deleted file mode 100644 index 8713268d8..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/LocalDeclarationToReferences.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis - -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.placeholdersOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsAbstractStatement -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsReference - -fun SdsParameter.usesIn(obj: SdsAbstractObject): Sequence { - return obj - .descendants() - .filter { it.declaration == this } -} - -fun SdsPlaceholder.usesIn(obj: SdsAbstractObject): Sequence { - return obj - .descendants() - .dropWhile { it !is SdsAssignment || this !in it.placeholdersOrEmpty() } - .drop(1) - .flatMap { it.descendants() } - .filter { it.declaration == this } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/Recursion.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/Recursion.kt deleted file mode 100644 index 20d8400f4..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/Recursion.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis - -import com.larsreimann.safeds.emf.containingCallableOrNull -import com.larsreimann.safeds.emf.immediateCalls -import com.larsreimann.safeds.safeDS.SdsAbstractCallable -import com.larsreimann.safeds.safeDS.SdsCall - -/** - * Returns whether this call might lead to recursion. - */ -fun SdsCall.isRecursive(): Boolean { - val visited = buildSet { - val containingCallable = containingCallableOrNull() - if (containingCallable != null) { - add(containingCallable) - } - } - - return isRecursive(visited) -} - -/** - * Returns whether this call might lead to recursion. - */ -private fun SdsCall.isRecursive(visited: Set): Boolean { - return when (val callable = this.callableOrNull()) { - is SdsAbstractCallable -> { - callable in visited || callable.immediateCalls().any { - it.isRecursive(visited + callable) - } - } - else -> false - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/SideEffects.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/SideEffects.kt deleted file mode 100644 index 03bef6edf..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/SideEffects.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis - -import com.larsreimann.safeds.emf.assigneesOrEmpty -import com.larsreimann.safeds.emf.immediateCalls -import com.larsreimann.safeds.safeDS.SdsAbstractCallable -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsAbstractLambda -import com.larsreimann.safeds.safeDS.SdsAbstractStatement -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsWildcard -import com.larsreimann.safeds.stdlibAccess.hasNoSideEffects - -/** - * Whether this [SdsAbstractStatement] has no side effects and, thus, can be removed. - * - * @param resultIfUnknown What to return if neither purity nor impurity can be proven. Note that external functions are - * still always assumed to have side effects unless they are marked with `@Pure` or `@NoSideEffects. - */ -fun SdsAbstractStatement.statementHasNoSideEffects(resultIfUnknown: Boolean = false): Boolean { - return when (this) { - is SdsAssignment -> { - assigneesOrEmpty().all { it is SdsWildcard } && expression.expressionHasNoSideEffects(resultIfUnknown) - } - is SdsExpressionStatement -> { - expression.expressionHasNoSideEffects(resultIfUnknown) - } - else -> { - throw IllegalArgumentException("Missing case to handle statement $this.") - } - } -} - -/** - * Whether this [SdsAbstractExpression] has no side effects and, thus, can be removed. - * - * @param resultIfUnknown What to return if neither purity nor impurity can be proven. Note that external functions are - * still always assumed to have side effects unless they are marked with `@Pure` or `@NoSideEffects. - */ -fun SdsAbstractExpression.expressionHasNoSideEffects(resultIfUnknown: Boolean = false): Boolean { - return when (this) { - is SdsCall -> !isRecursive() && callableOrNull().callableHasNoSideEffects(resultIfUnknown) - else -> true - } -} - -/** - * Whether this [SdsAbstractCallable] has no side effects, so calls to this can be removed. - * - * @param resultIfUnknown What to return if neither purity nor impurity can be proven. Note that external functions are - * still always assumed to have side effects unless they are marked with `@Pure` or `@NoSideEffects. - */ -fun SdsAbstractCallable?.callableHasNoSideEffects(resultIfUnknown: Boolean = false): Boolean { - return when (this) { - null -> resultIfUnknown - - is SdsAbstractLambda -> immediateCalls().all { it.expressionHasNoSideEffects(resultIfUnknown) } - is SdsStep -> immediateCalls().all { it.expressionHasNoSideEffects(resultIfUnknown) } - - is SdsCallableType -> resultIfUnknown - is SdsClass -> true - is SdsEnumVariant -> true - is SdsFunction -> hasNoSideEffects() - // TODO: Correct? - is SdsPredicate -> false - - else -> throw IllegalArgumentException("Cannot handle callable of type '${this::class.simpleName}'.") - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/classHierarchy/ClassHierarchy.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/classHierarchy/ClassHierarchy.kt deleted file mode 100644 index fabc2b23d..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/classHierarchy/ClassHierarchy.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.classHierarchy - -import com.larsreimann.safeds.emf.classMembersOrEmpty -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.parentTypesOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.stdlibAccess.getStdlibClassOrNull -import com.larsreimann.safeds.utils.uniqueOrNull - -fun SdsClass.isSubtypeOf(other: SdsClass) = - this == this.getStdlibClassOrNull(StdlibClasses.Nothing) || - this == other || other in superClasses() - -fun SdsClass.superClasses() = sequence { - val visited = mutableSetOf() - - // TODO: multiple parent classes - var current = parentClassOrNull() - while (current != null && current !in visited) { - yield(current) - visited += current - current = current.parentClassOrNull() - } - - val anyClass = this@superClasses.getStdlibClassOrNull(StdlibClasses.Any) - if (anyClass != null && this@superClasses != anyClass && visited.lastOrNull() != anyClass) { - yield(anyClass) - } -} - -fun SdsClass.superClassMembers() = - this.superClasses().flatMap { it.classMembersOrEmpty().asSequence() } - -// TODO only static methods can be hidden -fun SdsFunction.hiddenFunction(): SdsFunction? { - val containingClassOrInterface = closestAncestorOrNull() ?: return null - return containingClassOrInterface.superClassMembers() - .filterIsInstance() - .firstOrNull { it.name == name } -} - -fun SdsClass?.inheritedNonStaticMembersOrEmpty(): Set { - return this?.parentClassesOrEmpty() - ?.flatMap { it.classMembersOrEmpty() } - ?.filter { it is SdsAttribute && !it.isStatic || it is SdsFunction && !it.isStatic } - ?.toSet() - .orEmpty() -} - -fun SdsClass?.parentClassesOrEmpty(): List { - return this.parentTypesOrEmpty().mapNotNull { - (it.type() as? ClassType)?.sdsClass - } -} - -fun SdsClass?.parentClassOrNull(): SdsClass? { - return this.parentClassesOrEmpty().uniqueOrNull() -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ArgumentToParameter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ArgumentToParameter.kt deleted file mode 100644 index ece70bf3d..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ArgumentToParameter.kt +++ /dev/null @@ -1,47 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.linking - -import com.larsreimann.safeds.emf.asResolvedOrNull -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.isNamed -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsArgumentList -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.staticAnalysis.parametersOrNull - -/** - * Returns the [SdsParameter] that corresponds to this [SdsArgument] or `null` if it cannot be resolved. - */ -fun SdsArgument.parameterOrNull(): SdsParameter? { - return when { - isNamed() -> parameter.asResolvedOrNull() - else -> { - val argumentList = closestAncestorOrNull() ?: return null - val parameters = argumentList.parametersOrNull() ?: return null - val lastParameter = parameters.lastOrNull() - - val firstNamedArgumentIndex = argumentList.arguments.indexOfFirst { it.isNamed() } - val thisIndex = argumentList.arguments.indexOf(this) - - return when { - lastParameter?.isVariadic == true && thisIndex >= parameters.size - 1 -> lastParameter - firstNamedArgumentIndex != -1 && thisIndex > firstNamedArgumentIndex -> null - else -> parameters.getOrNull(thisIndex) - } - } - } -} - -/** - * Returns the list of [SdsParameter]s that corresponds to this list of [SdsArgument]s or `null` if it cannot be - * resolved. - */ -fun SdsArgumentList.parametersOrNull(): List? { - return when (val parent = this.eContainer()) { - is SdsAnnotationCall -> parent.annotation.asResolvedOrNull()?.parametersOrEmpty() - is SdsCall -> parent.parametersOrNull() - else -> null - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ResultToYield.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ResultToYield.kt deleted file mode 100644 index fc8eb0292..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ResultToYield.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.linking - -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.yieldsOrEmpty -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsResultList -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.utils.uniqueOrNull - -/** - * Returns the unique [SdsYield] that corresponds to this [SdsResult] or `null` if no or multiple [SdsYield]s exist. - * Note that an [SdsYield] can only be used inside an [SdsStep], so this will always return `null` for [SdsResult]s that - * are not inside an [SdsStep]. - */ -fun SdsResult.uniqueYieldOrNull(): SdsYield? { - return yieldsOrEmpty().uniqueOrNull() -} - -/** - * Returns all [SdsYield]s that corresponds to this [SdsResult]. Note that an [SdsYield] can only be used inside an - * [SdsStep], so this will always return an empty list for [SdsResult]s that are not inside an [SdsStep]. - */ -fun SdsResult.yieldsOrEmpty(): List { - val resultList = closestAncestorOrNull() ?: return emptyList() - val step = resultList.eContainer() as? SdsStep ?: return emptyList() - - return step.yieldsOrEmpty().filter { it.result == this } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/TypeArgumentToTypeParameter.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/TypeArgumentToTypeParameter.kt deleted file mode 100644 index afb68b0cb..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/linking/TypeArgumentToTypeParameter.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.linking - -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.isNamed -import com.larsreimann.safeds.emf.isResolved -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeArgumentList -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.staticAnalysis.callableOrNull - -/** - * Returns the [SdsTypeParameter] that corresponds to this [SdsTypeArgument] or `null` if it cannot be resolved. - */ -fun SdsTypeArgument.typeParameterOrNull(): SdsTypeParameter? { - return when { - this.isNamed() -> typeParameter - else -> { - val typeArgumentList = closestAncestorOrNull() ?: return null - - // Cannot match positional type argument if it is preceded by named type arguments - val firstNamedTypeArgumentIndex = typeArgumentList.typeArguments.indexOfFirst { it.isNamed() } - val thisIndex = typeArgumentList.typeArguments.indexOf(this) - if (firstNamedTypeArgumentIndex != -1 && thisIndex > firstNamedTypeArgumentIndex) { - return null - } - - typeArgumentList.typeParametersOrNull()?.getOrNull(thisIndex) - } - } -} - -/** - * Returns the list of [SdsTypeParameter]s that corresponds to this list of [SdsTypeArgument]s or `null` if it cannot - * not be resolved. - */ -fun SdsTypeArgumentList.typeParametersOrNull(): List? { - return when (val parent = eContainer()) { - is SdsCall -> { - when (val callable = parent.callableOrNull()) { - is SdsClass -> callable.typeParametersOrEmpty() - is SdsEnumVariant -> callable.typeParametersOrEmpty() - is SdsFunction -> callable.typeParametersOrEmpty() - is SdsPredicate -> callable.typeParametersOrEmpty() - else -> null - } - } - is SdsNamedType -> { - val declaration = parent.declaration - when { - !declaration.isResolved() -> null - declaration is SdsClass -> declaration.typeParametersOrEmpty() - declaration is SdsEnumVariant -> declaration.typeParametersOrEmpty() - else -> null - } - } - else -> null - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/SdsSimplifiedExpression.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/SdsSimplifiedExpression.kt deleted file mode 100644 index 54425d8db..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/SdsSimplifiedExpression.kt +++ /dev/null @@ -1,111 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.partialEvaluation - -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsAbstractResult -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult - -typealias ParameterSubstitutions = Map - -sealed interface SdsSimplifiedExpression - -internal sealed interface SdsIntermediateExpression : SdsSimplifiedExpression - -internal sealed interface SdsIntermediateCallable : SdsIntermediateExpression { - val parameters: List -} - -internal data class SdsIntermediateBlockLambda( - override val parameters: List, - val results: List, - val substitutionsOnCreation: ParameterSubstitutions -) : SdsIntermediateCallable - -internal data class SdsIntermediateExpressionLambda( - override val parameters: List, - val result: SdsAbstractExpression, - val substitutionsOnCreation: ParameterSubstitutions -) : SdsIntermediateCallable - -internal data class SdsIntermediateStep( - override val parameters: List, - val results: List -) : SdsIntermediateCallable - -internal class SdsIntermediateRecord( - resultSubstitutions: List> -) : SdsIntermediateExpression { - private val resultSubstitutions = resultSubstitutions.toMap() - - fun getSubstitutionByReferenceOrNull(reference: SdsReference): SdsSimplifiedExpression? { - val result = reference.declaration as? SdsAbstractResult ?: return null - return resultSubstitutions[result] - } - - fun getSubstitutionByIndexOrNull(index: Int?): SdsSimplifiedExpression? { - if (index == null) { - return null - } - return resultSubstitutions.values.toList().getOrNull(index) - } - - /** - * If the record contains exactly one substitution its value is returned. Otherwise, it returns `this`. - */ - fun unwrap(): SdsSimplifiedExpression? { - return when (resultSubstitutions.size) { - 1 -> resultSubstitutions.values.first() - else -> this - } - } - - override fun toString(): String { - return resultSubstitutions.entries.joinToString(prefix = "{", postfix = "}") { (result, value) -> - "${result.name}=$value" - } - } -} - -data class SdsIntermediateVariadicArguments( - private val arguments: List -) : SdsSimplifiedExpression { - fun getArgumentByIndexOrNull(index: Int?): SdsSimplifiedExpression? { - if (index == null) { - return null - } - return arguments.getOrNull(index) - } -} - -sealed interface SdsConstantExpression : SdsSimplifiedExpression - -data class SdsConstantBoolean(val value: Boolean) : SdsConstantExpression { - override fun toString(): String = value.toString() -} - -data class SdsConstantEnumVariant(val value: SdsEnumVariant) : SdsConstantExpression { - override fun toString(): String = value.name -} - -sealed class SdsConstantNumber : SdsConstantExpression { - abstract val value: Number -} - -data class SdsConstantFloat(override val value: Double) : SdsConstantNumber() { - override fun toString(): String = value.toString() -} - -data class SdsConstantInt(override val value: Int) : SdsConstantNumber() { - override fun toString(): String = value.toString() -} - -object SdsConstantNull : SdsConstantExpression { - override fun toString(): String = "null" -} - -data class SdsConstantString(val value: String) : SdsConstantExpression { - override fun toString(): String = value -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/ToConstantExpression.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/ToConstantExpression.kt deleted file mode 100644 index 12993cb14..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/ToConstantExpression.kt +++ /dev/null @@ -1,409 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.partialEvaluation - -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.And -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.By -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Elvis -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Equals -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.GreaterThan -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.GreaterThanOrEquals -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.IdenticalTo -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.LessThan -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.LessThanOrEquals -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.NotEquals -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.NotIdenticalTo -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Or -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Plus -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Times -import com.larsreimann.safeds.constant.SdsPrefixOperationOperator.Not -import com.larsreimann.safeds.constant.operator -import com.larsreimann.safeds.emf.argumentsOrEmpty -import com.larsreimann.safeds.emf.blockLambdaResultsOrEmpty -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.isOptional -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBoolean -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsFloat -import com.larsreimann.safeds.safeDS.SdsIndexedAccess -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.safeDS.SdsInt -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsNull -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPrefixOperation -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsString -import com.larsreimann.safeds.safeDS.SdsTemplateString -import com.larsreimann.safeds.safeDS.SdsTemplateStringEnd -import com.larsreimann.safeds.safeDS.SdsTemplateStringInner -import com.larsreimann.safeds.safeDS.SdsTemplateStringStart -import com.larsreimann.safeds.staticAnalysis.callableHasNoSideEffects -import com.larsreimann.safeds.staticAnalysis.indexOrNull -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.uniqueYieldOrNull -import com.larsreimann.safeds.utils.uniqueOrNull -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Minus as InfixMinus -import com.larsreimann.safeds.constant.SdsPrefixOperationOperator.Minus as PrefixMinus - -/** - * Tries to evaluate this expression. On success a [SdsConstantExpression] is returned, otherwise `null`. - */ -fun SdsAbstractExpression.toConstantExpressionOrNull(): SdsConstantExpression? { - return toConstantExpressionOrNull(emptyMap()) -} - -internal fun SdsAbstractExpression.toConstantExpressionOrNull(substitutions: ParameterSubstitutions): SdsConstantExpression? { - return when (val simplifiedExpression = simplify(substitutions)) { - is SdsConstantExpression? -> simplifiedExpression - is SdsIntermediateRecord -> simplifiedExpression.unwrap() as? SdsConstantExpression - else -> null - } -} - -internal fun SdsAbstractExpression.simplify(substitutions: ParameterSubstitutions): SdsSimplifiedExpression? { - return when (this) { - - // Base cases - is SdsBoolean -> SdsConstantBoolean(isTrue) - is SdsFloat -> SdsConstantFloat(value) - is SdsInt -> SdsConstantInt(value) - is SdsNull -> SdsConstantNull - is SdsString -> SdsConstantString(value) - is SdsTemplateStringStart -> SdsConstantString(value) - is SdsTemplateStringInner -> SdsConstantString(value) - is SdsTemplateStringEnd -> SdsConstantString(value) - is SdsBlockLambda -> simplifyBlockLambda(substitutions) - is SdsExpressionLambda -> simplifyExpressionLambda(substitutions) - - // Simple recursive cases - is SdsArgument -> value.simplify(substitutions) - is SdsInfixOperation -> simplifyInfixOp(substitutions) - is SdsParenthesizedExpression -> expression.simplify(substitutions) - is SdsPrefixOperation -> simplifyPrefixOp(substitutions) - is SdsTemplateString -> simplifyTemplateString(substitutions) - - // Complex recursive cases - is SdsCall -> simplifyCall(substitutions) - is SdsIndexedAccess -> simplifyIndexedAccess(substitutions) - is SdsMemberAccess -> simplifyMemberAccess(substitutions) - is SdsReference -> simplifyReference(substitutions) - - // Warn if case is missing - else -> throw IllegalArgumentException("Missing case to handle $this.") - } -} - -private fun SdsBlockLambda.simplifyBlockLambda(substitutions: ParameterSubstitutions): SdsIntermediateBlockLambda? { - return when { - callableHasNoSideEffects(resultIfUnknown = true) -> SdsIntermediateBlockLambda( - parameters = parametersOrEmpty(), - results = blockLambdaResultsOrEmpty(), - substitutionsOnCreation = substitutions - ) - else -> null - } -} - -private fun SdsExpressionLambda.simplifyExpressionLambda( - substitutions: ParameterSubstitutions -): SdsIntermediateExpressionLambda? { - return when { - callableHasNoSideEffects(resultIfUnknown = true) -> SdsIntermediateExpressionLambda( - parameters = parametersOrEmpty(), - result = result, - substitutionsOnCreation = substitutions - ) - else -> null - } -} - -private fun SdsInfixOperation.simplifyInfixOp(substitutions: ParameterSubstitutions): SdsConstantExpression? { - - // By design none of the operators are short-circuited - val constantLeft = leftOperand.toConstantExpressionOrNull(substitutions) ?: return null - val constantRight = rightOperand.toConstantExpressionOrNull(substitutions) ?: return null - - return when (operator()) { - Or -> simplifyLogicalOp(constantLeft, Boolean::or, constantRight) - And -> simplifyLogicalOp(constantLeft, Boolean::and, constantRight) - Equals -> SdsConstantBoolean(constantLeft == constantRight) - NotEquals -> SdsConstantBoolean(constantLeft != constantRight) - IdenticalTo -> SdsConstantBoolean(constantLeft == constantRight) - NotIdenticalTo -> SdsConstantBoolean(constantLeft != constantRight) - LessThan -> simplifyComparisonOp( - constantLeft, - { a, b -> a < b }, - { a, b -> a < b }, - constantRight - ) - LessThanOrEquals -> simplifyComparisonOp( - constantLeft, - { a, b -> a <= b }, - { a, b -> a <= b }, - constantRight - ) - GreaterThanOrEquals -> simplifyComparisonOp( - constantLeft, - { a, b -> a >= b }, - { a, b -> a >= b }, - constantRight - ) - GreaterThan -> simplifyComparisonOp( - constantLeft, - { a, b -> a > b }, - { a, b -> a > b }, - constantRight - ) - Plus -> simplifyArithmeticOp( - constantLeft, - { a, b -> a + b }, - { a, b -> a + b }, - constantRight - ) - InfixMinus -> simplifyArithmeticOp( - constantLeft, - { a, b -> a - b }, - { a, b -> a - b }, - constantRight - ) - Times -> simplifyArithmeticOp( - constantLeft, - { a, b -> a * b }, - { a, b -> a * b }, - constantRight - ) - By -> { - if (constantRight == SdsConstantFloat(0.0) || constantRight == SdsConstantInt(0)) { - return null - } - - simplifyArithmeticOp( - constantLeft, - { a, b -> a / b }, - { a, b -> a / b }, - constantRight - ) - } - Elvis -> when (constantLeft) { - SdsConstantNull -> constantRight - else -> constantLeft - } - } -} - -private fun simplifyLogicalOp( - leftOperand: SdsConstantExpression, - operation: (Boolean, Boolean) -> Boolean, - rightOperand: SdsConstantExpression, -): SdsConstantExpression? { - - return when { - leftOperand is SdsConstantBoolean && rightOperand is SdsConstantBoolean -> { - SdsConstantBoolean(operation(leftOperand.value, rightOperand.value)) - } - else -> null - } -} - -private fun simplifyComparisonOp( - leftOperand: SdsConstantExpression, - doubleOperation: (Double, Double) -> Boolean, - intOperation: (Int, Int) -> Boolean, - rightOperand: SdsConstantExpression, -): SdsConstantExpression? { - - return when { - leftOperand is SdsConstantInt && rightOperand is SdsConstantInt -> { - SdsConstantBoolean(intOperation(leftOperand.value, rightOperand.value)) - } - leftOperand is SdsConstantNumber && rightOperand is SdsConstantNumber -> { - SdsConstantBoolean(doubleOperation(leftOperand.value.toDouble(), rightOperand.value.toDouble())) - } - else -> null - } -} - -private fun simplifyArithmeticOp( - leftOperand: SdsConstantExpression, - doubleOperation: (Double, Double) -> Double, - intOperation: (Int, Int) -> Int, - rightOperand: SdsConstantExpression, -): SdsConstantExpression? { - - return when { - leftOperand is SdsConstantInt && rightOperand is SdsConstantInt -> { - SdsConstantInt(intOperation(leftOperand.value, rightOperand.value)) - } - leftOperand is SdsConstantNumber && rightOperand is SdsConstantNumber -> { - SdsConstantFloat(doubleOperation(leftOperand.value.toDouble(), rightOperand.value.toDouble())) - } - else -> null - } -} - -private fun SdsPrefixOperation.simplifyPrefixOp(substitutions: ParameterSubstitutions): SdsConstantExpression? { - val constantOperand = operand.toConstantExpressionOrNull(substitutions) ?: return null - - return when (operator()) { - Not -> when (constantOperand) { - is SdsConstantBoolean -> SdsConstantBoolean(!constantOperand.value) - else -> null - } - PrefixMinus -> when (constantOperand) { - is SdsConstantFloat -> SdsConstantFloat(-constantOperand.value) - is SdsConstantInt -> SdsConstantInt(-constantOperand.value) - else -> null - } - } -} - -private fun SdsTemplateString.simplifyTemplateString(substitutions: ParameterSubstitutions): SdsConstantExpression? { - val constExpressions = expressions.map { - it.toConstantExpressionOrNull(substitutions) ?: return null - } - - return SdsConstantString(constExpressions.joinToString("")) -} - -private fun SdsCall.simplifyCall(substitutions: ParameterSubstitutions): SdsSimplifiedExpression? { - val simpleReceiver = simplifyReceiver(substitutions) ?: return null - val newSubstitutions = buildNewSubstitutions(simpleReceiver, substitutions) - - return when (simpleReceiver) { - is SdsIntermediateBlockLambda -> { - SdsIntermediateRecord( - simpleReceiver.results.map { - it to it.simplifyAssignee(newSubstitutions) - } - ) - } - is SdsIntermediateExpressionLambda -> simpleReceiver.result.simplify(newSubstitutions) - is SdsIntermediateStep -> { - SdsIntermediateRecord( - simpleReceiver.results.map { - it to it.uniqueYieldOrNull()?.simplifyAssignee(newSubstitutions) - } - ) - } - } -} - -private fun SdsCall.simplifyReceiver(substitutions: ParameterSubstitutions): SdsIntermediateCallable? { - return when (val simpleReceiver = receiver.simplify(substitutions)) { - is SdsIntermediateRecord -> simpleReceiver.unwrap() as? SdsIntermediateCallable - is SdsIntermediateCallable -> simpleReceiver - else -> return null - } -} - -private fun SdsCall.buildNewSubstitutions( - simpleReceiver: SdsIntermediateCallable, - oldSubstitutions: ParameterSubstitutions -): ParameterSubstitutions { - - val substitutionsOnCreation = when (simpleReceiver) { - is SdsIntermediateBlockLambda -> simpleReceiver.substitutionsOnCreation - is SdsIntermediateExpressionLambda -> simpleReceiver.substitutionsOnCreation - else -> emptyMap() - } - - val substitutionsOnCall = argumentsOrEmpty() - .groupBy { it.parameterOrNull() } - .mapValues { (parameter, arguments) -> - when { - parameter == null -> null - parameter.isVariadic -> SdsIntermediateVariadicArguments( - arguments.map { it.simplify(oldSubstitutions) } - ) - else -> arguments.uniqueOrNull()?.simplify(oldSubstitutions) - } - } - - return buildMap { - putAll(substitutionsOnCreation) - substitutionsOnCall.entries.forEach { (parameter, argument) -> - if (parameter != null) { - put(parameter, argument) - } - } - } -} - -private fun SdsIndexedAccess.simplifyIndexedAccess(substitutions: ParameterSubstitutions): SdsSimplifiedExpression? { - val simpleReceiver = receiver.simplify(substitutions) as? SdsIntermediateVariadicArguments ?: return null - val simpleIndex = index.simplify(substitutions) as? SdsConstantInt ?: return null - - return simpleReceiver.getArgumentByIndexOrNull(simpleIndex.value) -} - -private fun SdsMemberAccess.simplifyMemberAccess(substitutions: ParameterSubstitutions): SdsSimplifiedExpression? { - if (member.declaration is SdsEnumVariant) { - return member.simplifyReference(substitutions) - } - - return when (val simpleReceiver = receiver.simplify(substitutions)) { - SdsConstantNull -> when { - isNullSafe -> SdsConstantNull - else -> null - } - is SdsIntermediateRecord -> simpleReceiver.getSubstitutionByReferenceOrNull(member) - else -> null - } -} - -private fun SdsReference.simplifyReference(substitutions: ParameterSubstitutions): SdsSimplifiedExpression? { - return when (val declaration = this.declaration) { - is SdsEnumVariant -> when { - declaration.parametersOrEmpty().isEmpty() -> SdsConstantEnumVariant(declaration) - else -> null - } - is SdsPlaceholder -> declaration.simplifyAssignee(substitutions) - is SdsParameter -> declaration.simplifyParameter(substitutions) - is SdsStep -> declaration.simplifyStep() - else -> null - } -} - -private fun SdsAbstractAssignee.simplifyAssignee(substitutions: ParameterSubstitutions): SdsSimplifiedExpression? { - val simpleFullAssignedExpression = closestAncestorOrNull() - ?.expression - ?.simplify(substitutions) - ?: return null - - return when (simpleFullAssignedExpression) { - is SdsIntermediateRecord -> simpleFullAssignedExpression.getSubstitutionByIndexOrNull(indexOrNull()) - else -> when { - indexOrNull() == 0 -> simpleFullAssignedExpression - else -> null - } - } -} - -private fun SdsParameter.simplifyParameter(substitutions: ParameterSubstitutions): SdsSimplifiedExpression? { - return when { - this in substitutions -> substitutions[this] - isOptional() -> defaultValue?.simplify(substitutions) - else -> null - } -} - -private fun SdsStep.simplifyStep(): SdsIntermediateStep? { - return when { - callableHasNoSideEffects(resultIfUnknown = true) -> SdsIntermediateStep( - parameters = parametersOrEmpty(), - results = resultsOrEmpty() - ) - else -> null - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaComputer.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaComputer.kt deleted file mode 100644 index 78f2c766b..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaComputer.kt +++ /dev/null @@ -1,279 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.schema - -import com.larsreimann.safeds.constant.hasSchemaKind -import com.larsreimann.safeds.emf.argumentsOrEmpty -import com.larsreimann.safeds.emf.assigneesOrEmpty -import com.larsreimann.safeds.emf.assignmentsOrEmpty -import com.larsreimann.safeds.emf.constraintStatementsOrEmpty -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.typeArgumentsOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractNamedTypeDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractStatement -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsSchemaYield -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.staticAnalysis.callableOrNull -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.typeParameterOrNull -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.naming.QualifiedName - -fun inferSchema( - statement: SdsAbstractStatement, - pipelineContext: MutableMap, -): MutableMap { - val mainFunCall: SdsCall = when (statement) { - is SdsExpressionStatement -> statement.expression as? SdsCall ?: return mutableMapOf() - is SdsAssignment -> statement.expression as? SdsCall ?: return mutableMapOf() - else -> return mutableMapOf() - } - - // for the chain of calls - val (firstCaller, calls) = firstReceiverAndCallChain(mainFunCall) - - val pipelineContextMapped = pipelineContext.mapKeys { - val schemaOwner = it.key as? SchemaOwner - val schemaResult = it.value - - if (schemaOwner is SchemaOwner.Assignee && schemaOwner.assignee == firstCaller) { - if (schemaResult !is SchemaResult.Schema) { - return mutableMapOf() // there is no current schema - } else { - return@mapKeys SchemaOwner.CurrentCaller - } - } - - it.key - }.toMutableMap() - - var schemaOwnerToTypeParameter: Map? = null - - if (statement is SdsAssignment) { - schemaOwnerToTypeParameter = getSchemaOwnerToTypeParameterMap(statement) - - if (schemaOwnerToTypeParameter.isEmpty()) { - return mutableMapOf() - } - } - - var yieldedSchemasMap: Map = emptyMap() - - for (call in calls.reversed()) { - val function = call.callableOrNull() as? SdsFunction ?: return mutableMapOf() - val maybeResult = inferSchema(function, call, pipelineContextMapped) - - yieldedSchemasMap = when (maybeResult) { - is SchemaResult.FunctionResult -> maybeResult.schemaResults - else -> emptyMap() - } - - if (yieldedSchemasMap.count() == 1) { - val schemaResult = yieldedSchemasMap.toList().first().second - pipelineContextMapped.put(SchemaOwner.CurrentCaller, schemaResult) - } - } - - // in case of expression statement - if (schemaOwnerToTypeParameter == null) { - return yieldedSchemasMap.mapKeys { SchemaOwner.TempOwner(it.key) }.toMutableMap() - } else { // in case of assignment statement - val ownerToSchemaMap = schemaOwnerToTypeParameter.mapValues { - yieldedSchemasMap.getOrDefault(it.value, SchemaResult.NoSchema) - } - - return ownerToSchemaMap.toMutableMap() - } -} - -@OptIn(ExperimentalSdsApi::class) -private fun inferSchema( - function: SdsFunction, - functionCall: SdsCall, - pipelineContext: Map, -): SchemaResult { - val parmArgPairs: List = - functionCall.argumentsOrEmpty().mapNotNull { - val param = it.parameterOrNull() ?: return@mapNotNull null - ParmArgPairs.Parm_Arg_Pair(Pair(param, it)) - } + - functionCall.typeArgumentsOrEmpty().mapNotNull { - val typeParam = it.typeParameterOrNull() ?: return@mapNotNull null - - if (typeParam.hasSchemaKind()) { - return@mapNotNull null - } - ParmArgPairs.TypeParm_TypeArg_Pair(Pair(typeParam, it)) - } - - // Inside constraint block - val predicateAssignments = function.constraintStatementsOrEmpty() - .filterIsInstance() - - val resolvedPredicateVars = resolvePredicateVars( - predicateAssignments, - pipelineContext, - parmArgPairs, - ) ?: return SchemaResult.UnComputable - - val yieldedTypeParameterToSchema = resolvedPredicateVars - .mapNotNull { - val schemaYield = it.key as? SdsSchemaYield - val declaration = schemaYield?.type?.declaration - - val typeParameter = typeParameterWithSchemaOrNull(declaration) - ?: return@mapNotNull null - typeParameter to it.value - }.toMap() - - return SchemaResult.FunctionResult(yieldedTypeParameterToSchema) -} - -@OptIn(ExperimentalSdsApi::class) -internal fun inferSchema( - predicate: SdsPredicate, - valueResultStack: ArrayDeque>, -): SchemaResult { - val predicateAssignments = predicate.assignmentsOrEmpty() - - val resolvedPredicateVars = resolvePredicateVars( - predicateAssignments, - emptyMap(), - emptyList(), - valueResultStack, - ) ?: return SchemaResult.UnComputable - - val schemaResult = resolvedPredicateVars - .mapNotNull { - val schemaYield = it.key as? SdsSchemaYield - if (schemaYield == null) { - return@mapNotNull null - } - it.value - }.firstOrNull() ?: return SchemaResult.UnComputable - - return SchemaResult.PredicateResult(schemaResult) -} - -private fun resolvePredicateVars( - predicateAssignments: List, - pipelineContext: Map, - parmArgPairs: List, - valueResultStack: ArrayDeque> = ArrayDeque(), -): MutableMap? { - val resolvedPredicateVars: MutableMap = mutableMapOf() - - for (predicateAssignment in predicateAssignments) { - // Only one result returned from a predicate - val assignee = predicateAssignment.assigneesOrEmpty().firstOrNull() - ?: return null - - val predicateCall = predicateAssignment.expression as? SdsCall - ?: return null - - val predicate = predicateCall.callableOrNull() as? SdsPredicate ?: return null - val maybeResult = inferSchema( - predicate, - predicateCall, - pipelineContext, - resolvedPredicateVars, - parmArgPairs, - valueResultStack, - ) - - val schemaResult = when (maybeResult) { - is SchemaResult.PredicateResult -> maybeResult.schemaResult - else -> SchemaResult.UnComputable - } - - resolvedPredicateVars.put(assignee, schemaResult) - } - - return resolvedPredicateVars -} - -sealed interface SchemaOwner { - object CurrentCaller : SchemaOwner - class Assignee(val assignee: SdsAbstractAssignee) : SchemaOwner - class TempOwner(val id: SdsTypeParameter) : SchemaOwner -} - -sealed interface SchemaResult { - object UnComputable : SchemaResult - object NoSchema : SchemaResult - class FunctionResult(val schemaResults: Map) : SchemaResult - class PredicateResult(val schemaResult: SchemaResult) : SchemaResult - class Schema(val schema: Map) : SchemaResult - class Error(val msg: String, val argument: SdsArgument, val code: ErrorCode) : SchemaResult -} - -// Helper functions -------------------------------------------------------------------------------- - -@OptIn(ExperimentalSdsApi::class) -private fun firstReceiverAndCallChain(call: SdsCall): Pair> { - var calls: MutableList = mutableListOf(call) - var current: EObject? = call.receiver - while (current != null) { - current = when { - current.eIsProxy() -> return Pair(null, calls) - current is SdsMemberAccess -> current.receiver - current is SdsReference -> current.declaration - current is SdsCall -> { - calls.add(current) - current.receiver - } - - // terminal for functions - current is SdsPlaceholder -> return Pair(current, calls) - else -> return Pair(null, calls) - } - } - return Pair(null, calls) -} - -private fun getSchemaOwnerToTypeParameterMap(assignment: SdsAssignment): Map { - return assignment.assigneeList.assignees - .mapNotNull { - val result = it.assignedOrNull() ?: return@mapNotNull null - - if (result !is SdsResult) { - return@mapNotNull null - } - - val namedType = result.type as? SdsNamedType - - val declaration = namedType - .typeArgumentsOrEmpty() - .mapNotNull { - val argNamedType = it.value.descendants().firstOrNull() - argNamedType?.declaration - } - .firstOrNull() // only one schema type parameter allowed per type argument - - val typeParameter = typeParameterWithSchemaOrNull(declaration) - ?: return@mapNotNull null - - SchemaOwner.Assignee(it) to typeParameter - }.toMap() -} - -@OptIn(ExperimentalSdsApi::class) -internal fun typeParameterWithSchemaOrNull(declaration: SdsAbstractNamedTypeDeclaration?): SdsTypeParameter? { - if (declaration == null || declaration !is SdsTypeParameter || !declaration.hasSchemaKind()) { - return null - } - return declaration -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaEffects.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaEffects.kt deleted file mode 100644 index d9c03c488..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaEffects.kt +++ /dev/null @@ -1,586 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.schema - -import com.larsreimann.safeds.constant.SdsSchemaEffect -import com.larsreimann.safeds.constant.hasSchemaKind -import com.larsreimann.safeds.constant.nameToSchemaEffect -import com.larsreimann.safeds.emf.argumentsOrEmpty -import com.larsreimann.safeds.emf.containingClassOrNull -import com.larsreimann.safeds.emf.typeArgumentsOrEmpty -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractLiteral -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsSchemaPlaceholder -import com.larsreimann.safeds.safeDS.SdsSchemaReference -import com.larsreimann.safeds.safeDS.SdsSchemaType -import com.larsreimann.safeds.safeDS.SdsString -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.safeDS.SdsTypeProjection -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.typeParameterOrNull -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.naming.QualifiedName -import java.nio.file.Path - -@OptIn(ExperimentalSdsApi::class) -internal fun inferSchema( - predicate: SdsPredicate, - predicateCall: SdsCall, - pipelineContext: Map, - localContext: Map, - parmArgPairs: List, - valueResultStack: ArrayDeque>, -): SchemaResult { - val argumentResults = predicateCall.argumentsOrEmpty().map { - getArgumentValueResult( - it, - pipelineContext, - localContext, - parmArgPairs, - valueResultStack, - ) - } - val typeArgumentResults = predicateCall.typeArgumentsOrEmpty().map { - getTypeArgumentValueResult( - it, - parmArgPairs, - valueResultStack, - ) - } - val argumentValueResults = argumentResults + typeArgumentResults - - try { - return when (predicate.nameToSchemaEffect()) { - SdsSchemaEffect.ReadSchemaEffect -> readSchemaEffect(predicateCall, argumentValueResults) - SdsSchemaEffect.CheckColumnEffect -> checkColumn(argumentValueResults) - SdsSchemaEffect.RemoveColumnEffect -> removeColumn(argumentValueResults) - SdsSchemaEffect.KeepColumnEffect -> keepColumn(argumentValueResults) - SdsSchemaEffect.RenameColumnEffect -> renameColumn(argumentValueResults) - SdsSchemaEffect.AddColumnEffect -> addColumn(argumentValueResults) - SdsSchemaEffect.ChangeColumnTypeEffect -> changeColumnType(argumentValueResults) - SdsSchemaEffect.NoSchemaEffect -> { - valueResultStack.addLast(argumentValueResults) - inferSchema(predicate, valueResultStack) - } - } - } catch (e: ClassCastException) { - return SchemaResult.UnComputable - } -} - -private fun readSchemaEffect( - predicateCall: SdsCall, - argumentValueResults: List, -): SchemaResult { - val pathArg = argValue>( - argumentValueResults.firstOrNull(), - ) ?: return SchemaResult.UnComputable - - // TODO: Read schema from file first - val schemaRead = inferInitialSchema(predicateCall, Path.of(pathArg.first)) - ?: return SchemaResult.PredicateResult( - SchemaResult.Error( - "Dataset could not be read.", - pathArg.second, - ErrorCode.DatasetCouldNotBeRead, - ), - ) - - val schema = sdsSchemaToSchemaDF(schemaRead) - val schemaResult = SchemaResult.Schema(schema) - return SchemaResult.PredicateResult(schemaResult) -} - -private fun checkColumn( - argumentValueResults: List, -): SchemaResult { - val schemaResult = argValue( - argumentValueResults.firstOrNull(), - ) ?: return SchemaResult.UnComputable - - val colNamesArg = variadicArgValue>( - argumentValueResults.lastOrNull(), - ) ?: return SchemaResult.UnComputable - - if (schemaResult !is SchemaResult.Schema) { - return SchemaResult.PredicateResult(schemaResult) - } - - for (columnNameArg in colNamesArg) { - if (!schemaResult.schema.containsKey(columnNameArg.first)) { - return SchemaResult.PredicateResult( - SchemaResult.Error( - "Dataset does not have column named '${columnNameArg.first}'.", - columnNameArg.second, - ErrorCode.DatasetDoesNotHaveAColumn, - ), - ) - } - } - - return SchemaResult.PredicateResult(schemaResult) -} - -private fun removeColumn( - argumentValueResults: List, -): SchemaResult { - val schemaResult = argValue( - argumentValueResults.firstOrNull(), - ) ?: return SchemaResult.UnComputable - val colNamesArg = variadicArgValue>( - argumentValueResults.lastOrNull(), - ) ?: return SchemaResult.UnComputable - - if (schemaResult !is SchemaResult.Schema) { - return SchemaResult.PredicateResult(schemaResult) - } - - val newSchema = schemaResult.schema.mapNotNull { - for (columnNamePair in colNamesArg) { - if (columnNamePair.first == it.key) { - return@mapNotNull null - } - } - it.key to it.value - }.toMap() - - val newSchemaResult = SchemaResult.Schema(newSchema) - return SchemaResult.PredicateResult(newSchemaResult) -} - -private fun keepColumn( - argumentValueResults: List, -): SchemaResult { - val schemaResult = argValue( - argumentValueResults.firstOrNull(), - ) ?: return SchemaResult.UnComputable - val colNamesArg = variadicArgValue>( - argumentValueResults.lastOrNull(), - ) ?: return SchemaResult.UnComputable - - if (schemaResult !is SchemaResult.Schema) { - return SchemaResult.PredicateResult(schemaResult) - } - - val newSchema = schemaResult.schema.mapNotNull { - for (columnName in colNamesArg) { - if (columnName.first == it.key) { - return@mapNotNull it.key to it.value - } - } - null - }.toMap() - - val newSchemaResult = SchemaResult.Schema(newSchema) - return SchemaResult.PredicateResult(newSchemaResult) -} - -private fun renameColumn( - argumentValueResults: List, -): SchemaResult { - val schemaResult = argValue( - argumentValueResults.firstOrNull(), - ) ?: return SchemaResult.UnComputable - - val currentColNameArg = argValue>( - argumentValueResults.get(1), - ) ?: return SchemaResult.UnComputable - - val newColNameArg = argValue>( - argumentValueResults.lastOrNull(), - ) ?: return SchemaResult.UnComputable - - if (schemaResult !is SchemaResult.Schema) { - return SchemaResult.PredicateResult(schemaResult) - } - - if (schemaResult.schema.containsKey(newColNameArg.first)) { - return SchemaResult.PredicateResult( - SchemaResult.Error( - "Dataset already has column named '${newColNameArg.first}'.", - newColNameArg.second, - ErrorCode.DatasetAlreadyHasAColumn, - ), - ) - } - - val newSchema = schemaResult.schema.map { - if (currentColNameArg.first == it.key) { - return@map newColNameArg.first to it.value - } - - it.key to it.value - }.toMap() - - val newSchemaResult = SchemaResult.Schema(newSchema) - return SchemaResult.PredicateResult(newSchemaResult) -} - -private fun addColumn( - argumentValueResults: List, -): SchemaResult { - val schemaResult = argValue( - argumentValueResults.firstOrNull(), - ) ?: return SchemaResult.UnComputable - - val newColNameArg = argValue>( - argumentValueResults.get(1), - ) ?: return SchemaResult.UnComputable - - val newColDataTypeArg = argValue>( - argumentValueResults.lastOrNull(), - ) ?: return SchemaResult.UnComputable - - if (schemaResult !is SchemaResult.Schema) { - return SchemaResult.PredicateResult(schemaResult) - } - - val newSchema = schemaResult.schema + Pair(newColNameArg.first, newColDataTypeArg.first) - - val newSchemaResult = SchemaResult.Schema(newSchema) - return SchemaResult.PredicateResult(newSchemaResult) -} - -private fun changeColumnType( - argumentValueResults: List, -): SchemaResult { - val schemaResult = argValue( - argumentValueResults.firstOrNull(), - ) ?: return SchemaResult.UnComputable - - val currentColNameArg = argValue>( - argumentValueResults.get(1), - ) ?: return SchemaResult.UnComputable - - val newColDataTypeArg = argValue>( - argumentValueResults.lastOrNull(), - ) ?: return SchemaResult.UnComputable - - if (schemaResult !is SchemaResult.Schema) { - return SchemaResult.PredicateResult(schemaResult) - } - - val newSchema = schemaResult.schema.map { - if (currentColNameArg.first == it.key) { - return@map it.key to newColDataTypeArg.first - } - - it.key to it.value - }.toMap() - - val newSchemaResult = SchemaResult.Schema(newSchema) - return SchemaResult.PredicateResult(newSchemaResult) -} - -sealed interface ParmArgPairs { - class Parm_Arg_Pair(val parm_arg: Pair) : ParmArgPairs - class TypeParm_TypeArg_Pair(val typeParm_typeArg: Pair) : ParmArgPairs -} - -sealed interface ArgResult { - object UnResolved : ArgResult - - abstract class ResultWithParam(var param: SdsParameter) : ArgResult - abstract class ResultWithTypeParam(var typeParam: SdsTypeParameter) : ArgResult - - abstract class VariadicResult(param: SdsParameter) : ResultWithParam(param) - abstract class SimpleResult(param: SdsParameter) : ResultWithParam(param) - - class StringValue( - val stringArg: Pair, - param: SdsParameter, - ) : SimpleResult(param) - - class StringListValue( - val stringListArg: List>, - param: SdsParameter, - ) : VariadicResult(param) - - class SchemaResultValue( - val schemaResult: SchemaResult, - param: SdsParameter, - ) : ResultWithParam(param) - - class DataTypeValue( - val qualifiedNameArg: Pair, - typeParm: SdsTypeParameter, - ) : ResultWithTypeParam(typeParm) -} - -// Helper functions -------------------------------------------------------------------------------- - -private fun getArgumentValueResult( - argument: SdsArgument, - pipelineContext: Map, - localContext: Map, - parmArgPairs: List, - valueResultStack: ArrayDeque>, -): ArgResult { - val thisParam = argument.parameterOrNull() ?: return ArgResult.UnResolved - - // getting the parameter or typeparameter that the argument refers to - val referedParam = predicateArgToParamOrNull(argument) - val referedTypeParam = referedTypeParamOrNull(argument) - - // Try to resolve to already resolved arguments (incase of nested call) - val resolvedValues = valueResultStack.lastOrNull() - - if (resolvedValues != null) { - for (argResult in resolvedValues) { - if (argResult is ArgResult.ResultWithParam) { - val typeParamFound = referedTypeParam != null && - referedTypeParamOrNull(argResult.param) == referedTypeParam - - if (argResult.param == referedParam || typeParamFound) { - argResult.param = thisParam - return argResult - } - } - } - } - - val schemaResult = when (val owner = predicateArgToSchemaOwner(argument)) { - is SchemaOwner.Assignee -> localContext.get(owner.assignee) - is SchemaOwner.CurrentCaller -> pipelineContext.get(SchemaOwner.CurrentCaller) - else -> null - } - - if (schemaResult != null) { - return ArgResult.SchemaResultValue(schemaResult, thisParam) - } - - if (referedParam == null) { - return ArgResult.UnResolved - } - - val isVariadic = referedParam.isVariadic - - // Try to resolve String(s) - val strings = parmArgPairs.mapNotNull { - val argPair = it as? ParmArgPairs.Parm_Arg_Pair - ?: return@mapNotNull null - - val pram = argPair.parm_arg.first - val arg = argPair.parm_arg.second - - if (pram != referedParam) { - return@mapNotNull null - } - - val literal = arg.literalOrNull() - val string = (literal as? SdsString)?.value - - if (string == null) { - return@mapNotNull null - } - - Pair(string, arg) - } - - if (!strings.isEmpty()) { - if (isVariadic) { - return ArgResult.StringListValue(strings, thisParam) - } - if (!isVariadic && strings.count() == 1) { - return ArgResult.StringValue(strings.first(), thisParam) - } - } - - return ArgResult.UnResolved // Could not resolve -} - -private fun getTypeArgumentValueResult( - typeArgument: SdsTypeArgument, - parmArgPairs: List, - valueResultStack: ArrayDeque>, -): ArgResult { - val thisTypeParam = typeArgument.typeParameterOrNull() - ?: return ArgResult.UnResolved - - val referedTypeParam = predicateTypeArgToTypeParamOrNull(typeArgument) - - // Try to resolve to already resolved arguments (incase of nested call) - val resolvedValues = valueResultStack.lastOrNull() - - if (resolvedValues != null) { - for (argResult in resolvedValues) { - if (argResult is ArgResult.ResultWithTypeParam && - referedTypeParam == argResult.typeParam - ) { - argResult.typeParam = thisTypeParam - return argResult - } - } - } - - // Try to resolve Datatype - val datatype = parmArgPairs.mapNotNull { - val argPair = it as? ParmArgPairs.TypeParm_TypeArg_Pair - ?: return@mapNotNull null - - val tPram = argPair.typeParm_typeArg.first - val tArg = argPair.typeParm_typeArg.second - - if (tPram != referedTypeParam) { - return@mapNotNull null - } - - val dataTypeName = tArg.dataTypeNameOrNull() - ?: return@mapNotNull null - - Pair(dataTypeName, tArg) - } - - if (datatype.count() == 1) { - return ArgResult.DataTypeValue(datatype.first(), thisTypeParam) - } - - return ArgResult.UnResolved // Could not resolve -} - -fun SdsArgument.literalOrNull(): SdsAbstractLiteral? { - var current: EObject? = this.value - - while (current != null) { - current = when { - current.eIsProxy() -> return null - current is SdsReference -> current.declaration - current is SdsPlaceholder -> current.assignedOrNull() - current is SdsAbstractLiteral -> return current - else -> return null - } - } - return null -} - -fun SdsTypeArgument.dataTypeNameOrNull(): QualifiedName? { - var current: Any? = this.value - - while (current != null) { - current = when { - current is SdsTypeProjection -> current.type - current is SdsNamedType -> current.declaration - current is SdsClass -> current.type() - current is ClassType -> return current.sdsClass.qualifiedNameOrNull() - else -> return null - } - } - return null -} - -/* - * Only used for Predicate's arguments - */ -private fun predicateArgToParamOrNull(sdsArgument: SdsArgument): SdsParameter? { - var current: EObject? = sdsArgument.value - while (current != null) { - current = when { - current.eIsProxy() -> return null - current is SdsReference -> current.declaration - current is SdsParameter -> return current - else -> return null - } - } - return null -} - -/* - * Only used for Predicate's arguments - */ -private fun predicateTypeArgToTypeParamOrNull(sdsTypeArgument: SdsTypeArgument): SdsTypeParameter? { - var current: EObject? = sdsTypeArgument.value - while (current != null) { - current = when { - current.eIsProxy() -> return null - current is SdsTypeProjection -> current.type - current is SdsNamedType -> current.declaration - current is SdsTypeParameter -> return current - else -> return null - } - } - return null -} - -/* - * Only used for Predicate's arguments - */ -@OptIn(ExperimentalSdsApi::class) -private fun predicateArgToSchemaOwner(sdsArgument: SdsArgument): SchemaOwner? { - var current: EObject? = sdsArgument.value - while (current != null) { - current = when { - current.eIsProxy() -> return null - current is SdsSchemaReference -> current.type - current is SdsSchemaType -> current.declaration - - // Locally defined schema in function definition - current is SdsSchemaPlaceholder -> return SchemaOwner.Assignee(current) - - // Referring to the caller's schema - current is SdsTypeParameter && current.hasSchemaKind() -> current.containingClassOrNull() - current is SdsClass -> return SchemaOwner.CurrentCaller - - else -> return null - } - } - return null -} - -/* - * Only used for Predicate's arguments - */ -@OptIn(ExperimentalSdsApi::class) -private fun referedTypeParamOrNull(sdsObject: SdsAbstractObject): SdsTypeParameter? { - var current: EObject? = sdsObject - while (current != null) { - current = when { - current.eIsProxy() -> return null - current is SdsArgument -> current.value - current is SdsSchemaReference -> current.type - - current is SdsParameter -> current.type - - current is SdsSchemaType -> current.declaration - current is SdsTypeParameter && current.hasSchemaKind() -> return current - else -> return null - } - } - return null -} - -private fun variadicArgValue( - lastArgumentValueResult: ArgResult?, -): List? { - return when (lastArgumentValueResult) { - is ArgResult.VariadicResult -> argValue>(lastArgumentValueResult) - is ArgResult.SimpleResult -> listOfNotNull(argValue(lastArgumentValueResult)) - else -> null - } -} - -@Suppress("UNCHECKED_CAST") -private fun argValue( - argumentValueResult: ArgResult?, -): ReturnType? { - return when (argumentValueResult) { - is ArgResult.SchemaResultValue -> argumentValueResult.schemaResult as? ReturnType - is ArgResult.StringListValue -> argumentValueResult.stringListArg as? ReturnType - is ArgResult.StringValue -> argumentValueResult.stringArg as? ReturnType - is ArgResult.DataTypeValue -> argumentValueResult.qualifiedNameArg as? ReturnType - else -> null - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaIO.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaIO.kt deleted file mode 100644 index 7164da248..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/schema/SchemaIO.kt +++ /dev/null @@ -1,63 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.schema - -import com.larsreimann.safeds.emf.createSdsColumn -import com.larsreimann.safeds.emf.createSdsNamedType -import com.larsreimann.safeds.emf.createSdsSchema -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsSchema -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.stdlibAccess.getStdlibClassOrNull -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.naming.QualifiedName -import org.jetbrains.kotlinx.dataframe.DataFrame -import org.jetbrains.kotlinx.dataframe.io.readCSV -import org.jetbrains.kotlinx.dataframe.typeClass -import java.nio.file.Path -import kotlin.io.path.nameWithoutExtension - -@OptIn(ExperimentalSdsApi::class) -internal fun inferInitialSchema(context: EObject, path: Path): SdsSchema? { - try { - val name = path.nameWithoutExtension - - val dataFrame = DataFrame.readCSV(path.toFile()) - val columns = dataFrame.columns().map { - val colQualifiedName: QualifiedName = when (it.typeClass) { - Double::class -> StdlibClasses.Float - String::class -> StdlibClasses.String - Int::class -> StdlibClasses.Int - Boolean::class -> StdlibClasses.Boolean - else -> StdlibClasses.Any - } - - val stdlibClass = context.getStdlibClassOrNull(colQualifiedName) ?: return null - - createSdsColumn( - columnName = it.name(), - columnType = createSdsNamedType(stdlibClass, isNullable = true), - ) - } - - return createSdsSchema(name, columns = columns) - } catch (e: Exception) { - return null - } -} - -internal fun sdsSchemaToSchemaDF(sdsSchema: SdsSchema): Map { - return sdsSchema.columnList.columns.map { - val columnName = it.columnName.value - val classtype = it.columnType.type() - - if (classtype !is ClassType) { - throw IllegalStateException("ColumnType should be a primitive ClassType") - } - - val columnType = classtype.sdsClass.qualifiedNameOrNull() - ?: throw IllegalStateException("Primitive Must Have QualifiedName") - columnName to columnType - }.toMap() -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeComputer.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeComputer.kt deleted file mode 100644 index 090bd7647..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeComputer.kt +++ /dev/null @@ -1,404 +0,0 @@ -@file:Suppress("FunctionName") - -package com.larsreimann.safeds.staticAnalysis.typing - -import com.larsreimann.safeds.constant.SdsKind -import com.larsreimann.safeds.emf.blockLambdaResultsOrEmpty -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.containingEnumOrNull -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.emf.typeArgumentsOrEmpty -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.emf.yieldsOrEmpty -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractCallable -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsAbstractLambda -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsAbstractType -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsBoolean -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsFloat -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsIndexedAccess -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.safeDS.SdsInt -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsMemberType -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsNull -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsParenthesizedType -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPrefixOperation -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsSchemaPlaceholder -import com.larsreimann.safeds.safeDS.SdsSchemaReference -import com.larsreimann.safeds.safeDS.SdsSchemaType -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsString -import com.larsreimann.safeds.safeDS.SdsTemplateString -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.safeDS.SdsTypeProjection -import com.larsreimann.safeds.safeDS.SdsUnionType -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.staticAnalysis.callableOrNull -import com.larsreimann.safeds.staticAnalysis.classHierarchy.superClasses -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.stdlibAccess.getStdlibClassOrNull -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.naming.QualifiedName - -fun SdsAbstractObject.type(): Type { - return inferType(this) -} - -fun SdsAbstractObject.hasPrimitiveType(): Boolean { - val type = type() - if (type !is ClassType) { - return false - } - - val qualifiedName = type.sdsClass.qualifiedNameOrNull() - return qualifiedName in setOf( - StdlibClasses.Boolean, - StdlibClasses.Float, - StdlibClasses.Int, - StdlibClasses.String, - ) -} - -private fun EObject.inferType(context: EObject): Type { - return when { - this.eIsProxy() -> UnresolvedType - // Check First - this is SdsSchemaPlaceholder -> this.inferTypeForDeclaration(context) - - this is SdsAbstractAssignee -> this.inferTypeForAssignee(context) - this is SdsAbstractDeclaration -> this.inferTypeForDeclaration(context) - this is SdsAbstractExpression -> this.inferTypeExpression(context) - this is SdsAbstractType -> this.inferTypeForType(context) - this is SdsTypeArgument -> this.value.inferType(context) - this is SdsTypeProjection -> this.type.inferTypeForType(context) - else -> Any(context) - } -} - -private fun SdsAbstractAssignee.inferTypeForAssignee(context: EObject): Type { - return when { - this.eIsProxy() -> UnresolvedType - this is SdsBlockLambdaResult || this is SdsPlaceholder || this is SdsYield -> { - val assigned = assignedOrNull() ?: return Nothing(context) - assigned.inferType(context) - } - else -> Any(context) - } -} - -@OptIn(ExperimentalSdsApi::class) -private fun SdsAbstractDeclaration.inferTypeForDeclaration(context: EObject): Type { - return when { - this.eIsProxy() -> UnresolvedType - this is SdsAttribute -> type.inferTypeForType(context) - this is SdsClass -> { - val typeParametersTypes = this.typeParametersOrEmpty() - .map { it.inferTypeForDeclaration(context) } - .filterIsInstance() - - ClassType(this, typeParametersTypes, isNullable = false) - } - this is SdsEnum -> EnumType(this, isNullable = false) - this is SdsEnumVariant -> EnumVariantType(this, isNullable = false) - this is SdsFunction -> CallableType( - parametersOrEmpty().map { it.inferTypeForDeclaration(context) }, - resultsOrEmpty().map { it.inferTypeForDeclaration(context) }, - ) - this is SdsParameter -> { - // Declared parameter type - if (this.type != null) { - val declaredParameterType = this.type.inferTypeForType(context) - return when { - this.isVariadic -> VariadicType(declaredParameterType) - else -> declaredParameterType - } - } - - // Inferred lambda parameter type - val callable = this.closestAncestorOrNull() - val thisIndex = callable.parametersOrEmpty().indexOf(this) - if (callable is SdsAbstractLambda) { - val containerType = when (val container = callable.eContainer()) { - is SdsArgument -> container.parameterOrNull()?.inferType(context) - is SdsAssignment -> - container - .yieldsOrEmpty() - .find { it.assignedOrNull() == callable } - ?.result - ?.inferType(context) - else -> null - } - - return when (containerType) { - is CallableType -> containerType.parameters.getOrElse(thisIndex) { Any(context) } - else -> Any(context) - } - } - - // We don't know better - return Any(context) - } - this is SdsResult -> type.inferTypeForType(context) - // For now all Schema placeholders are of type 'ParameterisedType(::$SchemaType)' - this is SdsSchemaPlaceholder -> ParameterisedType(this, SdsKind.SchemaKind.toString()) - this is SdsStep -> CallableType( - parametersOrEmpty().map { it.inferTypeForDeclaration(context) }, - resultsOrEmpty().map { it.inferTypeForDeclaration(context) }, - ) - // Todo: resolve TypeParameter for "non kind" TypeParameter too - this is SdsTypeParameter && this.kind != null -> ParameterisedType(this, kind) - else -> Any(context) - } -} - -private fun SdsAbstractExpression.inferTypeExpression(context: EObject): Type { - return when { - // Terminal cases - this.eIsProxy() -> UnresolvedType - this is SdsBoolean -> Boolean(context) - this is SdsFloat -> Float(context) - this is SdsInt -> Int(context) - this is SdsNull -> Nothing(context, isNullable = true) - this is SdsString -> String(context) - this is SdsTemplateString -> String(context) - - // Recursive cases - this is SdsArgument -> this.value.inferTypeExpression(context) - this is SdsBlockLambda -> CallableType( - this.parametersOrEmpty().map { it.inferTypeForDeclaration(context) }, - blockLambdaResultsOrEmpty().map { it.inferTypeForAssignee(context) }, - ) - this is SdsCall -> when (val callable = callableOrNull()) { - is SdsClass -> { - val typeParametersTypes = callable.typeParametersOrEmpty() - .map { it.inferTypeForDeclaration(context) } - .filterIsInstance() - - ClassType(callable, typeParametersTypes, isNullable = false) - } - is SdsCallableType -> { - val results = callable.resultsOrEmpty() - when (results.size) { - 1 -> results.first().inferTypeForDeclaration(context) - else -> RecordType(results.map { it.name to it.inferTypeForDeclaration(context) }) - } - } - is SdsFunction -> { - val results = callable.resultsOrEmpty() - when (results.size) { - 1 -> results.first().inferTypeForDeclaration(context) - else -> RecordType(results.map { it.name to it.inferTypeForDeclaration(context) }) - } - } - is SdsBlockLambda -> { - val results = callable.blockLambdaResultsOrEmpty() - when (results.size) { - 1 -> results.first().inferTypeForAssignee(context) - else -> RecordType(results.map { it.name to it.inferTypeForAssignee(context) }) - } - } - is SdsEnumVariant -> { - EnumVariantType(callable, isNullable = false) - } - is SdsExpressionLambda -> { - callable.result.inferTypeExpression(context) - } - is SdsStep -> { - val results = callable.resultsOrEmpty() - when (results.size) { - 1 -> results.first().inferTypeForDeclaration(context) - else -> RecordType(results.map { it.name to it.inferTypeForDeclaration(context) }) - } - } - else -> Any(context) - } - this is SdsExpressionLambda -> CallableType( - this.parametersOrEmpty().map { it.inferTypeForDeclaration(context) }, - listOf(result.inferTypeExpression(context)), - ) - this is SdsIndexedAccess -> { - when (val receiverType = this.receiver.inferTypeExpression(context)) { - is UnresolvedType -> UnresolvedType - is VariadicType -> receiverType.elementType - else -> Nothing(context) - } - } - this is SdsInfixOperation -> when (operator) { - "<", "<=", ">=", ">" -> Boolean(context) - "==", "!=" -> Boolean(context) - "===", "!==" -> Boolean(context) - "or", "and" -> Boolean(context) - "+", "-", "*", "/" -> when { - this.leftOperand.inferTypeExpression(context) == Int(context) && - this.rightOperand.inferTypeExpression(context) == Int(context) -> Int(context) - else -> Float(context) - } - "?:" -> { - val leftOperandType = this.leftOperand.inferTypeExpression(context) - if (leftOperandType.isNullable) { - lowestCommonSupertype( - context, - listOf( - leftOperandType.setIsNullableOnCopy(isNullable = false), - this.rightOperand.inferTypeExpression(context), - ), - ) - } else { - leftOperandType - } - } - else -> Nothing(context) - } - this is SdsMemberAccess -> { - val memberType = this.member.inferTypeExpression(context) - memberType.setIsNullableOnCopy(this.isNullSafe || memberType.isNullable) - } - this is SdsParenthesizedExpression -> this.expression.inferTypeExpression(context) - this is SdsPrefixOperation -> when (operator) { - "not" -> Boolean(context) - "-" -> when (this.operand.inferTypeExpression(context)) { - Int(context) -> Int(context) - else -> Float(context) - } - else -> Nothing(context) - } - this is SdsReference -> this.declaration.inferType(context) - this is SdsSchemaReference -> this.type.inferTypeForType(context) - else -> Any(context) - } -} - -private fun SdsAbstractType.inferTypeForType(context: EObject): Type { - return when { - this.eIsProxy() -> UnresolvedType - this is SdsCallableType -> CallableType( - this.parametersOrEmpty().map { it.inferTypeForDeclaration(context) }, - this.resultsOrEmpty().map { it.inferTypeForDeclaration(context) }, - ) - this is SdsMemberType -> { - this.member.inferTypeForType(context) - } - this is SdsNamedType -> { - this.declaration.inferTypeForDeclaration(context).setIsNullableOnCopy(this.isNullable) - } - this is SdsParenthesizedType -> { - this.type.inferTypeForType(context) - } - this is SdsSchemaType -> { - this.declaration.inferTypeForDeclaration(context) - } - this is SdsUnionType -> { - UnionType(this.typeArgumentsOrEmpty().map { it.value.inferType(context) }.toSet()) - } - else -> Any(context) - } -} - -private fun lowestCommonSupertype(context: EObject, types: List): Type { - if (types.isEmpty()) { - return Nothing(context) - } - - val unwrappedTypes = unwrapUnionTypes(types) - val isNullable = unwrappedTypes.any { it.isNullable } - var candidate = unwrappedTypes.first().setIsNullableOnCopy(isNullable) - - while (!isLowestCommonSupertype(candidate, unwrappedTypes)) { - candidate = when (candidate) { - is CallableType -> Any(context, candidate.isNullable) - is ClassType -> { - val superClass = candidate.sdsClass.superClasses().firstOrNull() - ?: return Any(context, candidate.isNullable) - - val typeParametersTypes = superClass.typeParametersOrEmpty() - .map { it.inferTypeForDeclaration(context) } - .filterIsInstance() - - ClassType(superClass, typeParametersTypes, candidate.isNullable) - } - is EnumType -> Any(context, candidate.isNullable) - is EnumVariantType -> { - val containingEnum = candidate.sdsEnumVariant.containingEnumOrNull() - ?: return Any(context, candidate.isNullable) - EnumType(containingEnum, candidate.isNullable) - } - is RecordType -> Any(context, candidate.isNullable) - // TODO: Correct ? - is ParameterisedType -> Any(context, candidate.isNullable) - is UnionType -> throw AssertionError("Union types should have been unwrapped.") - UnresolvedType -> Any(context, candidate.isNullable) - is VariadicType -> Any(context, candidate.isNullable) - } - } - - return candidate -} - -private fun unwrapUnionTypes(types: List): List { - return types.flatMap { - when (it) { - is UnionType -> it.possibleTypes - else -> listOf(it) - } - } -} - -private fun isLowestCommonSupertype(candidate: Type, otherTypes: List): Boolean { - if (candidate is ClassType && candidate.sdsClass.qualifiedNameOrNull() == StdlibClasses.Any) { - return true - } - - return otherTypes.all { it.isSubstitutableFor(candidate) } -} - -private fun Any(context: EObject, isNullable: Boolean = false) = stdlibType( - context, - StdlibClasses.Any, - isNullable, -) - -private fun Boolean(context: EObject) = stdlibType(context, StdlibClasses.Boolean) -private fun Float(context: EObject) = stdlibType(context, StdlibClasses.Float) -private fun Int(context: EObject) = stdlibType(context, StdlibClasses.Int) -private fun Nothing(context: EObject, isNullable: Boolean = false) = stdlibType( - context, - StdlibClasses.Nothing, - isNullable, -) - -private fun String(context: EObject) = stdlibType(context, StdlibClasses.String) - -internal fun stdlibType(context: EObject, qualifiedName: QualifiedName, isNullable: Boolean = false): Type { - return when (val sdsClass = context.getStdlibClassOrNull(qualifiedName)) { - null -> UnresolvedType - else -> ClassType(sdsClass, emptyList(), isNullable) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeConformance.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeConformance.kt deleted file mode 100644 index 2684b5718..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeConformance.kt +++ /dev/null @@ -1,141 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.typing - -import com.larsreimann.safeds.constant.kind -import com.larsreimann.safeds.emf.variantsOrEmpty -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.staticAnalysis.classHierarchy.isSubtypeOf -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.utils.ExperimentalSdsApi - -fun Type.isSubstitutableFor(other: Type, resultIfUnresolved: Boolean = false): Boolean { - if (other == UnresolvedType) { - return resultIfUnresolved - } - - return when (this) { - is CallableType -> this.isSubstitutableFor(other) - is ClassType -> this.isSubstitutableFor(other) - is EnumType -> this.isSubstitutableFor(other) - is EnumVariantType -> this.isSubstitutableFor(other) - is ParameterisedType -> this.isSubstitutableFor(other) - is UnionType -> this.isSubstitutableFor(other) - is VariadicType -> this.isSubstitutableFor(other) - is RecordType -> false - UnresolvedType -> resultIfUnresolved - } -} - -private fun CallableType.isSubstitutableFor(other: Type): Boolean { - return when (val unwrappedOther = unwrapVariadicType(other)) { - is CallableType -> { - // TODO: We need to compare names of parameters & results and can allow additional optional parameters - - // Sizes must match (too strict requirement -> should be loosened later) - if (this.parameters.size != unwrappedOther.parameters.size || this.results.size != this.results.size) { - return false - } - - // Actual parameters must be supertypes of expected parameters (contravariance) - this.parameters.zip(unwrappedOther.parameters).forEach { (thisParameter, otherParameter) -> - if (!otherParameter.isSubstitutableFor(thisParameter)) { - return false - } - } - - // Expected results must be subtypes of expected results (covariance) - this.results.zip(unwrappedOther.results).forEach { (thisResult, otherResult) -> - if (!thisResult.isSubstitutableFor(otherResult)) { - return false - } - } - - true - } - is ClassType -> { - unwrappedOther.sdsClass.qualifiedNameOrNull() == StdlibClasses.Any - } - is UnionType -> { - unwrappedOther.possibleTypes.any { this.isSubstitutableFor(it) } - } - else -> false - } -} - -private fun ClassType.isSubstitutableFor(other: Type): Boolean { - return when (val unwrappedOther = unwrapVariadicType(other)) { - is ClassType -> { - (!this.isNullable || unwrappedOther.isNullable) && this.sdsClass.isSubtypeOf(unwrappedOther.sdsClass) - } - is UnionType -> { - unwrappedOther.possibleTypes.any { this.isSubstitutableFor(it) } - } - else -> false - } -} - -private fun EnumType.isSubstitutableFor(other: Type): Boolean { - return when (val unwrappedOther = unwrapVariadicType(other)) { - is ClassType -> { - (!this.isNullable || unwrappedOther.isNullable) && - unwrappedOther.sdsClass.qualifiedNameOrNull() == StdlibClasses.Any - } - is EnumType -> { - (!this.isNullable || unwrappedOther.isNullable) && this.sdsEnum == unwrappedOther.sdsEnum - } - is UnionType -> { - unwrappedOther.possibleTypes.any { this.isSubstitutableFor(it) } - } - else -> false - } -} - -private fun EnumVariantType.isSubstitutableFor(other: Type): Boolean { - return when (val unwrappedOther = unwrapVariadicType(other)) { - is ClassType -> { - (!this.isNullable || unwrappedOther.isNullable) && - unwrappedOther.sdsClass.qualifiedNameOrNull() == StdlibClasses.Any - } - is EnumType -> { - (!this.isNullable || unwrappedOther.isNullable) && - this.sdsEnumVariant in unwrappedOther.sdsEnum.variantsOrEmpty() - } - is EnumVariantType -> { - (!this.isNullable || unwrappedOther.isNullable) && this.sdsEnumVariant == unwrappedOther.sdsEnumVariant - } - is UnionType -> unwrappedOther.possibleTypes.any { this.isSubstitutableFor(it) } - else -> false - } -} - -@OptIn(ExperimentalSdsApi::class) -private fun ParameterisedType.isSubstitutableFor(other: Type): Boolean { - return when (other) { - is ParameterisedType -> (!this.isNullable || other.isNullable) && this.kind() == other.kind() - else -> false - } -} - -/** - * A [UnionType] can be substituted for another type of all its possible types can be substituted for the other type. - */ -private fun UnionType.isSubstitutableFor(other: Type): Boolean { - return this.possibleTypes.all { it.isSubstitutableFor(other) } -} - -private fun VariadicType.isSubstitutableFor(other: Type): Boolean { - return when (other) { - is ClassType -> other.sdsClass.qualifiedNameOrNull() == StdlibClasses.Any - is VariadicType -> this.elementType.isSubstitutableFor(other) - else -> false - } -} - -/** - * Returns the elementType of a [VariadicType] or, otherwise, the type itself. - */ -private fun unwrapVariadicType(type: Type): Type { - return when (type) { - is VariadicType -> type.elementType - else -> type - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/Types.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/Types.kt deleted file mode 100644 index 380ebfbee..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis/typing/Types.kt +++ /dev/null @@ -1,172 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.typing - -import com.larsreimann.safeds.emf.containingEnumOrNull -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import org.eclipse.xtext.naming.QualifiedName - -sealed class Type { - abstract val isNullable: Boolean - abstract fun setIsNullableOnCopy(isNullable: Boolean): Type - abstract fun toSimpleString(): String -} - -class RecordType(resultToType: List>) : Type() { - private val resultToType = resultToType.toMap() - - override val isNullable = false - override fun setIsNullableOnCopy(isNullable: Boolean) = this - - override fun toString(): String { - val types = resultToType.entries.joinToString { (name, type) -> "$name: $type" } - return "($types)" - } - - override fun toSimpleString(): String { - val types = resultToType.entries.joinToString { (name, type) -> "$name: ${type.toSimpleString()}" } - return "($types)" - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as RecordType - - if (resultToType != other.resultToType) return false - if (isNullable != other.isNullable) return false - - return true - } - - override fun hashCode(): Int { - var result = resultToType.hashCode() - result = 31 * result + isNullable.hashCode() - return result - } -} - -data class CallableType(val parameters: List, val results: List) : Type() { - override val isNullable = false - override fun setIsNullableOnCopy(isNullable: Boolean) = this - - override fun toString(): String { - val parameters = parameters.joinToString() - val results = results.joinToString() - - return "($parameters) -> ($results)" - } - - override fun toSimpleString(): String { - val parameters = parameters.joinToString { it.toSimpleString() } - val results = results.joinToString { it.toSimpleString() } - - return "($parameters) -> ($results)" - } -} - -sealed class NamedType(sdsDeclaration: SdsAbstractDeclaration) : Type() { - val simpleName: String = sdsDeclaration.name - val qualifiedName: QualifiedName = sdsDeclaration.qualifiedNameOrNull()!! - - override fun toString() = buildString { - append(qualifiedName) - if (isNullable) { - append("?") - } - } - - override fun toSimpleString() = buildString { - append(simpleName) - if (isNullable) { - append("?") - } - } -} - -data class ClassType( - val sdsClass: SdsClass, - val typeParametersTypes: List = emptyList(), - override val isNullable: Boolean, -) : NamedType(sdsClass) { - override fun setIsNullableOnCopy(isNullable: Boolean) = this.copy(isNullable = isNullable) - - override fun toString() = super.toString() -} - -data class EnumType( - val sdsEnum: SdsEnum, - override val isNullable: Boolean, -) : NamedType(sdsEnum) { - override fun setIsNullableOnCopy(isNullable: Boolean) = this.copy(isNullable = isNullable) - - override fun toString() = super.toString() -} - -data class EnumVariantType( - val sdsEnumVariant: SdsEnumVariant, - override val isNullable: Boolean, -) : NamedType(sdsEnumVariant) { - override fun setIsNullableOnCopy(isNullable: Boolean) = this.copy(isNullable = isNullable) - - override fun toString() = super.toString() - - override fun toSimpleString() = buildString { - sdsEnumVariant.containingEnumOrNull()?.let { append("${it.name}.") } - append(sdsEnumVariant.name) - } -} - -data class UnionType(val possibleTypes: Set) : Type() { - override val isNullable = false - override fun setIsNullableOnCopy(isNullable: Boolean) = this - - override fun toString(): String { - return "union<${possibleTypes.joinToString()}>" - } - - override fun toSimpleString(): String { - return "union<${possibleTypes.joinToString { it.toSimpleString() }}>" - } -} - -data class VariadicType(val elementType: Type) : Type() { - override val isNullable = false - override fun setIsNullableOnCopy(isNullable: Boolean) = this - - override fun toString(): String { - return "vararg<$elementType>" - } - - override fun toSimpleString(): String { - return "vararg<${elementType.toSimpleString()}>" - } -} - -data class ParameterisedType( - val sdsAbstractNamedTypeDeclaration: SdsAbstractDeclaration, - val kind: String, -) : Type() { - override val isNullable = false - override fun setIsNullableOnCopy(isNullable: Boolean) = this - - override fun toString(): String { - return "::$kind" - } - - override fun toSimpleString(): String { - return "::$kind" - } -} - -object UnresolvedType : Type() { - override val isNullable = false - override fun setIsNullableOnCopy(isNullable: Boolean) = this - - override fun toString() = "\$Unresolved" - - override fun toSimpleString() = toString() -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibAnnotations.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibAnnotations.kt deleted file mode 100644 index c2e82ddb1..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibAnnotations.kt +++ /dev/null @@ -1,257 +0,0 @@ -@file:Suppress("MemberVisibilityCanBePrivate") - -package com.larsreimann.safeds.stdlibAccess - -import com.larsreimann.safeds.emf.annotationCallsOrEmpty -import com.larsreimann.safeds.emf.argumentsOrEmpty -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantEnumVariant -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantExpression -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantString -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.toConstantExpressionOrNull -import com.larsreimann.safeds.stdlibAccess.StdlibEnums.AnnotationTarget -import com.larsreimann.safeds.utils.uniqueOrNull -import org.eclipse.xtext.naming.QualifiedName - -/** - * Important annotations in the standard library. - */ -object StdlibAnnotations { - - /** - * Values assigned to this parameter must be constant. - * - * @see isConstant - */ - val Constant: QualifiedName = StdlibPackages.lang.append("Constant") - - /** - * The purpose of a declaration. - * - * @see descriptionOrNull - */ - val Description: QualifiedName = StdlibPackages.lang.append("Description") - - /** - * The declaration should no longer be used. - * - * @see isDeprecated - */ - val Deprecated: QualifiedName = StdlibPackages.lang.append("Deprecated") - - /** - * The declaration might change without a major version bump. - * - * @see isExperimental - */ - val Experimental: QualifiedName = StdlibPackages.lang.append("Experimental") - - /** - * This parameter should only be used by expert users. - * - * @see isExpert - */ - val Expert: QualifiedName = StdlibPackages.lang.append("Expert") - - /** - * The function has no side effects. - * - * @see hasNoSideEffects - */ - val NoSideEffects: QualifiedName = StdlibPackages.lang.append("NoSideEffects") - - /** - * The qualified name of the corresponding module in Python. - * - * @see pythonModuleOrNull - */ - val PythonModule: QualifiedName = StdlibPackages.lang.append("PythonModule") - - /** - * The name of the corresponding API element in Python. - * - * @see pythonNameOrNull - */ - val PythonName: QualifiedName = StdlibPackages.lang.append("PythonName") - - /** - * The function has no side effects and returns the same results for the same arguments. - * - * @see isPure - */ - val Pure: QualifiedName = StdlibPackages.lang.append("Pure") - - /** - * The annotation can be used multiple times for the same declaration. - * - * @see isRepeatable - */ - val Repeatable: QualifiedName = StdlibPackages.lang.append("Repeatable") - - /** - * The version in which a declaration was added. - * - * @see sinceVersionOrNull - */ - val Since: QualifiedName = StdlibPackages.lang.append("Since") - - /** - * The annotation can target only a subset of declaration types. - * - * @see validTargets - */ - val Target: QualifiedName = StdlibPackages.lang.append("Target") -} - -/** - * Returns all calls of the annotation with the given qualified name. - */ -fun SdsAbstractDeclaration.annotationCallsOrEmpty(qualifiedName: QualifiedName): List { - return this.annotationCallsOrEmpty().filter { - it.annotation.qualifiedNameOrNull() == qualifiedName - } -} - -/** - * Returns the unique use of the annotation with the given qualified name or `null` if none or multiple exist. - */ -fun SdsAbstractDeclaration.uniqueAnnotationCallOrNull(qualifiedName: QualifiedName): SdsAnnotationCall? { - return this.annotationCallsOrEmpty(qualifiedName).uniqueOrNull() -} - -/** - * Returns the description attached to the declaration with a `safeds.lang.Description` annotation. - */ -fun SdsAbstractDeclaration.descriptionOrNull(): String? { - val value = annotationCallArgumentValueOrNull(StdlibAnnotations.Description, "description") - return (value as? SdsConstantString)?.value -} - -/** - * Checks if the parameter is annotated with the `safeds.lang.Constant` annotation. - */ -fun SdsParameter.isConstant(): Boolean { - return hasAnnotationCallTo(StdlibAnnotations.Constant) -} - -/** - * Checks if the declaration is annotated with the `safeds.lang.Deprecated` annotation. - */ -fun SdsAbstractDeclaration.isDeprecated(): Boolean { - return hasAnnotationCallTo(StdlibAnnotations.Deprecated) -} - -/** - * Checks if the declaration is annotated with the `safeds.lang.Experimental` annotation. - */ -fun SdsAbstractDeclaration.isExperimental(): Boolean { - return hasAnnotationCallTo(StdlibAnnotations.Experimental) -} - -/** - * Checks if the parameter is annotated with the `safeds.lang.Expert` annotation. - */ -fun SdsParameter.isExpert(): Boolean { - return hasAnnotationCallTo(StdlibAnnotations.Expert) -} - -/** - * Checks if the function is annotated with the `safeds.lang.Pure` annotation. - */ -fun SdsFunction.isPure(): Boolean { - return hasAnnotationCallTo(StdlibAnnotations.Pure) -} - -/** - * Checks if the annotation is annotated with the `safeds.lang.Repeatable` annotation. - */ -fun SdsAnnotation.isRepeatable(): Boolean { - return hasAnnotationCallTo(StdlibAnnotations.Repeatable) -} - -/** - * Checks if the function is annotated with the `safeds.lang.Pure` or the `safeds.lang.NoSideEffects` - * annotation. - */ -fun SdsFunction.hasNoSideEffects(): Boolean { - return isPure() || hasAnnotationCallTo(StdlibAnnotations.NoSideEffects) -} - -/** - * Returns the qualified name of the Python module that corresponds to this compilation unit. It is attached to the - * compilation unit with a `safeds.lang.PythonModule` annotation. - */ -fun SdsCompilationUnit.pythonModuleOrNull(): String? { - val value = annotationCallArgumentValueOrNull( - StdlibAnnotations.PythonModule, - "qualifiedName", - ) - return (value as? SdsConstantString)?.value -} - -/** - * Returns the name of the Python API element that corresponds to this declaration. It is attached to the declaration - * with a `safeds.lang.PythonName` annotation. - */ -fun SdsAbstractDeclaration.pythonNameOrNull(): String? { - val value = annotationCallArgumentValueOrNull(StdlibAnnotations.PythonName, "name") - return (value as? SdsConstantString)?.value -} - -/** - * Returns the version when the declaration was added. This is attached to the declaration with a `safeds.lang.Since` - * annotation. - */ -fun SdsAbstractDeclaration.sinceVersionOrNull(): String? { - val value = annotationCallArgumentValueOrNull(StdlibAnnotations.Since, "version") - return (value as? SdsConstantString)?.value -} - -/** - * Returns the possible targets of this annotation. - */ -fun SdsAnnotation.validTargets(): List { - val targetAnnotationCall = uniqueAnnotationCallOrNull(StdlibAnnotations.Target) - ?: return AnnotationTarget.values().toList() - - return targetAnnotationCall - .argumentsOrEmpty() - .asSequence() - .mapNotNull { it.value.toConstantExpressionOrNull() } - .filterIsInstance() - .mapNotNull { it.value.qualifiedNameOrNull() } - .filter { it.segmentCount == 4 && it.skipLast(1) == AnnotationTarget.enum } - .mapNotNull { AnnotationTarget.valueOfOrNull(it.lastSegment) } - .toList() -} - -/** - * Returns whether this [SdsAbstractDeclaration] has at least one annotation call to the annotation with the given - * qualified name. - */ -private fun SdsAbstractDeclaration.hasAnnotationCallTo(qualifiedName: QualifiedName): Boolean { - return annotationCallsOrEmpty().any { - it.annotation.qualifiedNameOrNull() == qualifiedName - } -} - -/** - * Finds the unique call to a declaration with the given qualified name and looks up the value assigned to the parameter - * with the given name. - */ -private fun SdsAbstractDeclaration.annotationCallArgumentValueOrNull( - qualifiedName: QualifiedName, - parameterName: String, -): SdsConstantExpression? { - return uniqueAnnotationCallOrNull(qualifiedName) - .argumentsOrEmpty() - .uniqueOrNull { it.parameterOrNull()?.name == parameterName } - ?.toConstantExpressionOrNull() -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibClasses.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibClasses.kt deleted file mode 100644 index 79b51789e..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibClasses.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("MemberVisibilityCanBePrivate") - -package com.larsreimann.safeds.stdlibAccess - -import org.eclipse.xtext.naming.QualifiedName - -/** - * Important classes in the standard library. - */ -object StdlibClasses { - val Any: QualifiedName = StdlibPackages.lang.append("Any") - val Boolean: QualifiedName = StdlibPackages.lang.append("Boolean") - val Number: QualifiedName = StdlibPackages.lang.append("Number") - val Float: QualifiedName = StdlibPackages.lang.append("Float") - val Int: QualifiedName = StdlibPackages.lang.append("Int") - val Nothing: QualifiedName = StdlibPackages.lang.append("Nothing") - val String: QualifiedName = StdlibPackages.lang.append("String") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibEnums.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibEnums.kt deleted file mode 100644 index 03118ce46..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibEnums.kt +++ /dev/null @@ -1,39 +0,0 @@ -@file:Suppress("MemberVisibilityCanBePrivate") - -package com.larsreimann.safeds.stdlibAccess - -import org.eclipse.xtext.naming.QualifiedName - -/** - * Important enums in the standard library. - */ -object StdlibEnums { - - /** - * Describes declaration types that can be targeted by annotations. - */ - enum class AnnotationTarget { - Annotation, - Attribute, - Class, - CompilationUnit, - Enum, - EnumVariant, - Function, - Parameter, - Pipeline, - Result, - Step, - TypeParameter, - - ; - - companion object { - val enum: QualifiedName = QualifiedName.create("safeds", "lang", "AnnotationTarget") - - fun valueOfOrNull(name: String): AnnotationTarget? { - return values().firstOrNull { it.name == name } - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibLoader.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibLoader.kt deleted file mode 100644 index d98790578..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibLoader.kt +++ /dev/null @@ -1,124 +0,0 @@ -package com.larsreimann.safeds.stdlibAccess - -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.resourceSetOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.scoping.allGlobalDeclarations -import org.eclipse.core.runtime.FileLocator -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.xtext.naming.QualifiedName -import java.nio.file.FileSystem -import java.nio.file.FileSystems -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths -import java.util.WeakHashMap - -private val cache = WeakHashMap>() -private val classLoader = object {}.javaClass.classLoader - -/** - * Loads the standard library into this resource set. - */ -fun ResourceSet.loadStdlib() { - listStdlibFiles().forEach { (path, uri) -> - createResource(uri).load(Files.newInputStream(path), loadOptions) - } -} - -/** - * Lists all files that comprise the standard library. - */ -fun listStdlibFiles(): Sequence> { - val resourcesUrl = classLoader.getResource("stdlib") ?: return emptySequence() - val resourcesUri = FileLocator.resolve(resourcesUrl).toURI() - - return sequence { - var fileSystem: FileSystem? = null - val stdlibBase = when (resourcesUri.scheme) { - - // Without this code tests fail with a FileSystemNotFoundException since stdlib resources are in a jar - "jar" -> { - fileSystem = FileSystems.newFileSystem( - resourcesUri, - emptyMap(), - null - ) - fileSystem.getPath("stdlib") - } - else -> Paths.get(resourcesUri) - } - - val stdlibFiles = Files.walk(stdlibBase) - .filter { it.toString().endsWith(".${SdsFileExtension.Stub}") } - - for (path in stdlibFiles) { - val relativePath = path.toString().replace("stdlib/", "") - val uri = URI.createURI("$resourcesUri/$relativePath".replace("%3A", ":")) - yield(path to uri) - } - - fileSystem?.close() - } -} - -/** - * Returns the [SdsClass] with the given [QualifiedName] within this context. If the declaration cannot be found, `null` - * is returned. - * - * @receiver The context for the search. - */ -fun EObject.getStdlibClassOrNull(qualifiedName: QualifiedName): SdsClass? { - return getStdlibDeclarationOrNull(qualifiedName) -} - -/** - * Returns the declaration with the given [QualifiedName] within this context. If the declaration cannot be found, - * `null` is returned. - * - * @receiver The context for the search. - */ -private inline fun EObject.getStdlibDeclarationOrNull( - qualifiedName: QualifiedName -): T? { - return try { - getStdlibDeclaration(qualifiedName) - } catch (e: IllegalStateException) { - null - } -} - -/** - * Returns the declaration with the given [QualifiedName] within this context. If the declaration cannot be found an - * exception is thrown. - * - * @receiver The context for the search. - * @throws IllegalStateException If the context is not in a resource set. - * @throws IllegalStateException If no declaration with the qualified name exists in the resource set. - * @throws IllegalStateException If the declaration with the qualified name does not have the desired type. - */ -private inline fun EObject.getStdlibDeclaration(qualifiedName: QualifiedName): T { - val resourceSet = resourceSetOrNull() ?: throw IllegalStateException("This context is not in a resource set.") - val cacheForResourceSet = cache.getOrPut(resourceSet) { WeakHashMap() } - - val eObject = cacheForResourceSet.computeIfAbsent(qualifiedName) { - val description = allGlobalDeclarations() - .find { it.qualifiedName == qualifiedName } - ?: throw IllegalStateException("Failed to load stdlib declaration '$qualifiedName'.") - - var eObject = description.eObjectOrProxy - if (eObject != null && eObject.eIsProxy()) { - eObject = eResource().resourceSet.getEObject(description.eObjectURI, true) - } - - eObject - } - - return when (eObject) { - is T -> eObject - else -> throw IllegalStateException("Stdlib declaration '$qualifiedName' is not an ${T::class.simpleName}.") - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibPackages.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibPackages.kt deleted file mode 100644 index 637a93ac8..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibPackages.kt +++ /dev/null @@ -1,16 +0,0 @@ -@file:Suppress("MemberVisibilityCanBePrivate") - -package com.larsreimann.safeds.stdlibAccess - -import org.eclipse.xtext.naming.QualifiedName - -/** - * Important packages in the standard library. - */ -object StdlibPackages { - - /** - * Core package that is implicitly imported into all Safe-DS programs. - */ - val lang: QualifiedName = QualifiedName.create("safeds", "lang") -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibDocumentation/DocumentationGenerator.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibDocumentation/DocumentationGenerator.kt deleted file mode 100644 index 5dc2123e8..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibDocumentation/DocumentationGenerator.kt +++ /dev/null @@ -1,369 +0,0 @@ -// The duplication gives us the flexibility to change parts of the generated Markdown individually -@file:Suppress("DuplicatedCode") - -package com.larsreimann.safeds.stdlibDocumentation - -import com.larsreimann.safeds.emf.classMembersOrEmpty -import com.larsreimann.safeds.emf.containingCompilationUnitOrNull -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.emf.variantsOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.scoping.allGlobalDeclarations -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.stdlibAccess.descriptionOrNull -import com.larsreimann.safeds.stdlibAccess.validTargets -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.EcoreUtil2 -import java.nio.file.Path -import kotlin.io.path.createDirectories -import kotlin.io.path.writeText - -private val horizontalRule = "-".repeat(10) - -private val autogenWarning = """ - | -""".trimMargin() - -/** - * Generates documentation for all declarations that are visible from the given context. - * - * @receiver The context. - * @param outputDirectory Where to place the created files. - */ -fun EObject.generateDocumentation(outputDirectory: Path) { - outputDirectory.toFile().deleteRecursively() - outputDirectory.createDirectories() - - val packagesToDeclarations: Map> = allGlobalDeclarations() - .map { it.eObjectOrProxy } - .filter { it.containingCompilationUnitOrNull()?.name != null } - .groupBy { it.containingCompilationUnitOrNull()!!.name } - - createReadme(outputDirectory, packagesToDeclarations) - createPackageFiles(outputDirectory, packagesToDeclarations) -} - -private fun createReadme(outputDirectory: Path, packagesToDeclarations: Map>) { - val packagesDocumentation = packagesToDeclarations.keys - .sorted() - .joinToString(separator = "\n") { packageName -> - "* [$packageName](./${packageName.replace(".", "_")}.md)" - } - - outputDirectory.resolve("README.md").writeText( - """ - |$autogenWarning - | - |# Safe-DS API Documentation - | - |## Packages - | - |$packagesDocumentation - | - """.trimMargin(), - ) -} - -private fun createPackageFiles(outputDirectory: Path, packagesToDeclarations: Map>) { - packagesToDeclarations.forEach { (packageName, globalDeclarations) -> - createPackageFile(outputDirectory, packageName, globalDeclarations) - } -} - -private fun createPackageFile(outputDirectory: Path, packageName: String, globalDeclarations: List) { - outputDirectory - .resolve("${packageName.replace(".", "_")}.md") - .writeText(createPackageDocumentation(packageName, globalDeclarations)) -} - -private fun createPackageDocumentation( - packageName: String, - globalDeclarations: List, -) = buildString { - val classes = globalDeclarations.filterIsInstance().sortedBy { it.name } - val globalFunctions = globalDeclarations.filterIsInstance().sortedBy { it.name } - val enums = globalDeclarations.filterIsInstance().sortedBy { it.name } - val annotations = globalDeclarations.filterIsInstance().sortedBy { it.name } - - appendLine("$autogenWarning\n") - - appendLine("# Package `$packageName`") - - if (annotations.isNotEmpty() || classes.isNotEmpty() || enums.isNotEmpty() || globalFunctions.isNotEmpty()) { - appendLine() - } - - // Classes - classes.forEach { - appendLine(createClassDocumentation(it, nestingLevel = 2)) - if (it != classes.last()) { - appendLine("$horizontalRule\n") - } - } - - // Global functions - if (globalFunctions.isNotEmpty()) { - appendLine("## Global Functions\n") - globalFunctions.forEach { - appendLine(createFunctionDocumentation(it, nestingLevel = 3, isGlobalFunction = true)) - } - } - - // Enums - enums.forEach { - appendLine(createEnumDocumentation(it, nestingLevel = 2)) - } - - // Annotations - annotations.forEach { - appendLine(createAnnotationDocumentation(it)) - } -} - -private fun createAnnotationDocumentation(annotation: SdsAnnotation) = buildString { - // Heading - appendLine("## Annotation `${annotation.name}`") - - // Description - appendLine(annotation.descriptionOrAltText()) - - // Parameters - if (annotation.parametersOrEmpty().isNotEmpty()) { - append("\n" + createParametersDocumentation(annotation.parametersOrEmpty())) - } - - // Targets - appendLine("\n**Valid targets:**\n") - val validTargets = annotation - .validTargets() - .sortedBy { it.name } - .joinToString(separator = "\n") { - "* ${it.name}" - } - appendLine(validTargets) -} - -private fun createAttributeDocumentation(attribute: SdsAttribute) = buildString { - // Remember description before annotation calls are removed - val description = attribute.descriptionOrAltText() - - // Remove annotation calls, so they don't show up in the serialized code - attribute.annotationCalls - .toList() - .forEach { annotationCall -> - EcoreUtil2.remove(annotationCall) - } - - // Try to serialize the attribute - val itemHeading = when (val serializationResult = attribute.serializeToFormattedString()) { - is SerializationResult.Success -> "`${serializationResult.code}`" - else -> attribute.name - } - - // Heading - append("* $itemHeading") - - // Description - appendLine(" - $description") -} - -private fun createClassDocumentation(`class`: SdsClass, nestingLevel: Int): String = buildString { - val attributes = `class`.classMembersOrEmpty().filterIsInstance().sortedBy { it.name } - val methods = `class`.classMembersOrEmpty().filterIsInstance().sortedBy { it.name } - val classes = `class`.classMembersOrEmpty().filterIsInstance().sortedBy { it.name } - val enums = `class`.classMembersOrEmpty().filterIsInstance().sortedBy { it.name } - - // Heading - if (isGlobal(nestingLevel)) { - appendLine("## Class `${`class`.name}`") - } else { - appendLine("${heading(nestingLevel)} Nested Class `${`class`.name}") - } - - // Description - appendLine(`class`.descriptionOrAltText()) - - // Constructor - appendLine("\n" + createConstructorDocumentation(`class`)) - - // Attributes - if (attributes.isNotEmpty()) { - appendLine("**Attributes:**\n") - attributes.forEach { - append(createAttributeDocumentation(it)) - } - appendLine() - } - - // Methods - methods.forEach { - appendLine(createFunctionDocumentation(it, nestingLevel + 1, isGlobalFunction = false)) - } - - // Classes - classes.forEach { - appendLine(createClassDocumentation(it, nestingLevel + 1)) - } - - // Enums - enums.forEach { - appendLine(createEnumDocumentation(it, nestingLevel + 1)) - } -} - -private fun createConstructorDocumentation(`class`: SdsClass) = buildString { - if (`class`.parameterList == null) { - appendLine("**Constructor:** _Class has no constructor._") - } else if (`class`.parametersOrEmpty().isEmpty()) { - appendLine("**Constructor parameters:** _None expected._") - } else { - appendLine("**Constructor parameters:**\n") - `class`.parametersOrEmpty().forEach { - appendLine(createParameterDocumentation(it)) - } - } -} - -private fun createEnumDocumentation(enum: SdsEnum, nestingLevel: Int) = buildString { - val variants = enum.variantsOrEmpty().sortedBy { it.name } - - // Heading - if (isGlobal(nestingLevel)) { - appendLine("## Enum `${enum.name}`") - } else { - appendLine("${heading(nestingLevel)} Nested Enum `${enum.name}") - } - - // Description - appendLine(enum.descriptionOrAltText()) - - // Variants - variants.forEach { - appendLine(createEnumVariantDocumentation(it, nestingLevel + 1)) - } -} - -private fun createEnumVariantDocumentation(enumVariant: SdsEnumVariant, nestingLevel: Int) = buildString { - // Heading - appendLine("${heading(nestingLevel)} Enum Variant `${enumVariant.name}`") - - // Description - appendLine(enumVariant.descriptionOrAltText()) - - // Parameters - appendLine("\n" + createParametersDocumentation(enumVariant.parametersOrEmpty())) -} - -private fun SdsAbstractDeclaration.descriptionOrAltText(): String { - return descriptionOrNull() ?: "_No description available._" -} - -private fun createFunctionDocumentation(function: SdsFunction, nestingLevel: Int, isGlobalFunction: Boolean) = buildString { - // Heading - if (isGlobalFunction) { - appendLine("## Global Function `${function.name}`") - } else if (function.isStatic) { - appendLine("${heading(nestingLevel)} `${function.name}` (Static Method)") - } else { - appendLine("${heading(nestingLevel)} `${function.name}` (Instance Method )") - } - - // Description - appendLine(function.descriptionOrAltText()) - - // Parameters - appendLine("\n" + createParametersDocumentation(function.parametersOrEmpty())) - - // Results - append(createResultsDocumentation(function.resultsOrEmpty())) -} - -private fun createParametersDocumentation(parameters: List) = buildString { - if (parameters.isEmpty()) { - appendLine("**Parameters:** _None expected._") - } else { - appendLine("**Parameters:**\n") - parameters.forEach { - appendLine(createParameterDocumentation(it)) - } - } -} - -private fun createParameterDocumentation(parameter: SdsParameter) = buildString { - // Remember description before annotation calls are removed - val description = parameter.descriptionOrAltText() - - // Remove annotation calls, so they don't show up in the serialized code - parameter.annotationCalls - .toList() - .forEach { annotationCall -> - EcoreUtil2.remove(annotationCall) - } - - // Try to serialize the parameter - val itemHeading = when (val serializationResult = parameter.serializeToFormattedString()) { - is SerializationResult.Success -> "`${serializationResult.code}`" - else -> parameter.name - } - - // Heading - append("* $itemHeading") - - // Description - append(" - $description") -} - -private fun createResultsDocumentation(result: List) = buildString { - if (result.isEmpty()) { - appendLine("**Results:** _None returned._") - } else { - appendLine("**Results:**\n") - result.forEach { - appendLine(createResultDocumentation(it)) - } - } -} - -private fun createResultDocumentation(result: SdsResult) = buildString { - // Remember description before annotation calls are removed - val description = result.descriptionOrAltText() - - // Remove annotation calls, so they don't show up in the serialized code - result.annotationCalls - .toList() - .forEach { annotationCall -> - EcoreUtil2.remove(annotationCall) - } - - // Try to serialize the result - val itemHeading = when (val serializationResult = result.serializeToFormattedString()) { - is SerializationResult.Success -> "`${serializationResult.code}`" - else -> result.name - } - - // Heading - append("* $itemHeading") - - // Description - append(" - $description") -} - -/** - * Creates the appropriate Markdown keyword for a heading with this [nestingLevel]. Markdown allows up to six levels of - * headings. - */ -private fun heading(nestingLevel: Int): String { - return "#".repeat(minOf(nestingLevel, 6)) -} - -private fun isGlobal(nestingLevel: Int) = nestingLevel == 2 diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibDocumentation/Main.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibDocumentation/Main.kt deleted file mode 100644 index 0bbee0236..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/stdlibDocumentation/Main.kt +++ /dev/null @@ -1,63 +0,0 @@ -package com.larsreimann.safeds.stdlibDocumentation - -import com.google.inject.Inject -import com.google.inject.Provider -import com.larsreimann.safeds.SafeDSStandaloneSetup -import com.larsreimann.safeds.emf.compilationUnitOrNull -import com.larsreimann.safeds.stdlibAccess.loadStdlib -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.xtext.diagnostics.Severity -import org.eclipse.xtext.util.CancelIndicator -import org.eclipse.xtext.validation.CheckMode -import org.eclipse.xtext.validation.IResourceValidator -import java.nio.file.Path -import kotlin.system.exitProcess - -@Suppress("unused") -class Main @Inject constructor( - private val resourceSetProvider: Provider, - private val validator: IResourceValidator -) { - - fun runStdlibDocumentationGenerator(outputDirectory: Path) { - - // Load the standard library - val resourceSet = resourceSetProvider.get() - resourceSet.loadStdlib() - - // Validate all resources - var hasErrors = false - resourceSet.resources.forEach { resource -> - val issues = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl) - if (issues.any { it.severity == Severity.ERROR }) { - issues.forEach { println(it) } - hasErrors = true - } - } - - if (hasErrors) { - System.err.println("Aborting: A resource has errors.") - exitProcess(20) - } else { - val context = resourceSet.resources.getOrNull(0)?.compilationUnitOrNull() - if (context == null) { - System.err.println("Aborting: Resource set is empty.") - exitProcess(30) - } - context.generateDocumentation(outputDirectory) - } - - println("Generation of stdlib documentation finished.") - } -} - -fun main(args: Array) { - if (args.isEmpty()) { - System.err.println("Aborting: No path to output directory provided.") - exitProcess(10) - } - - val injector = SafeDSStandaloneSetup().createInjectorAndDoEMFRegistration() - val main = injector.getInstance(Main::class.java) - main.runStdlibDocumentationGenerator(Path.of(args[0])) -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/CollectionExtensions.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/CollectionExtensions.kt deleted file mode 100644 index 66b74f82b..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/CollectionExtensions.kt +++ /dev/null @@ -1,58 +0,0 @@ -package com.larsreimann.safeds.utils - -import kotlin.math.max - -/** - * Creates a list of all elements in the iterable that the labeler maps to the same label as at least one other element. - * Values that are mapped to `null` by the labeler are removed. - */ -internal fun Iterable.duplicatesBy(labeler: (I) -> K): List { - return this - .groupBy(labeler) - .filterKeys { it != null } - .values - .filter { it.size > 1 } - .flatten() -} - -/** - * Creates a list of all elements in the iterable that the labeler maps to a unique label. Values that are mapped to - * `null` by the labeler are removed. - */ -internal fun Iterable.uniqueBy(labeler: (I) -> K): List { - return this - .groupBy(labeler) - .filterKeys { it != null } - .values - .filter { it.size == 1 } - .flatten() -} - -/** - * Returns the unique element in the iterable that matches the filter or `null` if none or multiple exist. - */ -internal fun Iterable.uniqueOrNull(filter: (I) -> Boolean = { true }): I? { - val candidates = this.filter(filter) - return when (candidates.size) { - 1 -> candidates[0] - else -> null - } -} - -/** - * Returns `null` if this [List] is empty. Otherwise, calls [init] on the list. - */ -internal fun List.nullIfEmptyElse(init: (List) -> O): O? { - return ifEmpty { null }?.let { init(it) } -} - -/** - * Maps corresponding elements of the left and right list using the given zipper. The shorter list is padded with - * `null`s at the end, so the resulting list has the same length as the longer list. - */ -internal fun outerZipBy(left: List, right: List, zipper: (L?, R?) -> O): List { - val maxSize = max(left.size, right.size) - return (0 until maxSize).map { i -> - zipper(left.getOrNull(i), right.getOrNull(i)) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/IdManager.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/IdManager.kt deleted file mode 100644 index 649c23ffe..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/IdManager.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.larsreimann.safeds.utils - -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import java.util.WeakHashMap - -/** - * The ID of an object. - */ -@JvmInline -@Suppress("unused") -value class Id(val value: Int) - -/** - * Handles the mapping of objects, usually [SdsAbstractObject]s in the Safe-DS AST, to their IDs. - */ -class IdManager { - - /** - * Maps an object to an ID. - */ - private val objToId = WeakHashMap>() - - /** - * Maps an ID to an object. - */ - private val idToObj = WeakHashMap, UPPER>() - - /** - * The next available ID. - */ - private var nextId = 0 - - /** - * Assigns the next available ID to the given object unless it already has one and returns the ID for this object. - */ - fun assignIdIfAbsent(obj: T): Id { - if (obj !in objToId) { - val id = nextId() - objToId[obj] = id - idToObj[id] = obj - } - - // We only write to objToId here and can be sure the stored ID has the correct type - @Suppress("UNCHECKED_CAST") - return objToId[obj]!! as Id - } - - /** - * Returns the next available ID. - */ - private fun nextId() = Id(nextId++) - - /** - * Returns the object with the given ID or `null` if the ID was not assigned yet. - */ - fun getObjectById(id: Id<*>) = idToObj[id] - - /** - * Checks if the given object already has an ID. - */ - fun knowsObject(obj: Any) = obj in objToId - - /** - * Check if the given ID has already been assigned to some object. - */ - fun knowsId(id: Id<*>) = id in idToObj - - /** - * Removes all mappings between object and ID and resets the counter. - */ - fun reset() { - objToId.clear() - idToObj.clear() - nextId = 0 - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/MarkerAnnotations.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/MarkerAnnotations.kt deleted file mode 100644 index 6c3677905..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/MarkerAnnotations.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.larsreimann.safeds.utils - -/** - * The marked API element is experimental and may be changed or removed at any time without a major version bump. Use - * with caution! - */ -@RequiresOptIn(level = RequiresOptIn.Level.ERROR) -@Retention(AnnotationRetention.BINARY) -annotation class ExperimentalSdsApi diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/AbstractSafeDSChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/AbstractSafeDSChecker.kt deleted file mode 100644 index cbc54055c..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/AbstractSafeDSChecker.kt +++ /dev/null @@ -1,116 +0,0 @@ -package com.larsreimann.safeds.validation - -import com.larsreimann.safeds.safeDS.SafeDSPackage -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.EStructuralFeature -import org.eclipse.xtext.validation.EValidatorRegistrar - -abstract class AbstractSafeDSChecker : AbstractSafeDSValidator() { - override fun register(registrar: EValidatorRegistrar) { - // This is overridden to prevent duplicate validation errors. - } - - protected fun List.reportDuplicateNames(message: (SdsAbstractDeclaration) -> String) { - this.duplicatesBy { it.name } - .forEach { - error( - message(it), - it, - SafeDSPackage.Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.REDECLARATION - ) - } - } - - fun error(message: String, feature: EStructuralFeature?, code: ErrorCode, vararg issueData: String) { - super.error(message, feature, code.name, *issueData) - } - - fun error(message: String, feature: EStructuralFeature?, index: Int, code: ErrorCode, vararg issueData: String) { - super.error(message, feature, index, code.name, *issueData) - } - - fun error( - message: String, - source: EObject, - feature: EStructuralFeature?, - code: ErrorCode, - vararg issueData: String - ) { - super.error(message, source, feature, code.name, *issueData) - } - - fun error( - message: String, - source: EObject, - feature: EStructuralFeature?, - index: Int, - code: ErrorCode, - vararg issueData: String - ) { - super.error(message, source, feature, index, code.name, *issueData) - } - - fun warning(message: String, feature: EStructuralFeature?, code: WarningCode, vararg issueData: String) { - super.warning(message, feature, code.name, *issueData) - } - - fun warning( - message: String, - feature: EStructuralFeature?, - index: Int, - code: WarningCode, - vararg issueData: String - ) { - super.warning(message, feature, index, code.name, *issueData) - } - - fun warning( - message: String, - source: EObject, - feature: EStructuralFeature?, - code: WarningCode, - vararg issueData: String - ) { - super.warning(message, source, feature, code.name, *issueData) - } - - fun warning( - message: String, - source: EObject, - feature: EStructuralFeature?, - index: Int, - code: WarningCode, - vararg issueData: String - ) { - super.warning(message, source, feature, index, code.name, *issueData) - } - - fun info(message: String, feature: EStructuralFeature?, code: InfoCode, vararg issueData: String) { - super.info(message, feature, code.name, *issueData) - } - - fun info(message: String, feature: EStructuralFeature?, index: Int, code: InfoCode, vararg issueData: String) { - super.info(message, feature, index, code.name, *issueData) - } - - fun info(message: String, source: EObject, feature: EStructuralFeature?, code: InfoCode, vararg issueData: String) { - super.info(message, source, feature, code.name, *issueData) - } - - fun info( - message: String, - source: EObject, - feature: EStructuralFeature?, - index: Int, - code: InfoCode, - vararg issueData: String - ) { - super.info(message, source, feature, index, code.name, *issueData) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/SafeDSValidator.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/SafeDSValidator.kt deleted file mode 100644 index 63e49efe3..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/SafeDSValidator.kt +++ /dev/null @@ -1,115 +0,0 @@ -package com.larsreimann.safeds.validation - -import com.larsreimann.safeds.validation.declarations.AnnotationChecker -import com.larsreimann.safeds.validation.declarations.AttributeChecker -import com.larsreimann.safeds.validation.declarations.ClassChecker -import com.larsreimann.safeds.validation.declarations.CompilationUnitChecker -import com.larsreimann.safeds.validation.declarations.DeclarationChecker -import com.larsreimann.safeds.validation.declarations.EnumChecker -import com.larsreimann.safeds.validation.declarations.EnumVariantChecker -import com.larsreimann.safeds.validation.declarations.FunctionChecker -import com.larsreimann.safeds.validation.declarations.ImportChecker -import com.larsreimann.safeds.validation.declarations.NameConventionChecker -import com.larsreimann.safeds.validation.declarations.ParameterChecker -import com.larsreimann.safeds.validation.declarations.ParameterListChecker -import com.larsreimann.safeds.validation.declarations.PipelineChecker -import com.larsreimann.safeds.validation.declarations.PlaceholderChecker -import com.larsreimann.safeds.validation.declarations.PredicateChecker -import com.larsreimann.safeds.validation.declarations.ResultChecker -import com.larsreimann.safeds.validation.declarations.StepChecker -import com.larsreimann.safeds.validation.declarations.TypeParameterChecker -import com.larsreimann.safeds.validation.expressions.ArgumentChecker -import com.larsreimann.safeds.validation.expressions.CallChecker -import com.larsreimann.safeds.validation.expressions.InfixOperationChecker -import com.larsreimann.safeds.validation.expressions.LambdaChecker -import com.larsreimann.safeds.validation.expressions.MemberAccessChecker -import com.larsreimann.safeds.validation.expressions.ReferenceChecker -import com.larsreimann.safeds.validation.expressions.TemplateStringChecker -import com.larsreimann.safeds.validation.other.AnnotationCallChecker -import com.larsreimann.safeds.validation.other.ArgumentListChecker -import com.larsreimann.safeds.validation.other.DeprecationChecker -import com.larsreimann.safeds.validation.other.ExperimentalChecker -import com.larsreimann.safeds.validation.other.ProtocolChecker -import com.larsreimann.safeds.validation.other.TypeArgumentListChecker -import com.larsreimann.safeds.validation.schema.SchemaChecker -import com.larsreimann.safeds.validation.statements.AssignmentChecker -import com.larsreimann.safeds.validation.statements.ExpressionsStatementChecker -import com.larsreimann.safeds.validation.typeChecking.ArgumentTypeChecker -import com.larsreimann.safeds.validation.typeChecking.DefaultValueTypeChecker -import com.larsreimann.safeds.validation.typeChecking.IndexedAccessTypeChecker -import com.larsreimann.safeds.validation.typeChecking.InfixOperationTypeChecker -import com.larsreimann.safeds.validation.typeChecking.PrefixOperationTypeChecker -import com.larsreimann.safeds.validation.typeChecking.YieldTypeChecker -import com.larsreimann.safeds.validation.types.CallableTypeChecker -import com.larsreimann.safeds.validation.types.NamedTypeChecker -import com.larsreimann.safeds.validation.types.UnionTypeChecker -import org.eclipse.xtext.validation.ComposedChecks - -/** - * This class contains custom validation rules. - * - * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation - */ -@ComposedChecks( - validators = [ - - // Declarations - AnnotationChecker::class, - AttributeChecker::class, - ClassChecker::class, - CompilationUnitChecker::class, - DeclarationChecker::class, - EnumChecker::class, - EnumVariantChecker::class, - FunctionChecker::class, - ImportChecker::class, - ParameterChecker::class, - ParameterListChecker::class, - PlaceholderChecker::class, - PredicateChecker::class, - ResultChecker::class, - PipelineChecker::class, - StepChecker::class, - TypeParameterChecker::class, - - NameConventionChecker::class, - - // Expressions - ArgumentChecker::class, - CallChecker::class, - InfixOperationChecker::class, - LambdaChecker::class, - MemberAccessChecker::class, - ReferenceChecker::class, - TemplateStringChecker::class, - - // Schema - SchemaChecker::class, - - // Statements - AssignmentChecker::class, - ExpressionsStatementChecker::class, - - // Type Checking - ArgumentTypeChecker::class, - DefaultValueTypeChecker::class, - IndexedAccessTypeChecker::class, - InfixOperationTypeChecker::class, - PrefixOperationTypeChecker::class, - YieldTypeChecker::class, - - // Types - CallableTypeChecker::class, - NamedTypeChecker::class, - UnionTypeChecker::class, - - // Other - AnnotationCallChecker::class, - ArgumentListChecker::class, - DeprecationChecker::class, - ExperimentalChecker::class, - ProtocolChecker::class, - TypeArgumentListChecker::class, - ], -) -class SafeDSValidator : AbstractSafeDSValidator() diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/ErrorCode.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/ErrorCode.kt deleted file mode 100644 index 4ada78291..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/ErrorCode.kt +++ /dev/null @@ -1,107 +0,0 @@ -package com.larsreimann.safeds.validation.codes - -enum class ErrorCode { - AttributeMustHaveType, - ParameterMustHaveType, - OnlyPredicatesCanHaveParameterOfSchemaType, - ResultMustHaveType, - OnlyPredicatesCanHaveResultOfSchemaType, - - CLASS_MUST_HAVE_UNIQUE_INHERITED_MEMBERS, - CLASS_MUST_HAVE_UNIQUE_PARENT_TYPES, - CLASS_MUST_INHERIT_ONLY_CLASSES, - CLASS_MUST_NOT_BE_SUBTYPE_OF_ITSELF, - REDECLARATION, - - FileMustDeclarePackage, - StubFileMustNotDeclarePipelinesSchemasOrSteps, - PipelineFileMustOnlyDeclarePipelinesAndSteps, - SchemaFileMustOnlyDeclareSchemas, - - ANNOTATION_IS_SINGLE_USE, - DEPRECATED_REQUIRED_PARAMETER, - - UNRESOLVED_IMPORTED_NAMESPACE, - WILDCARD_IMPORT_WITH_ALIAS, - - NoRequiredParametersAfterFirstOptionalParameter, - NoMoreParametersAfterVariadicParameter, - NoVariadicParameterAfterOptionalParameter, - - NoYieldInPipeline, - - CONTEXT_OF_CALL_WITHOUT_RESULTS, - CONTEXT_OF_CALL_WITH_MANY_RESULTS, - NO_RECURSION, - RECEIVER_MUST_BE_CALLABLE, - CALLED_CLASS_MUST_HAVE_CONSTRUCTOR, - - INSTANCE_METHOD_MUST_BE_CALLED, - ENUM_VARIANT_MUST_BE_INSTANTIATED, - - MISSING_REQUIRED_PARAMETER, - NO_POSITIONAL_ARGUMENTS_AFTER_FIRST_NAMED_ARGUMENT, - TOO_MANY_ARGUMENTS, - TooManyTypeArguments, - UNIQUE_PARAMETERS, - UniqueTypeParameters, - - MISSING_REQUIRED_TYPE_PARAMETER, - NO_POSITIONAL_TYPE_ARGUMENTS_AFTER_FIRST_NAMED_TYPE_ARGUMENT, - - ASSIGNEE_WITHOUT_VALUE, - - MISSING_TYPE_ARGUMENT_LIST, - - UNION_TYPE_WITHOUT_TYPE_ARGUMENTS, - - NON_STATIC_PROPAGATES, - PURE_PROPAGATES, - STATIC_PROPAGATES, - - REDECLARATION_IN_OTHER_FILE, - - MISSING_ARGUMENT_LIST, - WRONG_TARGET, - - OneProtocolPerClass, - OnlyReferenceInstanceMembers, - - MissingTemplateExpression, - - MissingSafeAccess, - - UnassignedResult, - DuplicateResultAssignment, - MustBeConstant, - - MustNotStaticallyReferenceClass, - MustNotStaticallyReferenceEnum, - - DivisionByZero, - - UnsupportedAnnotationParameterType, - - LambdaMustBeTypedArgumentOrYielded, - - NoOptionalParametersInCallableType, - - VariadicParametersMustNotHaveDefaultValue, - VariadicParameterMustNotBeAssignedByName, - - BlockLambdaPrefix, - - WrongType, - - VarianceAndKind, - - ExpertMustBeOptional, - - AbstractPredicatesOnlyAllowedForSchemaEffects, - AbstractPredicatesOnlyAllowedInStdlib, - - // schema checking errors - DatasetCouldNotBeRead, - DatasetDoesNotHaveAColumn, - DatasetAlreadyHasAColumn, -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/InfoCode.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/InfoCode.kt deleted file mode 100644 index 3d3e17cd6..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/InfoCode.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.larsreimann.safeds.validation.codes - -enum class InfoCode { - - // Unnecessary syntax that can be simplified - UnnecessaryAssignment, - UnnecessaryArgumentList, - UnnecessaryBody, - UnnecessaryElvisOperator, - UnnecessarySafeAccess, - UnnecessaryParameterList, - UnnecessaryResultList, - UnnecessaryTypeArgumentList, - UnnecessaryTypeParameterList, - UnnecessaryUnionType, - - // Annotation calls - IdenticalPythonModule, - IdenticalPythonName, - PureImpliesNoSideEffects -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/WarningCode.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/WarningCode.kt deleted file mode 100644 index 766520489..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/codes/WarningCode.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.larsreimann.safeds.validation.codes - -enum class WarningCode { - - // Deprecation - AssignedDeclarationIsDeprecated, - CorrespondingParameterIsDeprecated, - CorrespondingTypeParameterIsDeprecated, - ReferencedDeclarationIsDeprecated, - - // Experimental - AssignedDeclarationIsExperimental, - CorrespondingParameterIsExperimental, - CorrespondingTypeParameterIsExperimental, - ReferencedDeclarationIsExperimental, - - // Name conventions - NameShouldBeLowerCamelCase, - NameShouldBeUpperCamelCase, - SegmentsShouldBeLowerCamelCase, - - // Unused declarations - UnusedParameter, - UnusedPlaceholder, - - // Other - DuplicateTarget, - ImplicitlyIgnoredResultOfCall, - PlaceholderIsRenamingOfDeclaration, - StatementDoesNothing, -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/AnnotationChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/AnnotationChecker.kt deleted file mode 100644 index 1df8d2220..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/AnnotationChecker.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.isConstant -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.EnumType -import com.larsreimann.safeds.staticAnalysis.typing.VariadicType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class AnnotationChecker : AbstractSafeDSChecker() { - - @Check - fun uniqueNames(sdsAnnotation: SdsAnnotation) { - sdsAnnotation.parametersOrEmpty().reportDuplicateNames { - "A parameter with name '${it.name}' exists already in this annotation." - } - } - - @Check - fun unnecessaryParameterList(sdsAnnotation: SdsAnnotation) { - if (sdsAnnotation.parameterList != null && sdsAnnotation.parametersOrEmpty().isEmpty()) { - info( - "Unnecessary parameter list.", - Literals.SDS_ABSTRACT_CALLABLE__PARAMETER_LIST, - InfoCode.UnnecessaryParameterList - ) - } - } - - private val validParameterTypes = setOf( - StdlibClasses.Boolean, - StdlibClasses.Float, - StdlibClasses.Int, - StdlibClasses.String, - ) - - @Check - fun parameterTypes(sdsAnnotation: SdsAnnotation) { - sdsAnnotation.parametersOrEmpty().forEach { - val unwrappedParameterType = when (val parameterType = it.type()) { - is VariadicType -> parameterType.elementType - else -> parameterType - } - - val isValid = when (unwrappedParameterType) { - is ClassType -> unwrappedParameterType.qualifiedName in validParameterTypes - is EnumType -> unwrappedParameterType.sdsEnum.isConstant() - else -> false - } - - if (!isValid) { - error( - "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum.", - it, - Literals.SDS_PARAMETER__TYPE, - ErrorCode.UnsupportedAnnotationParameterType - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/AttributeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/AttributeChecker.kt deleted file mode 100644 index b11dd959b..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/AttributeChecker.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class AttributeChecker : AbstractSafeDSChecker() { - - @Check - fun type(sdsAttribute: SdsAttribute) { - if (sdsAttribute.type == null) { - error( - "An attribute must have a type.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.AttributeMustHaveType - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ClassChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ClassChecker.kt deleted file mode 100644 index c7cdac44a..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ClassChecker.kt +++ /dev/null @@ -1,134 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.classMembersOrEmpty -import com.larsreimann.safeds.emf.objectsInBodyOrEmpty -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.parentTypesOrEmpty -import com.larsreimann.safeds.emf.protocolsOrEmpty -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.staticAnalysis.classHierarchy.inheritedNonStaticMembersOrEmpty -import com.larsreimann.safeds.staticAnalysis.classHierarchy.isSubtypeOf -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.UnresolvedType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class ClassChecker : AbstractSafeDSChecker() { - - @Check - fun acyclicSuperTypes(sdsClass: SdsClass) { - sdsClass.parentTypesOrEmpty() - .filter { - val resolvedClass = (it.type() as? ClassType)?.sdsClass - resolvedClass != null && resolvedClass.isSubtypeOf(sdsClass) - } - .forEach { - error( - "A class must not directly or indirectly be a subtype of itself.", - it, - null, - ErrorCode.CLASS_MUST_NOT_BE_SUBTYPE_OF_ITSELF, - ) - } - } - - @Check - fun body(sdsClass: SdsClass) { - if (sdsClass.body != null && sdsClass.objectsInBodyOrEmpty().isEmpty()) { - info( - "Unnecessary class body.", - Literals.SDS_CLASS__BODY, - InfoCode.UnnecessaryBody, - ) - } - } - - @Check - fun mustInheritOnlyClasses(sdsClass: SdsClass) { - sdsClass.parentTypesOrEmpty() - .filterNot { - val type = it.type() - type is ClassType || type is UnresolvedType - } - .forEach { - error( - "A class must only inherit classes.", - it, - null, - ErrorCode.CLASS_MUST_INHERIT_ONLY_CLASSES, - ) - } - } - - @Check - fun mustHaveUniqueInheritedMembers(sdsClass: SdsClass) { - sdsClass.inheritedNonStaticMembersOrEmpty() - .groupBy { it.name } - .forEach { (name, declarationsWithName) -> - if (declarationsWithName.size > 1) { - error( - "Inherits multiple members called '$name'.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.CLASS_MUST_HAVE_UNIQUE_INHERITED_MEMBERS, - ) - } - } - } - - @Check - fun uniqueNames(sdsClass: SdsClass) { - sdsClass.parametersOrEmpty() - .reportDuplicateNames { "A parameter with name '${it.name}' exists already in this class." } - - sdsClass.classMembersOrEmpty() - .reportDuplicateNames { "A declaration with name '${it.name}' exists already in this class." } - } - - @Check - fun uniqueParentTypes(sdsClass: SdsClass) { - sdsClass.parentTypesOrEmpty() - .duplicatesBy { (it.type() as? ClassType)?.sdsClass } - .forEach { - error( - "Parent types must be unique.", - it, - null, - ErrorCode.CLASS_MUST_HAVE_UNIQUE_PARENT_TYPES, - ) - } - } - - @Check - fun unnecessaryTypeParameterList(sdsClass: SdsClass) { - if (sdsClass.typeParameterList != null && sdsClass.typeParametersOrEmpty().isEmpty()) { - info( - "Unnecessary type parameter list.", - Literals.SDS_CLASS__TYPE_PARAMETER_LIST, - InfoCode.UnnecessaryTypeParameterList, - ) - } - } - - @OptIn(ExperimentalSdsApi::class) - @Check - fun multipleProtocols(sdsClass: SdsClass) { - val protocols = sdsClass.protocolsOrEmpty() - if (protocols.size > 1) { - protocols.forEach { - error( - "A class must have only one protocol.", - it, - null, - ErrorCode.OneProtocolPerClass, - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/CompilationUnitChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/CompilationUnitChecker.kt deleted file mode 100644 index 7ed9c26a4..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/CompilationUnitChecker.kt +++ /dev/null @@ -1,146 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.constant.isInPipelineFile -import com.larsreimann.safeds.constant.isInSchemaFile -import com.larsreimann.safeds.constant.isInStubFile -import com.larsreimann.safeds.constant.isInTestFile -import com.larsreimann.safeds.emf.compilationUnitMembersOrEmpty -import com.larsreimann.safeds.emf.importedNameOrNull -import com.larsreimann.safeds.emf.isQualified -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsImport -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsSchema -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.scoping.externalGlobalDeclarations -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class CompilationUnitChecker : AbstractSafeDSChecker() { - - @OptIn(ExperimentalSdsApi::class) - @Check - fun members(sdsCompilationUnit: SdsCompilationUnit) { - if (sdsCompilationUnit.isInStubFile()) { - sdsCompilationUnit.compilationUnitMembersOrEmpty() - .filter { it is SdsPipeline || it is SdsStep || it is SdsSchema } - .forEach { - error( - "A stub file must not declare pipelines, schemas or steps.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.StubFileMustNotDeclarePipelinesSchemasOrSteps, - ) - } - } else if (sdsCompilationUnit.isInPipelineFile()) { - sdsCompilationUnit.compilationUnitMembersOrEmpty() - .filter { it !is SdsPipeline && it !is SdsStep } - .forEach { - error( - "A pipeline file must only declare pipelines and steps.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.PipelineFileMustOnlyDeclarePipelinesAndSteps, - ) - } - } else if (sdsCompilationUnit.isInSchemaFile()) { - sdsCompilationUnit.compilationUnitMembersOrEmpty() - .filter { it !is SdsSchema } - .forEach { - error( - "A schema file must only declare schemas.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.SchemaFileMustOnlyDeclareSchemas, - ) - } - } - } - - @Check - fun uniquePackageDeclaration(sdsCompilationUnit: SdsCompilationUnit) { - if (sdsCompilationUnit.isInTestFile()) { - return - } - - if (sdsCompilationUnit.name == null) { - sdsCompilationUnit.compilationUnitMembersOrEmpty().firstOrNull()?.let { - error( - "A file with declarations must declare its package.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.FileMustDeclarePackage, - ) - } - } - } - - @Check - fun uniqueNames(sdsCompilationUnit: SdsCompilationUnit) { - val namedEObjects = sdsCompilationUnit.imports.filter { it.isQualified() } + sdsCompilationUnit.members - - namedEObjects.duplicatesBy { - when (it) { - is SdsImport -> it.importedNameOrNull() - is SdsAbstractDeclaration -> it.name - else -> null - } - }.forEach { - when { - it is SdsImport && it.alias == null -> { - error( - "A declaration with name '${it.importedNameOrNull()}' exists already in this file.", - it, - Literals.SDS_IMPORT__IMPORTED_NAMESPACE, - ErrorCode.REDECLARATION, - ) - } - it is SdsImport && it.alias != null -> { - error( - "A declaration with name '${it.importedNameOrNull()}' exists already in this file.", - it.alias, - Literals.SDS_IMPORT_ALIAS__NAME, - ErrorCode.REDECLARATION, - ) - } - it is SdsAbstractDeclaration -> { - error( - "A declaration with name '${it.name}' exists already in this file.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.REDECLARATION, - ) - } - } - } - } - - @Check(CheckType.NORMAL) - fun uniqueNamesAcrossFiles(sdsCompilationUnit: SdsCompilationUnit) { - // Since the stdlib is automatically loaded into a workspace, every declaration would be marked as a duplicate - // when editing the stdlib - if (sdsCompilationUnit.isInStubFile() && sdsCompilationUnit.name.startsWith("safeds")) { - return - } - - val externalGlobalDeclarations = sdsCompilationUnit.externalGlobalDeclarations() - sdsCompilationUnit.compilationUnitMembersOrEmpty().forEach { member -> - val qualifiedName = member.qualifiedNameOrNull() - if (externalGlobalDeclarations.any { it.qualifiedName == qualifiedName }) { - error( - "A declaration with qualified name '$qualifiedName' exists already.", - member, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.REDECLARATION_IN_OTHER_FILE, - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/DeclarationChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/DeclarationChecker.kt deleted file mode 100644 index 201f57b66..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/DeclarationChecker.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.annotationCallsOrEmpty -import com.larsreimann.safeds.emf.isRequired -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.stdlibAccess.StdlibAnnotations -import com.larsreimann.safeds.stdlibAccess.isRepeatable -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class DeclarationChecker : AbstractSafeDSChecker() { - - @Check - fun annotationCardinality(sdsDeclaration: SdsAbstractDeclaration) { - sdsDeclaration.annotationCallsOrEmpty() - .filter { it.annotation != null && !it.annotation.eIsProxy() && !it.annotation.isRepeatable() } - .duplicatesBy { it.annotation.qualifiedNameOrNull() } - .forEach { - error( - "This annotation can only be used once.", - it, - null, - ErrorCode.ANNOTATION_IS_SINGLE_USE - ) - } - } - - @Check - fun mustNotDeprecateRequiredParameter(sdsParameter: SdsParameter) { - if (sdsParameter.isRequired()) { - val deprecatedAnnotationOrNull = sdsParameter.annotationCallsOrEmpty().firstOrNull { - it.annotation.qualifiedNameOrNull() == StdlibAnnotations.Deprecated - } - - if (deprecatedAnnotationOrNull != null) { - error( - "A required parameter cannot be deprecated.", - deprecatedAnnotationOrNull, - null, - ErrorCode.DEPRECATED_REQUIRED_PARAMETER - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/EnumChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/EnumChecker.kt deleted file mode 100644 index a5ee4365d..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/EnumChecker.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.variantsOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class EnumChecker : AbstractSafeDSChecker() { - - @Check - fun body(sdsEnum: SdsEnum) { - if (sdsEnum.body != null && sdsEnum.variantsOrEmpty().isEmpty()) { - info( - "Unnecessary enum body.", - Literals.SDS_ENUM__BODY, - InfoCode.UnnecessaryBody - ) - } - } - - @Check - fun uniqueNames(sdsEnum: SdsEnum) { - sdsEnum.variantsOrEmpty() - .reportDuplicateNames { "A declaration with name '${it.name}' exists already in this enum." } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/EnumVariantChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/EnumVariantChecker.kt deleted file mode 100644 index 43d053b88..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/EnumVariantChecker.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class EnumVariantChecker : AbstractSafeDSChecker() { - - @Check - fun typeParameterList(sdsEnumVariant: SdsEnumVariant) { - if (sdsEnumVariant.typeParameterList != null && sdsEnumVariant.typeParametersOrEmpty().isEmpty()) { - info( - "Unnecessary type parameter list.", - Literals.SDS_ENUM_VARIANT__TYPE_PARAMETER_LIST, - InfoCode.UnnecessaryTypeParameterList - ) - } - } - - @Check - fun parameterList(sdsEnumVariant: SdsEnumVariant) { - if (sdsEnumVariant.parameterList != null && sdsEnumVariant.parametersOrEmpty().isEmpty()) { - info( - "Unnecessary parameter list.", - Literals.SDS_ABSTRACT_CALLABLE__PARAMETER_LIST, - InfoCode.UnnecessaryParameterList - ) - } - } - - @Check - fun uniqueNames(sdsEnumVariant: SdsEnumVariant) { - sdsEnumVariant.parametersOrEmpty() - .reportDuplicateNames { "A parameter with name '${it.name}' exists already in this enum variant." } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/FunctionChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/FunctionChecker.kt deleted file mode 100644 index 04cd79625..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/FunctionChecker.kt +++ /dev/null @@ -1,88 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.staticAnalysis.classHierarchy.hiddenFunction -import com.larsreimann.safeds.stdlibAccess.isPure -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class FunctionChecker : AbstractSafeDSChecker() { - - @Check - fun nonStaticPropagates(sdsFunction: SdsFunction) { - if (sdsFunction.isStatic) { - val hiddenFunction = sdsFunction.hiddenFunction() - if (hiddenFunction != null && !hiddenFunction.isStatic) { - error( - "One of the supertypes of this class declares a non-static function with this name, so this must be non-static as well.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.NON_STATIC_PROPAGATES - ) - } - } - } - - @Check - fun purePropagates(sdsFunction: SdsFunction) { - if (!sdsFunction.isPure()) { - val hiddenFunction = sdsFunction.hiddenFunction() - if (hiddenFunction != null && hiddenFunction.isPure()) { - error( - "One of the supertypes of this class declares a pure function with this name, so this must be pure as well.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.PURE_PROPAGATES - ) - } - } - } - - @Check - fun staticPropagates(sdsFunction: SdsFunction) { - if (!sdsFunction.isStatic) { - val hiddenFunction = sdsFunction.hiddenFunction() - if (hiddenFunction != null && hiddenFunction.isStatic) { - error( - "One of the supertypes of this class declares a static function with this name, so this must be static as well.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.STATIC_PROPAGATES - ) - } - } - } - - @Check - fun uniqueNames(sdsFunction: SdsFunction) { - val declarations = sdsFunction.parametersOrEmpty() + sdsFunction.resultsOrEmpty() - declarations.reportDuplicateNames { - "A parameter or result with name '${it.name}' exists already in this function." - } - } - - @Check - fun unnecessaryResultList(sdsFunction: SdsFunction) { - if (sdsFunction.resultList != null && sdsFunction.resultsOrEmpty().isEmpty()) { - info( - "Unnecessary result list.", - Literals.SDS_FUNCTION__RESULT_LIST, - InfoCode.UnnecessaryResultList - ) - } - } - - @Check - fun unnecessaryTypeParameterList(sdsFunction: SdsFunction) { - if (sdsFunction.typeParameterList != null && sdsFunction.typeParametersOrEmpty().isEmpty()) { - info( - "Unnecessary type parameter list.", - Literals.SDS_FUNCTION__TYPE_PARAMETER_LIST, - InfoCode.UnnecessaryTypeParameterList - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ImportChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ImportChecker.kt deleted file mode 100644 index 4f8fd3f2a..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ImportChecker.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.aliasNameOrNull -import com.larsreimann.safeds.emf.isQualified -import com.larsreimann.safeds.emf.isWildcard -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsImport -import com.larsreimann.safeds.scoping.allGlobalDeclarations -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.naming.QualifiedName -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class ImportChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun unresolvedNamespace(sdsImport: SdsImport) { - if (sdsImport.isQualified()) { - val importedNamespace = QualifiedName.create( - sdsImport.importedNamespace.split(".") - ) - - val isUnresolved = sdsImport - .allGlobalDeclarations() - .none { it.qualifiedName == importedNamespace } - - if (isUnresolved) { - error( - "No declaration with qualified name '$importedNamespace' exists.", - Literals.SDS_IMPORT__IMPORTED_NAMESPACE, - ErrorCode.UNRESOLVED_IMPORTED_NAMESPACE - ) - } - } else { - val importedNamespace = QualifiedName.create( - sdsImport.importedNamespace.removeSuffix(".*").split(".") - ) - - val isUnresolved = sdsImport - .allGlobalDeclarations() - .none { it.qualifiedName.startsWith(importedNamespace) } - - if (isUnresolved) { - error( - "No package with qualified name '$importedNamespace' exists.", - Literals.SDS_IMPORT__IMPORTED_NAMESPACE, - ErrorCode.UNRESOLVED_IMPORTED_NAMESPACE - ) - } - } - } - - @Check - fun wildcardImportWithAlias(sdsImport: SdsImport) { - if (sdsImport.isWildcard() && sdsImport.aliasNameOrNull() != null) { - error( - "A wildcard import must not have an alias.", - Literals.SDS_IMPORT__ALIAS, - ErrorCode.WILDCARD_IMPORT_WITH_ALIAS - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/NameConventionChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/NameConventionChecker.kt deleted file mode 100644 index fcfc29302..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/NameConventionChecker.kt +++ /dev/null @@ -1,163 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.constant.SdsSchemaEffect -import com.larsreimann.safeds.constant.nameToSchemaEffect -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsProtocolSubterm -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check - -class NameConventionChecker : AbstractSafeDSChecker() { - - @Check - fun segmentsShouldBeLowercase(sdsCompilationUnit: SdsCompilationUnit) { - val hasInvalidSegments = sdsCompilationUnit.name - .split('.') - .any { !it.isLowerCamelCase() } - - if (hasInvalidSegments) { - warning( - "All segments of the qualified name of a package should be lowerCamelCase.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - WarningCode.SegmentsShouldBeLowerCamelCase, - ) - } - } - - @Check - fun blockLambdaPrefix(sdsDeclaration: SdsAbstractDeclaration) { - if (sdsDeclaration.name.startsWith("__block_lambda_")) { - error( - "Names of declarations must not start with '__block_lambda_'. This is reserved for code generation of block lambdas.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.BlockLambdaPrefix, - ) - } - } - - @Check - fun annotationNamesShouldBeUpperCamelCase(sdsAnnotation: SdsAnnotation) { - sdsAnnotation.nameShouldBeUpperCamelCase("annotations") - } - - @Check - fun attributeNamesShouldBeLowerCamelCase(sdsAttribute: SdsAttribute) { - sdsAttribute.nameShouldBeLowerCamelCase("attributes") - } - - @Check - fun classNamesShouldBeUpperCamelCase(sdsClass: SdsClass) { - sdsClass.nameShouldBeUpperCamelCase("classes") - } - - @Check - fun enumNamesShouldBeUpperCamelCase(sdsEnum: SdsEnum) { - sdsEnum.nameShouldBeUpperCamelCase("enums") - } - - @Check - fun enumVariantNamesShouldBeUpperCamelCase(sdsEnumVariant: SdsEnumVariant) { - sdsEnumVariant.nameShouldBeUpperCamelCase("enum variants") - } - - @Check - fun functionNamesShouldBeLowerCamelCase(sdsFunction: SdsFunction) { - sdsFunction.nameShouldBeLowerCamelCase("functions") - } - - @Check - fun lambdaResultNamesShouldBeLowerCamelCase(sdsBlockLambdaResult: SdsBlockLambdaResult) { - sdsBlockLambdaResult.nameShouldBeLowerCamelCase("lambda results") - } - - @Check - fun parameterNamesShouldBeLowerCamelCase(sdsParameter: SdsParameter) { - sdsParameter.nameShouldBeLowerCamelCase("parameters") - } - - @Check - fun placeholderNamesShouldBeLowerCamelCase(sdsPlaceholder: SdsPlaceholder) { - sdsPlaceholder.nameShouldBeLowerCamelCase("placeholders") - } - - @OptIn(ExperimentalSdsApi::class) - @Check - fun predicateNamesShouldBeLowerCamelCase(sdsPredicate: SdsPredicate) { - if (sdsPredicate.nameToSchemaEffect() != SdsSchemaEffect.NoSchemaEffect) { - return - } - sdsPredicate.nameShouldBeLowerCamelCase("predicate") - } - - @Check - fun protocolSubtermNamesShouldBeLowerCamelCase(sdsProtocolSubterm: SdsProtocolSubterm) { - sdsProtocolSubterm.nameShouldBeLowerCamelCase("protocol subterms") - } - - @Check - fun resultNamesShouldBeLowerCamelCase(sdsResult: SdsResult) { - sdsResult.nameShouldBeLowerCamelCase("results") - } - - @Check - fun stepNamesShouldBeLowerCamelCase(sdsStep: SdsStep) { - sdsStep.nameShouldBeLowerCamelCase("steps") - } - - @Check - fun typeParameterNamesShouldBeUpperCamelCase(sdsTypeParameter: SdsTypeParameter) { - sdsTypeParameter.nameShouldBeUpperCamelCase("type parameters") - } - - @Check - fun pipelineNamesShouldBeLowerCamelCase(sdsPipeline: SdsPipeline) { - sdsPipeline.nameShouldBeLowerCamelCase("pipelines") - } - - private fun SdsAbstractDeclaration.nameShouldBeUpperCamelCase(declarationType: String) { - if (this.name != null && !this.name.isUpperCamelCase()) { - warning( - "Names of $declarationType should be UpperCamelCase.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - WarningCode.NameShouldBeUpperCamelCase, - ) - } - } - - private fun SdsAbstractDeclaration.nameShouldBeLowerCamelCase(declarationType: String) { - if (this.name != null && !this.name.isLowerCamelCase()) { - warning( - "Names of $declarationType should be lowerCamelCase.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - WarningCode.NameShouldBeLowerCamelCase, - ) - } - } - - private fun String.isUpperCamelCase(): Boolean { - return Regex("^[A-Z][a-zA-Z0-9]*$").matches(this) - } - - private fun String.isLowerCamelCase(): Boolean { - return Regex("^[a-z][a-zA-Z0-9]*$").matches(this) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ParameterChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ParameterChecker.kt deleted file mode 100644 index 0abff5bb4..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ParameterChecker.kt +++ /dev/null @@ -1,69 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.isOptional -import com.larsreimann.safeds.emf.isRequired -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractLambda -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParameterList -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.toConstantExpressionOrNull -import com.larsreimann.safeds.stdlibAccess.StdlibAnnotations -import com.larsreimann.safeds.stdlibAccess.annotationCallsOrEmpty -import com.larsreimann.safeds.stdlibAccess.isExpert -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class ParameterChecker : AbstractSafeDSChecker() { - - @Check - fun type(sdsParameter: SdsParameter) { - val parameterList = sdsParameter.closestAncestorOrNull() ?: return - if (sdsParameter.type == null && parameterList.eContainer() !is SdsAbstractLambda) { - error( - "A parameter must have a type.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.ParameterMustHaveType, - ) - } - } - - @Check(CheckType.NORMAL) - fun defaultValueMustBeConstant(sdsParameter: SdsParameter) { - val defaultValue = sdsParameter.defaultValue ?: return - if (defaultValue.toConstantExpressionOrNull() == null) { - error( - "Default values of parameters must be constant.", - Literals.SDS_PARAMETER__DEFAULT_VALUE, - ErrorCode.MustBeConstant, - ) - } - } - - @Check - fun variadicParametersMustHaveNoDefaultValue(sdsParameter: SdsParameter) { - if (sdsParameter.isVariadic && sdsParameter.isOptional()) { - error( - "Variadic parameters must not have default values.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.VariadicParametersMustNotHaveDefaultValue, - ) - } - } - - @Check - fun expertMustBeOptional(sdsParameter: SdsParameter) { - if (sdsParameter.isRequired() && sdsParameter.isExpert()) { - sdsParameter.annotationCallsOrEmpty(StdlibAnnotations.Expert).forEach { - error( - "An expert parameter must be optional.", - it, - null, - ErrorCode.MustBeConstant, - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ParameterListChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ParameterListChecker.kt deleted file mode 100644 index b0adc1f9b..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ParameterListChecker.kt +++ /dev/null @@ -1,59 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.isOptional -import com.larsreimann.safeds.emf.isRequired -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsParameterList -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class ParameterListChecker : AbstractSafeDSChecker() { - - @Check - fun noRequiredOrVariadicParametersAfterFirstOptionalParameter(sdsParameterList: SdsParameterList) { - val firstOptionalParameterIndex = sdsParameterList.parameters.indexOfFirst { it.isOptional() } - if (firstOptionalParameterIndex == -1) { - return - } - - sdsParameterList.parameters - .drop(firstOptionalParameterIndex + 1) - .forEach { - if (it.isRequired()) { - error( - "After the first optional parameter all parameters must be optional.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.NoRequiredParametersAfterFirstOptionalParameter - ) - } else if (it.isVariadic) { - error( - "A callable with optional parameters must not have a variadic parameter.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.NoVariadicParameterAfterOptionalParameter - ) - } - } - } - - @Check - fun noMoreParametersAfterVariadic(sdsParameterList: SdsParameterList) { - val firstVariadicParameterIndex = sdsParameterList.parameters.indexOfFirst { it.isVariadic } - if (firstVariadicParameterIndex == -1) { - return - } - - sdsParameterList.parameters - .drop(firstVariadicParameterIndex + 1) - .forEach { - error( - "After a variadic parameter no more parameters must be specified.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.NoMoreParametersAfterVariadicParameter - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PipelineChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PipelineChecker.kt deleted file mode 100644 index ee0ea6e27..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PipelineChecker.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.placeholdersOrEmpty -import com.larsreimann.safeds.emf.statementsOrEmpty -import com.larsreimann.safeds.emf.yieldsOrEmpty -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class PipelineChecker : AbstractSafeDSChecker() { - - @Check - fun noYield(sdsPipeline: SdsPipeline) { - sdsPipeline.statementsOrEmpty() - .filterIsInstance() - .flatMap { it.yieldsOrEmpty() } - .forEach { - error( - "Yield must not be used in a pipeline.", - it, - null, - ErrorCode.NoYieldInPipeline, - ) - } - } - - @Check - fun uniqueNames(sdsPipeline: SdsPipeline) { - sdsPipeline.placeholdersOrEmpty() - .reportDuplicateNames { "A declaration with name '${it.name}' exists already in this pipeline." } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PlaceholderChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PlaceholderChecker.kt deleted file mode 100644 index 6949997ca..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PlaceholderChecker.kt +++ /dev/null @@ -1,47 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsBlock -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.staticAnalysis.usesIn -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check - -class PlaceholderChecker : AbstractSafeDSChecker() { - - @Check - fun renamingOfDeclaration(sdsPlaceholder: SdsPlaceholder) { - val assigned = sdsPlaceholder.assignedOrNull() - if (assigned is SdsReference) { - val declaration = assigned.declaration - if (declaration is SdsClass || declaration is SdsEnum || declaration is SdsFunction || declaration is SdsParameter || declaration is SdsPlaceholder) - warning( - "This placeholder only provides another name for a declaration.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - WarningCode.PlaceholderIsRenamingOfDeclaration - ) - } - } - - @Check - fun unused(sdsPlaceholder: SdsPlaceholder) { - val block = sdsPlaceholder.closestAncestorOrNull() ?: return - val assignment = sdsPlaceholder.closestAncestorOrNull() ?: return - if (assignment != block.statements.lastOrNull() && sdsPlaceholder.usesIn(block).none()) { - warning( - "This placeholder is unused.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - WarningCode.UnusedPlaceholder - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PredicateChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PredicateChecker.kt deleted file mode 100644 index 47da78139..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/PredicateChecker.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.constant.SdsSchemaEffect -import com.larsreimann.safeds.constant.nameToSchemaEffect -import com.larsreimann.safeds.emf.isAbstract -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class PredicateChecker : AbstractSafeDSChecker() { - - @OptIn(ExperimentalSdsApi::class) - @Check - fun abstractPredicatedOnlyAllowedForSchemaEffects(sdsPredicate: SdsPredicate) { - if (sdsPredicate.isAbstract() && - sdsPredicate.nameToSchemaEffect() == SdsSchemaEffect.NoSchemaEffect - ) { - error( - "Abstract predicates can only be declared for schema effects.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.AbstractPredicatesOnlyAllowedForSchemaEffects, - ) - } - } - - @OptIn(ExperimentalSdsApi::class) - @Check - fun abstractPredicatedOnlyAllowedInStdlib(sdsPredicate: SdsPredicate) { - if (sdsPredicate.isAbstract() && - !(sdsPredicate.qualifiedNameOrNull()?.toString()?.startsWith("safeds.lang") ?: false) - ) { - error( - "Abstract predicates can only be declared in standard library.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.AbstractPredicatesOnlyAllowedInStdlib, - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ResultChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ResultChecker.kt deleted file mode 100644 index 821cf83f3..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/ResultChecker.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class ResultChecker : AbstractSafeDSChecker() { - - @Check - fun type(sdsResult: SdsResult) { - if (sdsResult.type == null) { - error( - "A result must have a type.", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.ResultMustHaveType, - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/StepChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/StepChecker.kt deleted file mode 100644 index 07fc2bad3..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/StepChecker.kt +++ /dev/null @@ -1,82 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.emf.asResolvedOrNull -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.placeholdersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.emf.yieldsOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.staticAnalysis.linking.yieldsOrEmpty -import com.larsreimann.safeds.staticAnalysis.usesIn -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check - -class StepChecker : AbstractSafeDSChecker() { - - @Check - fun parameterIsUnused(sdsStep: SdsStep) { - sdsStep.parametersOrEmpty() - .filter { it.usesIn(sdsStep).none() } - .forEach { - warning( - "This parameter is unused.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - WarningCode.UnusedParameter - ) - } - } - - @Check - fun uniqueNames(sdsStep: SdsStep) { - val declarations = - sdsStep.parametersOrEmpty() + sdsStep.resultsOrEmpty() + sdsStep.placeholdersOrEmpty() - declarations.reportDuplicateNames { - "A parameter, result or placeholder with name '${it.name}' exists already in this step." - } - } - - @Check - fun unnecessaryResultList(sdsStep: SdsStep) { - if (sdsStep.resultList != null && sdsStep.resultsOrEmpty().isEmpty()) { - info( - "Unnecessary result list.", - Literals.SDS_STEP__RESULT_LIST, - InfoCode.UnnecessaryResultList - ) - } - } - - @Check - fun unassignedResult(sdsStep: SdsStep) { - sdsStep.resultsOrEmpty().forEach { - if (it.yieldsOrEmpty().isEmpty()) { - error( - "No value is assigned to this result.", - it, - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.UnassignedResult - ) - } - } - } - - @Check - fun duplicateResultAssignment(sdsStep: SdsStep) { - sdsStep.yieldsOrEmpty() - .duplicatesBy { it.result.asResolvedOrNull() } - .forEach { - error( - "This result is assigned multiple times.", - it, - Literals.SDS_YIELD__RESULT, - ErrorCode.DuplicateResultAssignment - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/TypeParameterChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/TypeParameterChecker.kt deleted file mode 100644 index 8c9bd38e4..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/declarations/TypeParameterChecker.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.larsreimann.safeds.validation.declarations - -import com.larsreimann.safeds.constant.SdsKind -import com.larsreimann.safeds.constant.SdsVariance -import com.larsreimann.safeds.constant.kind -import com.larsreimann.safeds.constant.variance -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class TypeParameterChecker : AbstractSafeDSChecker() { - - @OptIn(ExperimentalSdsApi::class) - @Check - fun mustNotHaveVarianceAndKind(sdsTypeParameter: SdsTypeParameter) { - if (sdsTypeParameter.variance() != SdsVariance.Invariant && sdsTypeParameter.kind() != SdsKind.NoKind) { - error( - "Can not use variance and kind together", - Literals.SDS_ABSTRACT_DECLARATION__NAME, - ErrorCode.VarianceAndKind, - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/ArgumentChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/ArgumentChecker.kt deleted file mode 100644 index fae5ef03f..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/ArgumentChecker.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.larsreimann.safeds.validation.expressions - -import com.larsreimann.safeds.emf.isNamed -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.toConstantExpressionOrNull -import com.larsreimann.safeds.stdlibAccess.isConstant -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class ArgumentChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun argumentMustBeConstant(sdsArgument: SdsArgument) { - val parameterIsConstant = sdsArgument.parameterOrNull()?.isConstant() ?: false - - if (parameterIsConstant && sdsArgument.value?.toConstantExpressionOrNull() == null) { - error( - "Arguments assigned to constant parameters must be constant.", - Literals.SDS_ARGUMENT__VALUE, - ErrorCode.MustBeConstant - ) - } - } - - @Check - fun variadicParameterMustNotBeAssignedByName(sdsArgument: SdsArgument) { - if (sdsArgument.isNamed() && (sdsArgument.parameterOrNull()?.isVariadic == true)) { - error( - "A variadic parameter must not be assigned by name.", - Literals.SDS_ARGUMENT__PARAMETER, - ErrorCode.VariadicParameterMustNotBeAssignedByName - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/CallChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/CallChecker.kt deleted file mode 100644 index 7e68646a0..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/CallChecker.kt +++ /dev/null @@ -1,155 +0,0 @@ -package com.larsreimann.safeds.validation.expressions - -import com.larsreimann.safeds.constant.hasSchemaKind -import com.larsreimann.safeds.emf.argumentsOrEmpty -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.typeArgumentsOrEmpty -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.staticAnalysis.CallableResult -import com.larsreimann.safeds.staticAnalysis.callableOrNull -import com.larsreimann.safeds.staticAnalysis.isRecursive -import com.larsreimann.safeds.staticAnalysis.maybeCallable -import com.larsreimann.safeds.staticAnalysis.resultsOrNull -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class CallChecker : AbstractSafeDSChecker() { - - @OptIn(ExperimentalSdsApi::class) - @Check - fun missingTypeArgumentList(sdsCall: SdsCall) { - if (sdsCall.typeArgumentList != null) { - return - } - - val typeParameters = when (val callable = sdsCall.callableOrNull()) { - is SdsClass -> callable.typeParametersOrEmpty() - is SdsEnumVariant -> callable.typeParametersOrEmpty() - is SdsFunction -> callable.typeParametersOrEmpty() - else -> return - } - - if (typeParameters.isNotEmpty() && typeParameters.filter { !it.hasSchemaKind() }.count() > 0) { - error( - "Missing type argument list.", - Literals.SDS_ABSTRACT_CHAINED_EXPRESSION__RECEIVER, - ErrorCode.MISSING_TYPE_ARGUMENT_LIST, - ) - } - } - - @Check - fun context(sdsCall: SdsCall) { - val results = sdsCall.resultsOrNull() ?: return - val source = when (sdsCall.receiver) { - is SdsMemberAccess -> sdsCall.receiver - else -> sdsCall - } - val feature = when (sdsCall.receiver) { - is SdsMemberAccess -> Literals.SDS_MEMBER_ACCESS__MEMBER - else -> Literals.SDS_ABSTRACT_CHAINED_EXPRESSION__RECEIVER - } - - if (results.isEmpty() && !sdsCall.hasValidContextForCallWithoutResults()) { - error( - "A call that produces no results is not allowed in this context.", - source, - feature, - ErrorCode.CONTEXT_OF_CALL_WITHOUT_RESULTS, - ) - } else if (results.size > 1 && !sdsCall.hasValidContextForCallWithMultipleResults()) { - error( - "A call that produces multiple results is not allowed in this context.", - source, - feature, - ErrorCode.CONTEXT_OF_CALL_WITH_MANY_RESULTS, - ) - } - } - - private fun SdsCall.hasValidContextForCallWithoutResults(): Boolean { - val context = this.eContainer() - return context is SdsExpressionStatement - } - - private fun SdsCall.hasValidContextForCallWithMultipleResults(): Boolean { - val context = this.eContainer() - return context is SdsAssignment || context is SdsExpressionStatement || context is SdsMemberAccess - } - - @Check - fun recursion(sdsCall: SdsCall) { - if (sdsCall.isRecursive()) { - error( - "Recursive calls are not allowed.", - Literals.SDS_ABSTRACT_CHAINED_EXPRESSION__RECEIVER, - ErrorCode.NO_RECURSION, - ) - } - } - - @Check - fun receiver(sdsCall: SdsCall) { - when (val maybeCallable = sdsCall.maybeCallable()) { - CallableResult.NotCallable -> { - error( - "This expression must not be called.", - Literals.SDS_ABSTRACT_CHAINED_EXPRESSION__RECEIVER, - ErrorCode.RECEIVER_MUST_BE_CALLABLE, - ) - } - is CallableResult.Callable -> { - val callable = maybeCallable.callable - if (callable is SdsClass && callable.parameterList == null) { - error( - "Cannot create an instance of a class that has no constructor.", - Literals.SDS_ABSTRACT_CHAINED_EXPRESSION__RECEIVER, - ErrorCode.CALLED_CLASS_MUST_HAVE_CONSTRUCTOR, - ) - } - } - else -> {} - } - } - - @Check - fun unnecessaryArgumentList(sdsCall: SdsCall) { - // Call has no argument list anyway - if (sdsCall.argumentList == null) { - return - } - - // Call is used to pass type arguments or arguments - if (sdsCall.typeArgumentsOrEmpty().isNotEmpty() || sdsCall.argumentsOrEmpty().isNotEmpty()) { - return - } - - // Receiver is not callable or cannot be resolved - val callable = sdsCall.callableOrNull() ?: return - - // Only calls to enum variants can sometimes be omitted without changing the meaning of the program - if (callable !is SdsEnumVariant) { - return - } - - // This enum variant does not need to be called - if (callable.typeParametersOrEmpty().isEmpty() && callable.parametersOrEmpty().isEmpty()) { - info( - "Unnecessary argument list.", - Literals.SDS_ABSTRACT_CALL__ARGUMENT_LIST, - InfoCode.UnnecessaryArgumentList, - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/InfixOperationChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/InfixOperationChecker.kt deleted file mode 100644 index 621c4d2d0..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/InfixOperationChecker.kt +++ /dev/null @@ -1,77 +0,0 @@ -package com.larsreimann.safeds.validation.expressions - -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.By -import com.larsreimann.safeds.constant.SdsInfixOperationOperator.Elvis -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantFloat -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantInt -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.SdsConstantNull -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.toConstantExpressionOrNull -import com.larsreimann.safeds.staticAnalysis.typing.NamedType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class InfixOperationChecker : AbstractSafeDSChecker() { - - @Check - fun dispatchCheckInfixOperation(sdsInfixOperation: SdsInfixOperation) { - when (sdsInfixOperation.operator) { - By.operator -> checkByOperator(sdsInfixOperation) - Elvis.operator -> checkElvisOperator(sdsInfixOperation) - } - } - - private fun checkByOperator(sdsInfixOperation: SdsInfixOperation) { - val leftType = sdsInfixOperation.leftOperand.type() - if (!(leftType is NamedType && leftType.qualifiedName in setOf(StdlibClasses.Float, StdlibClasses.Int))) { - return - } - - val rightValue = sdsInfixOperation.rightOperand.toConstantExpressionOrNull() - if (rightValue in setOf(SdsConstantFloat(0.0), SdsConstantFloat(-0.0), SdsConstantInt(0))) { - error( - "Division by zero.", - null, - ErrorCode.DivisionByZero - ) - } - } - - private fun checkElvisOperator(sdsInfixOperation: SdsInfixOperation) { - val leftType = sdsInfixOperation.leftOperand.type() - if (!(leftType is NamedType && leftType.isNullable)) { - info( - "The left operand is never null so the elvis operator is unnecessary (keep left operand).", - null, - InfoCode.UnnecessaryElvisOperator - ) - return - } - - val leftValue = sdsInfixOperation.leftOperand.toConstantExpressionOrNull() - val rightValue = sdsInfixOperation.rightOperand.toConstantExpressionOrNull() - if (leftValue is SdsConstantNull && rightValue is SdsConstantNull) { - info( - "Both operands are always null so the elvis operator is unnecessary (replace with null).", - null, - InfoCode.UnnecessaryElvisOperator - ) - } else if (leftValue is SdsConstantNull) { - info( - "The left operand is always null so the elvis operator is unnecessary (keep right operand).", - null, - InfoCode.UnnecessaryElvisOperator - ) - } else if (rightValue is SdsConstantNull) { - info( - "The right operand is always null so the elvis operator is unnecessary (keep left operand).", - null, - InfoCode.UnnecessaryElvisOperator - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/LambdaChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/LambdaChecker.kt deleted file mode 100644 index b40ad34d6..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/LambdaChecker.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.larsreimann.safeds.validation.expressions - -import com.larsreimann.safeds.emf.assigneesOrEmpty -import com.larsreimann.safeds.emf.blockLambdaResultsOrEmpty -import com.larsreimann.safeds.emf.closestAncestorOrNull -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.placeholdersOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractLambda -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class LambdaChecker : AbstractSafeDSChecker() { - - @Check - fun uniqueNames(sdsBlockLambda: SdsBlockLambda) { - val declarations = - sdsBlockLambda.parametersOrEmpty() + sdsBlockLambda.placeholdersOrEmpty() + sdsBlockLambda.blockLambdaResultsOrEmpty() - declarations.reportDuplicateNames { - "A parameter, result or placeholder with name '${it.name}' exists already in this lambda." - } - } - - @Check - fun context(sdsLambda: SdsAbstractLambda) { - val context = sdsLambda.closestAncestorOrNull { it !is SdsParenthesizedExpression } ?: return - - val contextIsValid = when (context) { - is SdsArgument -> { - when (val parameter = context.parameterOrNull()) { - null -> true // Resolution of parameter failed, so this already shows another error - else -> parameter.type != null - } - } - is SdsAssignment -> context.assigneesOrEmpty().firstOrNull() is SdsYield - else -> false - } - - if (!contextIsValid) { - error( - "A lambda must either be yielded in a step or assigned to a typed parameter.", - null, - ErrorCode.LambdaMustBeTypedArgumentOrYielded - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/MemberAccessChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/MemberAccessChecker.kt deleted file mode 100644 index b5afd1991..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/MemberAccessChecker.kt +++ /dev/null @@ -1,67 +0,0 @@ -package com.larsreimann.safeds.validation.expressions - -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.staticAnalysis.typing.NamedType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class MemberAccessChecker : AbstractSafeDSChecker() { - - @Check - fun mustBeCalled(sdsMemberAccess: SdsMemberAccess) { - when (val member = sdsMemberAccess.member.declaration) { - is SdsFunction -> { - if (!member.isStatic && sdsMemberAccess.eContainer() !is SdsCall) { - error( - "An instance method must be called.", - Literals.SDS_MEMBER_ACCESS__MEMBER, - ErrorCode.INSTANCE_METHOD_MUST_BE_CALLED - ) - } - } - is SdsEnumVariant -> { - val mustBeInstantiated = - member.typeParametersOrEmpty().isNotEmpty() || member.parametersOrEmpty().isNotEmpty() - if (mustBeInstantiated && sdsMemberAccess.eContainer() !is SdsCall) { - error( - "An enum variant with parameters or type parameters must be instantiated.", - Literals.SDS_MEMBER_ACCESS__MEMBER, - ErrorCode.ENUM_VARIANT_MUST_BE_INSTANTIATED - ) - } - } - } - } - - @Check - fun unnecessarySafeAccess(sdsMemberAccess: SdsMemberAccess) { - val type = sdsMemberAccess.receiver.type() - - if (sdsMemberAccess.isNullSafe) { - if (!(type is NamedType && type.isNullable)) { - info( - "The receiver is never null so the safe access is unnecessary.", - null, - InfoCode.UnnecessarySafeAccess - ) - } - } else { - if (type is NamedType && type.isNullable) { - error( - "The receiver can be null so a safe access must be used.", - null, - ErrorCode.MissingSafeAccess - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/ReferenceChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/ReferenceChecker.kt deleted file mode 100644 index d6f6844d8..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/ReferenceChecker.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.larsreimann.safeds.validation.expressions - -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractChainedExpression -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.emf.ecore.EObject -import org.eclipse.xtext.validation.Check - -class ReferenceChecker : AbstractSafeDSChecker() { - - @Check - fun mustNotStaticallyReferenceClass(sdsReference: SdsReference) { - val declaration = sdsReference.declaration - if (declaration !is SdsClass || declaration.parameterList != null) { - return - } - - // Reference must eventually be the receiver of a chained expression - var previous: EObject = sdsReference - var current: EObject = previous.eContainer() - while (current is SdsAbstractChainedExpression) { - if (current.receiver == previous) { - return - } - previous = current - current = current.eContainer() - } - - error( - "Must not statically reference class.", - Literals.SDS_REFERENCE__DECLARATION, - ErrorCode.MustNotStaticallyReferenceClass - ) - } - - @Check - fun mustNotStaticallyReferenceEnum(sdsReference: SdsReference) { - if (sdsReference.declaration !is SdsEnum) { - return - } - - // Reference must eventually be the receiver of a member access - var previous: EObject = sdsReference - var current: EObject = previous.eContainer() - while (current is SdsMemberAccess) { - if (current.receiver == previous) { - return - } - previous = current - current = current.eContainer() - } - - error( - "Must not statically reference enum.", - Literals.SDS_REFERENCE__DECLARATION, - ErrorCode.MustNotStaticallyReferenceEnum - ) - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/TemplateStringChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/TemplateStringChecker.kt deleted file mode 100644 index 524a6630a..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/expressions/TemplateStringChecker.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.larsreimann.safeds.validation.expressions - -import com.larsreimann.safeds.safeDS.SdsAbstractTemplateStringPart -import com.larsreimann.safeds.safeDS.SdsTemplateString -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class TemplateStringChecker : AbstractSafeDSChecker() { - - @Check - fun missingTemplateExpression(sdsTemplateString: SdsTemplateString) { - sdsTemplateString.expressions - .windowed(size = 2, step = 1) - .forEach { (first, second) -> - if (first is SdsAbstractTemplateStringPart && second is SdsAbstractTemplateStringPart) { - error( - "There must be a template expression between two template string parts.", - second, - null, - ErrorCode.MissingTemplateExpression - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/AnnotationCallChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/AnnotationCallChecker.kt deleted file mode 100644 index 9feda6887..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/AnnotationCallChecker.kt +++ /dev/null @@ -1,226 +0,0 @@ -package com.larsreimann.safeds.validation.other - -import com.larsreimann.safeds.emf.argumentsOrEmpty -import com.larsreimann.safeds.emf.isRequired -import com.larsreimann.safeds.emf.isResolved -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.targetOrNull -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.staticAnalysis.linking.parametersOrNull -import com.larsreimann.safeds.staticAnalysis.partialEvaluation.toConstantExpressionOrNull -import com.larsreimann.safeds.stdlibAccess.StdlibAnnotations -import com.larsreimann.safeds.stdlibAccess.StdlibEnums.AnnotationTarget -import com.larsreimann.safeds.stdlibAccess.isPure -import com.larsreimann.safeds.stdlibAccess.pythonModuleOrNull -import com.larsreimann.safeds.stdlibAccess.pythonNameOrNull -import com.larsreimann.safeds.stdlibAccess.validTargets -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class AnnotationCallChecker : AbstractSafeDSChecker() { - - @Check - fun duplicateTargetInTargetAnnotation(sdsAnnotationCall: SdsAnnotationCall) { - val annotation = sdsAnnotationCall.annotation - if (!annotation.isResolved() || annotation.qualifiedNameOrNull() != StdlibAnnotations.Target) { - return - } - - sdsAnnotationCall - .argumentsOrEmpty() - .map { it.value } - .filterIsInstance() - .duplicatesBy { it.member.declaration.qualifiedNameOrNull() } - .forEach { - warning( - "This annotation target is used multiple times.", - it, - null, - WarningCode.DuplicateTarget, - ) - } - } - - @Check - fun missingArgumentList(sdsAnnotationCall: SdsAnnotationCall) { - if (sdsAnnotationCall.argumentList != null) { - return - } - - val annotation = sdsAnnotationCall.annotation - if (!annotation.isResolved()) { - return - } - - val parameters = sdsAnnotationCall.annotation.parametersOrEmpty() - if (parameters.any { it.isRequired() }) { - error( - "Missing argument list.", - Literals.SDS_ANNOTATION_CALL__ANNOTATION, - ErrorCode.MISSING_ARGUMENT_LIST, - ) - } - } - - @Check - fun target(sdsAnnotationCall: SdsAnnotationCall) { - // Get target of annotation use - val actualTarget = sdsAnnotationCall.targetOrNull() ?: return - - // Get legal targets of used annotation - val annotation = sdsAnnotationCall.annotation - if (!annotation.isResolved()) { - return - } - - val legalTargets = annotation.validTargets() - - // Compare actual and legal targets - val wrongTarget: String? = when { - actualTarget is SdsAnnotation && AnnotationTarget.Annotation !in legalTargets -> { - "an annotation" - } - actualTarget is SdsAttribute && AnnotationTarget.Attribute !in legalTargets -> { - "an attribute" - } - actualTarget is SdsClass && AnnotationTarget.Class !in legalTargets -> { - "a class" - } - actualTarget is SdsCompilationUnit && AnnotationTarget.CompilationUnit !in legalTargets -> { - "a compilation unit" - } - actualTarget is SdsEnum && AnnotationTarget.Enum !in legalTargets -> { - "an enum" - } - actualTarget is SdsEnumVariant && AnnotationTarget.EnumVariant !in legalTargets -> { - "an enum variant" - } - actualTarget is SdsFunction && AnnotationTarget.Function !in legalTargets -> { - "a function" - } - actualTarget is SdsParameter && AnnotationTarget.Parameter !in legalTargets -> { - "a parameter" - } - actualTarget is SdsPipeline && AnnotationTarget.Pipeline !in legalTargets -> { - "a pipeline" - } - actualTarget is SdsResult && AnnotationTarget.Result !in legalTargets -> { - "a result" - } - actualTarget is SdsTypeParameter && AnnotationTarget.TypeParameter !in legalTargets -> { - "a type parameter" - } - actualTarget is SdsStep && AnnotationTarget.Step !in legalTargets -> { - "a step" - } - else -> null - } - - // Show error - if (wrongTarget != null) { - error( - "This annotation cannot be applied to $wrongTarget.", - null, - ErrorCode.WRONG_TARGET, - ) - } - } - - @Check - fun unnecessaryArgumentList(sdsAnnotationCall: SdsAnnotationCall) { - if (sdsAnnotationCall.argumentList == null || sdsAnnotationCall.argumentsOrEmpty().isNotEmpty()) { - return - } - - val parametersOrNull = sdsAnnotationCall.argumentList.parametersOrNull() - if (parametersOrNull != null && parametersOrNull.none { it.isRequired() }) { - info( - "Unnecessary argument list.", - Literals.SDS_ABSTRACT_CALL__ARGUMENT_LIST, - InfoCode.UnnecessaryArgumentList, - ) - } - } - - @Check(CheckType.NORMAL) - fun argumentsMustBeConstant(sdsAnnotationCall: SdsAnnotationCall) { - sdsAnnotationCall.argumentsOrEmpty().forEach { - if (it.value?.toConstantExpressionOrNull() == null) { - error( - "Arguments in annotation call must be constant.", - it, - Literals.SDS_ARGUMENT__VALUE, - ErrorCode.MustBeConstant, - ) - } - } - } - - @Check - fun pureImpliesNoSideEffects(sdsAnnotationCall: SdsAnnotationCall) { - if (sdsAnnotationCall.annotation.qualifiedNameOrNull() != StdlibAnnotations.NoSideEffects) { - return - } - - val target = sdsAnnotationCall.targetOrNull() ?: return - if (target is SdsFunction && target.isPure()) { - info( - "Purity implies absence of side effects (remove this annotation call).", - null, - InfoCode.PureImpliesNoSideEffects, - ) - } - } - - @Check - fun identicalPythonModule(sdsAnnotationCall: SdsAnnotationCall) { - if (sdsAnnotationCall.annotation.qualifiedNameOrNull() != StdlibAnnotations.PythonModule) { - return - } - - val target = sdsAnnotationCall.targetOrNull() as? SdsCompilationUnit ?: return - if (target.name == target.pythonModuleOrNull()) { - info( - "Python module is identical to Safe-DS package (can remove annotation call).", - null, - InfoCode.IdenticalPythonModule, - ) - } - } - - @Check - fun identicalPythonName(sdsAnnotationCall: SdsAnnotationCall) { - if (sdsAnnotationCall.annotation.qualifiedNameOrNull() != StdlibAnnotations.PythonName) { - return - } - - val target = sdsAnnotationCall.targetOrNull() ?: return - if (target.name == target.pythonNameOrNull()) { - info( - "Python name is identical to Safe-DS name (can remove annotation call).", - null, - InfoCode.IdenticalPythonName, - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ArgumentListChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ArgumentListChecker.kt deleted file mode 100644 index c3c172092..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ArgumentListChecker.kt +++ /dev/null @@ -1,105 +0,0 @@ -package com.larsreimann.safeds.validation.other - -import com.larsreimann.safeds.emf.isNamed -import com.larsreimann.safeds.emf.isPositional -import com.larsreimann.safeds.emf.isRequired -import com.larsreimann.safeds.safeDS.SdsArgumentList -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.parametersOrNull -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class ArgumentListChecker : AbstractSafeDSChecker() { - - @Check - fun missingRequiredParameter(sdsArgumentList: SdsArgumentList) { - val parameters = sdsArgumentList.parametersOrNull() ?: return - val requiredParameters = parameters.filter { it.isRequired() } - val givenParameters = sdsArgumentList.arguments.mapNotNull { it.parameterOrNull() } - val missingRequiredParameters = requiredParameters - givenParameters.toSet() - - missingRequiredParameters.forEach { - error( - "The parameter '${it.name}' is required and must be set here.", - null, - ErrorCode.MISSING_REQUIRED_PARAMETER - ) - } - } - - @Check - fun noPositionalArgumentsAfterFirstNamedArgument(sdsArgumentList: SdsArgumentList) { - val firstNamedArgumentIndex = sdsArgumentList.arguments.indexOfFirst { it.isNamed() } - if (firstNamedArgumentIndex == -1) { - return - } - - sdsArgumentList.arguments - .drop(firstNamedArgumentIndex + 1) - .filter { it.isPositional() } - .forEach { - error( - "After the first named argument all arguments must be named.", - it, - null, - ErrorCode.NO_POSITIONAL_ARGUMENTS_AFTER_FIRST_NAMED_ARGUMENT - ) - } - } - - @Check - fun tooManyArguments(sdsArgumentList: SdsArgumentList) { - val parameters = sdsArgumentList.parametersOrNull() - if (parameters == null || parameters.any { it.isVariadic }) { - return - } - - val maximumExpectedNumberOfArguments = parameters.size - val actualNumberOfArguments = sdsArgumentList.arguments.size - - if (actualNumberOfArguments > maximumExpectedNumberOfArguments) { - val minimumExpectedNumberOfArguments = parameters.filter { it.isRequired() }.size - val message = buildString { - append("Expected ") - - when { - minimumExpectedNumberOfArguments != maximumExpectedNumberOfArguments -> { - append("between $minimumExpectedNumberOfArguments and $maximumExpectedNumberOfArguments arguments") - } - minimumExpectedNumberOfArguments == 1 -> append("exactly 1 argument") - else -> append("exactly $minimumExpectedNumberOfArguments arguments") - } - - append(" but got $actualNumberOfArguments.") - } - - error( - message, - null, - ErrorCode.TOO_MANY_ARGUMENTS - ) - } - } - - @Check - fun uniqueParameters(sdsArgumentList: SdsArgumentList) { - sdsArgumentList.arguments - .duplicatesBy { - val parameter = it.parameterOrNull() ?: return@duplicatesBy null - when { - parameter.isVariadic -> null - else -> parameter.name - } - } - .forEach { - error( - "The parameter '${it.parameterOrNull()?.name}' is already set.", - it, - null, - ErrorCode.UNIQUE_PARAMETERS - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/DeprecationChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/DeprecationChecker.kt deleted file mode 100644 index 4000aa961..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/DeprecationChecker.kt +++ /dev/null @@ -1,98 +0,0 @@ -package com.larsreimann.safeds.validation.other - -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsWildcard -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.typeParameterOrNull -import com.larsreimann.safeds.stdlibAccess.isDeprecated -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check - -class DeprecationChecker : AbstractSafeDSChecker() { - - @Check - fun annotationUseReferenceDeprecatedAnnotation(sdsAnnotationCall: SdsAnnotationCall) { - val annotation = sdsAnnotationCall.annotation ?: return - if (annotation.isDeprecated()) { - warning( - "The used annotation is deprecated.", - Literals.SDS_ANNOTATION_CALL__ANNOTATION, - WarningCode.ReferencedDeclarationIsDeprecated - ) - } - } - - @Check - fun assigneeAssignedToDeprecatedValue(sdsAssignee: SdsAbstractAssignee) { - if (sdsAssignee is SdsWildcard) { - return - } - - val assigned = sdsAssignee.assignedOrNull() ?: return - if (assigned is SdsAbstractDeclaration && assigned.isDeprecated()) { - warning( - "The assigned declaration is deprecated.", - null, - WarningCode.AssignedDeclarationIsDeprecated - ) - } - } - - @Check - fun argumentReferencesDeprecatedParameter(sdsArgument: SdsArgument) { - val parameter = sdsArgument.parameterOrNull() ?: return - if (parameter.isDeprecated()) { - warning( - "The corresponding parameter is deprecated.", - null, - WarningCode.CorrespondingParameterIsDeprecated - ) - } - } - - @Check - fun namedTypeReferencesDeprecatedDeclaration(sdsNamedType: SdsNamedType) { - val declaration = sdsNamedType.declaration ?: return - if (declaration.isDeprecated()) { - warning( - "The referenced declaration is deprecated.", - Literals.SDS_NAMED_TYPE__DECLARATION, - WarningCode.ReferencedDeclarationIsDeprecated - ) - } - } - - @Check - fun referenceReferencesDeprecatedDeclaration(sdsReference: SdsReference) { - val declaration = sdsReference.declaration ?: return - if (declaration !is SdsParameter && declaration.isDeprecated()) { - warning( - "The referenced declaration is deprecated.", - Literals.SDS_REFERENCE__DECLARATION, - WarningCode.ReferencedDeclarationIsDeprecated - ) - } - } - - @Check - fun typeArgumentReferencesDeprecatedTypeParameter(sdsTypeArgument: SdsTypeArgument) { - val typeParameter = sdsTypeArgument.typeParameterOrNull() ?: return - if (typeParameter.isDeprecated()) { - warning( - "The corresponding type parameter is deprecated.", - null, - WarningCode.CorrespondingTypeParameterIsDeprecated - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ExperimentalChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ExperimentalChecker.kt deleted file mode 100644 index 8123fa1f1..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ExperimentalChecker.kt +++ /dev/null @@ -1,98 +0,0 @@ -package com.larsreimann.safeds.validation.other - -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractAssignee -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsWildcard -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.typeParameterOrNull -import com.larsreimann.safeds.stdlibAccess.isExperimental -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check - -class ExperimentalChecker : AbstractSafeDSChecker() { - - @Check - fun annotationUseReferenceExperimentalAnnotation(sdsAnnotationCall: SdsAnnotationCall) { - val annotation = sdsAnnotationCall.annotation ?: return - if (annotation.isExperimental()) { - warning( - "The used annotation is experimental.", - Literals.SDS_ANNOTATION_CALL__ANNOTATION, - WarningCode.ReferencedDeclarationIsExperimental, - ) - } - } - - @Check - fun assigneeAssignedToExperimentalValue(sdsAssignee: SdsAbstractAssignee) { - if (sdsAssignee is SdsWildcard) { - return - } - - val assigned = sdsAssignee.assignedOrNull() ?: return - if (assigned is SdsAbstractDeclaration && assigned.isExperimental()) { - warning( - "The assigned declaration is experimental.", - null, - WarningCode.AssignedDeclarationIsExperimental, - ) - } - } - - @Check - fun argumentReferencesExperimentalParameter(sdsArgument: SdsArgument) { - val parameter = sdsArgument.parameterOrNull() ?: return - if (parameter.isExperimental()) { - warning( - "The corresponding parameter is experimental.", - null, - WarningCode.CorrespondingParameterIsExperimental, - ) - } - } - - @Check - fun namedTypeReferencesExperimentalDeclaration(sdsNamedType: SdsNamedType) { - val declaration = sdsNamedType.declaration ?: return - if (declaration.isExperimental()) { - warning( - "The referenced declaration is experimental.", - Literals.SDS_NAMED_TYPE__DECLARATION, - WarningCode.ReferencedDeclarationIsExperimental, - ) - } - } - - @Check - fun referenceReferencesExperimentalDeclaration(sdsReference: SdsReference) { - val declaration = sdsReference.declaration ?: return - if (declaration !is SdsParameter && declaration.isExperimental()) { - warning( - "The referenced declaration is experimental.", - Literals.SDS_REFERENCE__DECLARATION, - WarningCode.ReferencedDeclarationIsExperimental, - ) - } - } - - @Check - fun typeArgumentReferencesExperimentalTypeParameter(sdsTypeArgument: SdsTypeArgument) { - val typeParameter = sdsTypeArgument.typeParameterOrNull() ?: return - if (typeParameter.isExperimental()) { - warning( - "The corresponding type parameter is experimental.", - null, - WarningCode.CorrespondingTypeParameterIsExperimental, - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ProtocolChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ProtocolChecker.kt deleted file mode 100644 index 8dfe14451..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/ProtocolChecker.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.larsreimann.safeds.validation.other - -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsProtocolReference -import com.larsreimann.safeds.safeDS.SdsProtocolSubtermList -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class ProtocolChecker : AbstractSafeDSChecker() { - - @Check - fun mustOnlyReferToInstanceMembers(sdsProtocolReference: SdsProtocolReference) { - val token = sdsProtocolReference.token - val isStaticAttribute = token is SdsAttribute && token.isStatic - val isStaticFunction = token is SdsFunction && token.isStatic - - if (isStaticAttribute || isStaticFunction) { - error( - "Must only reference instance members.", - null, - ErrorCode.OnlyReferenceInstanceMembers - ) - } - } - - @Check - fun uniqueNames(sdsProtocolSubtermList: SdsProtocolSubtermList) { - sdsProtocolSubtermList.subterms.reportDuplicateNames { - "A subterm with name '${it.name}' exists already in this protocol." - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/TypeArgumentListChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/TypeArgumentListChecker.kt deleted file mode 100644 index da9a0ae6d..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/other/TypeArgumentListChecker.kt +++ /dev/null @@ -1,107 +0,0 @@ -package com.larsreimann.safeds.validation.other - -import com.larsreimann.safeds.constant.hasSchemaKind -import com.larsreimann.safeds.emf.isNamed -import com.larsreimann.safeds.emf.isPositional -import com.larsreimann.safeds.safeDS.SdsTypeArgumentList -import com.larsreimann.safeds.staticAnalysis.linking.typeParameterOrNull -import com.larsreimann.safeds.staticAnalysis.linking.typeParametersOrNull -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import com.larsreimann.safeds.utils.duplicatesBy -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class TypeArgumentListChecker : AbstractSafeDSChecker() { - - @OptIn(ExperimentalSdsApi::class) - @Check - fun missingRequiredTypeParameter(sdsTypeArgumentList: SdsTypeArgumentList) { - val requiredTypeParameters = sdsTypeArgumentList.typeParametersOrNull() - ?.filter { !it.hasSchemaKind() } ?: return - val givenTypeParameters = sdsTypeArgumentList.typeArguments.mapNotNull { it.typeParameterOrNull() } - val missingRequiredTypeParameters = requiredTypeParameters - givenTypeParameters.toSet() - - missingRequiredTypeParameters.forEach { - error( - "The type parameter '${it.name}' is required and must be set here.", - null, - ErrorCode.MISSING_REQUIRED_TYPE_PARAMETER, - ) - } - } - - @Check - fun noPositionalArgumentsAfterFirstNamedArgument(sdsTypeArgumentList: SdsTypeArgumentList) { - val firstNamedTypeArgumentIndex = sdsTypeArgumentList.typeArguments.indexOfFirst { it.isNamed() } - if (firstNamedTypeArgumentIndex == -1) { - return - } - - sdsTypeArgumentList.typeArguments - .drop(firstNamedTypeArgumentIndex + 1) - .filter { it.isPositional() } - .forEach { - error( - "After the first named type argument all type arguments must be named.", - it, - null, - ErrorCode.NO_POSITIONAL_TYPE_ARGUMENTS_AFTER_FIRST_NAMED_TYPE_ARGUMENT, - ) - } - } - - @Check - fun tooManyTypeArguments(sdsTypeArgumentList: SdsTypeArgumentList) { - val typeParameter = sdsTypeArgumentList.typeParametersOrNull() ?: return - - val maximumExpectedNumberOfArguments = typeParameter.size - val actualNumberOfArguments = sdsTypeArgumentList.typeArguments.size - - if (actualNumberOfArguments > maximumExpectedNumberOfArguments) { - val message = buildString { - append("Expected ") - - when (maximumExpectedNumberOfArguments) { - 1 -> append("exactly 1 type argument") - else -> append("exactly $maximumExpectedNumberOfArguments type arguments") - } - - append(" but got $actualNumberOfArguments.") - } - - error( - message, - null, - ErrorCode.TooManyTypeArguments, - ) - } - } - - @Check - fun uniqueTypeParameters(sdsTypeArgumentList: SdsTypeArgumentList) { - sdsTypeArgumentList.typeArguments - .duplicatesBy { it.typeParameterOrNull()?.name } - .forEach { - error( - "The type parameter '${it.typeParameterOrNull()?.name}' is already set.", - it, - null, - ErrorCode.UniqueTypeParameters, - ) - } - } - - @Check - fun unnecessaryTypeArgumentList(sdsTypeArgumentList: SdsTypeArgumentList) { - val typeParametersOrNull = sdsTypeArgumentList.typeParametersOrNull() - if (typeParametersOrNull != null && typeParametersOrNull.isEmpty()) { - info( - "Unnecessary type argument list.", - null, - InfoCode.UnnecessaryTypeArgumentList, - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/schema/SchemaChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/schema/SchemaChecker.kt deleted file mode 100644 index b4a53f9df..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/schema/SchemaChecker.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.larsreimann.safeds.validation.schema - -import com.larsreimann.safeds.emf.statementsOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.staticAnalysis.schema.SchemaOwner -import com.larsreimann.safeds.staticAnalysis.schema.SchemaResult -import com.larsreimann.safeds.staticAnalysis.schema.inferSchema -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class SchemaChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun value(sdsPipeline: SdsPipeline) { - val resolvedVars = mutableMapOf() - - for (statement in sdsPipeline.statementsOrEmpty()) { - val resolved = inferSchema(statement, resolvedVars) - - resolved.forEach { - val (errorMsg, errorArg, errorCode) = when (val result = it.value) { - is SchemaResult.Error -> Triple(result.msg, result.argument, result.code) - else -> return@forEach - } - error(errorMsg, errorArg, Literals.SDS_ARGUMENT__VALUE, errorCode) - } - - resolved.keys.removeIf { it is SchemaOwner.TempOwner } - resolvedVars.putAll(resolved) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/statements/AssignmentChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/statements/AssignmentChecker.kt deleted file mode 100644 index 0fba57a2a..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/statements/AssignmentChecker.kt +++ /dev/null @@ -1,84 +0,0 @@ -package com.larsreimann.safeds.validation.statements - -import com.larsreimann.safeds.emf.assigneesOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsWildcard -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.staticAnalysis.AssignedResult -import com.larsreimann.safeds.staticAnalysis.expressionHasNoSideEffects -import com.larsreimann.safeds.staticAnalysis.maybeAssigned -import com.larsreimann.safeds.staticAnalysis.resultsOrNull -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check - -class AssignmentChecker : AbstractSafeDSChecker() { - - @Check - fun unnecessaryAssigneeList(sdsAssignment: SdsAssignment) { - if (sdsAssignment.assigneesOrEmpty().all { it is SdsWildcard }) { - info( - "This assignment can be converted to an expression statement.", - null, - InfoCode.UnnecessaryAssignment - ) - } - } - - @Check - fun assigneeWithoutValue(sdsAssignment: SdsAssignment) { - sdsAssignment.assigneesOrEmpty() - .filter { it.maybeAssigned() == AssignedResult.NotAssigned } - .forEach { - error( - "No value is assigned to this assignee.", - it, - null, - ErrorCode.ASSIGNEE_WITHOUT_VALUE - ) - } - } - - @Check - fun hasNoEffect(sdsAssignment: SdsAssignment) { - if (sdsAssignment.assigneesOrEmpty() - .any { it is SdsPlaceholder || it is SdsYield || it is SdsBlockLambdaResult } - ) { - return - } - - if (sdsAssignment.expression.expressionHasNoSideEffects()) { - warning( - "This statement does nothing.", - null, - WarningCode.StatementDoesNothing - ) - } - } - - @Check - fun ignoredResultOfCall(sdsAssignment: SdsAssignment) { - val expression = sdsAssignment.expression - if (expression is SdsCall) { - val results = (expression.resultsOrNull() ?: listOf()) - val unassignedResults = results.drop(sdsAssignment.assigneesOrEmpty().size) - - unassignedResults - .filterIsInstance() - .forEach { - warning( - "The result '${it.name}' is implicitly ignored.", - Literals.SDS_ASSIGNMENT__ASSIGNEE_LIST, - WarningCode.ImplicitlyIgnoredResultOfCall - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/statements/ExpressionsStatementChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/statements/ExpressionsStatementChecker.kt deleted file mode 100644 index fdbb0dd25..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/statements/ExpressionsStatementChecker.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.larsreimann.safeds.validation.statements - -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.staticAnalysis.expressionHasNoSideEffects -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.WarningCode -import org.eclipse.xtext.validation.Check - -class ExpressionsStatementChecker : AbstractSafeDSChecker() { - - @Check - fun hasNoEffect(sdsExpressionStatement: SdsExpressionStatement) { - if (sdsExpressionStatement.expression.expressionHasNoSideEffects()) { - warning( - "This statement does nothing.", - null, - WarningCode.StatementDoesNothing - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/ArgumentTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/ArgumentTypeChecker.kt deleted file mode 100644 index c70e59761..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/ArgumentTypeChecker.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.larsreimann.safeds.validation.typeChecking - -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.staticAnalysis.linking.parameterOrNull -import com.larsreimann.safeds.staticAnalysis.typing.UnresolvedType -import com.larsreimann.safeds.staticAnalysis.typing.isSubstitutableFor -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class ArgumentTypeChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun value(sdsArgument: SdsArgument) { - val argumentType = sdsArgument.type() - if (argumentType is UnresolvedType) { - return // Scoping error already shown - } - - val parameterType = (sdsArgument.parameterOrNull() ?: return).type() - - if (!argumentType.isSubstitutableFor(parameterType)) { - var argumentTypeString = argumentType.toSimpleString() - var parameterTypeString = parameterType.toSimpleString() - - if (argumentTypeString == parameterTypeString) { - argumentTypeString = argumentType.toString() - parameterTypeString = parameterType.toString() - } - - error( - "An argument of type '$argumentTypeString' cannot be assigned to a parameter of type '$parameterTypeString'.", - Literals.SDS_ARGUMENT__VALUE, - ErrorCode.WrongType - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/DefaultValueTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/DefaultValueTypeChecker.kt deleted file mode 100644 index 694205e6b..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/DefaultValueTypeChecker.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.larsreimann.safeds.validation.typeChecking - -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.staticAnalysis.typing.UnresolvedType -import com.larsreimann.safeds.staticAnalysis.typing.isSubstitutableFor -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class DefaultValueTypeChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun defaultValue(sdsParameter: SdsParameter) { - val defaultValue = sdsParameter.defaultValue ?: return - val defaultValueType = defaultValue.type() - if (defaultValueType is UnresolvedType) { - return // Scoping error already shown - } - - val parameterType = sdsParameter.type() - - if (!defaultValueType.isSubstitutableFor(parameterType)) { - var defaultValueTypeString = defaultValueType.toSimpleString() - var parameterTypeString = parameterType.toSimpleString() - - if (defaultValueTypeString == parameterTypeString) { - defaultValueTypeString = defaultValueType.toString() - parameterTypeString = parameterType.toString() - } - - error( - "A default value of type '$defaultValueTypeString' cannot be assigned to a parameter of type '$parameterTypeString'.", - Literals.SDS_PARAMETER__DEFAULT_VALUE, - ErrorCode.WrongType - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/IndexedAccessTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/IndexedAccessTypeChecker.kt deleted file mode 100644 index 2c6406e73..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/IndexedAccessTypeChecker.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.larsreimann.safeds.validation.typeChecking - -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage -import com.larsreimann.safeds.safeDS.SdsIndexedAccess -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.UnresolvedType -import com.larsreimann.safeds.staticAnalysis.typing.VariadicType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class IndexedAccessTypeChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun receiverMustBeVariadic(sdsIndexedAccess: SdsIndexedAccess) { - val receiverType = sdsIndexedAccess.receiver.type() - if (receiverType is UnresolvedType) { - return // Scoping error already shown - } - - if (receiverType !is VariadicType) { - error( - "The receiver of an indexed access must refer to a variadic parameter.", - SafeDSPackage.Literals.SDS_ABSTRACT_CHAINED_EXPRESSION__RECEIVER, - ErrorCode.WrongType - ) - } - } - - @Check - fun indexMustBeInt(sdsIndexedAccess: SdsIndexedAccess) { - val indexType = sdsIndexedAccess.index.type() - if (indexType is UnresolvedType) { - return - } - - val hasWrongType = indexType !is ClassType || - indexType.isNullable || - indexType.sdsClass.qualifiedNameOrNull() != StdlibClasses.Int - - if (hasWrongType) { - error( - "The index of an indexed access must be an instance of the class 'Int'.", - SafeDSPackage.Literals.SDS_INDEXED_ACCESS__INDEX, - ErrorCode.WrongType - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/InfixOperationTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/InfixOperationTypeChecker.kt deleted file mode 100644 index 0d8525466..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/InfixOperationTypeChecker.kt +++ /dev/null @@ -1,106 +0,0 @@ -package com.larsreimann.safeds.validation.typeChecking - -import com.larsreimann.safeds.constant.SdsInfixOperationOperator -import com.larsreimann.safeds.constant.operator -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.UnresolvedType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.emf.ecore.EReference -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class InfixOperationTypeChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun leftOperand(sdsInfixOperation: SdsInfixOperation) { - checkOperand(sdsInfixOperation, Literals.SDS_INFIX_OPERATION__LEFT_OPERAND) - } - - @Check(CheckType.NORMAL) - fun rightOperand(sdsInfixOperation: SdsInfixOperation) { - checkOperand(sdsInfixOperation, Literals.SDS_INFIX_OPERATION__RIGHT_OPERAND) - } - - private fun checkOperand(sdsInfixOperation: SdsInfixOperation, feature: EReference) { - val operandType = operand(sdsInfixOperation, feature).type() - if (operandType is UnresolvedType) { - return // Scoping error already shown - } - - when (sdsInfixOperation.operator()) { - SdsInfixOperationOperator.Or, - SdsInfixOperationOperator.And -> { - val hasWrongType = operandType !is ClassType || - operandType.isNullable || - operandType.sdsClass.qualifiedNameOrNull() != StdlibClasses.Boolean - - if (hasWrongType) { - error( - "The ${operandPositionToString(feature)} operand of a logical infix operation must be an instance of the class 'Boolean'.", - feature, - ErrorCode.WrongType - ) - } - } - - SdsInfixOperationOperator.Plus, - SdsInfixOperationOperator.Minus, - SdsInfixOperationOperator.Times, - SdsInfixOperationOperator.By -> { - val hasWrongType = operandType !is ClassType || - operandType.isNullable || - operandType.sdsClass.qualifiedNameOrNull() !in setOf(StdlibClasses.Float, StdlibClasses.Int) - - if (hasWrongType) { - error( - "The ${operandPositionToString(feature)} operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'.", - feature, - ErrorCode.WrongType - ) - } - } - - SdsInfixOperationOperator.LessThan, - SdsInfixOperationOperator.LessThanOrEquals, - SdsInfixOperationOperator.GreaterThanOrEquals, - SdsInfixOperationOperator.GreaterThan -> { - val hasWrongType = operandType !is ClassType || - operandType.isNullable || - operandType.sdsClass.qualifiedNameOrNull() !in setOf(StdlibClasses.Float, StdlibClasses.Int) - - if (hasWrongType) { - error( - "The ${operandPositionToString(feature)} operand of a comparison must be an instance of the class 'Float' or the class 'Int'.", - feature, - ErrorCode.WrongType - ) - } - } - - else -> {} - } - } - - private fun operand(sdsInfixOperation: SdsInfixOperation, feature: EReference): SdsAbstractExpression { - return when (feature) { - Literals.SDS_INFIX_OPERATION__LEFT_OPERAND -> sdsInfixOperation.leftOperand - Literals.SDS_INFIX_OPERATION__RIGHT_OPERAND -> sdsInfixOperation.rightOperand - else -> throw IllegalArgumentException("Cannot handle feature '$feature'.") - } - } - - private fun operandPositionToString(feature: EReference): String { - return when (feature) { - Literals.SDS_INFIX_OPERATION__LEFT_OPERAND -> "left" - Literals.SDS_INFIX_OPERATION__RIGHT_OPERAND -> "right" - else -> throw IllegalArgumentException("Cannot handle feature '$feature'.") - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/PrefixOperationTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/PrefixOperationTypeChecker.kt deleted file mode 100644 index 007fef376..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/PrefixOperationTypeChecker.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.larsreimann.safeds.validation.typeChecking - -import com.larsreimann.safeds.constant.SdsPrefixOperationOperator -import com.larsreimann.safeds.constant.operator -import com.larsreimann.safeds.naming.qualifiedNameOrNull -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsPrefixOperation -import com.larsreimann.safeds.staticAnalysis.typing.ClassType -import com.larsreimann.safeds.staticAnalysis.typing.UnresolvedType -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class PrefixOperationTypeChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun operand(sdsPrefixOperation: SdsPrefixOperation) { - val operandType = sdsPrefixOperation.operand.type() - if (operandType is UnresolvedType) { - return // Scoping error already shown - } - - when (sdsPrefixOperation.operator()) { - SdsPrefixOperationOperator.Not -> { - val hasWrongType = operandType !is ClassType || - operandType.isNullable || - operandType.sdsClass.qualifiedNameOrNull() != StdlibClasses.Boolean - - if (hasWrongType) { - error( - "The operand of a logical negation must be an instance of the class 'Boolean'.", - Literals.SDS_PREFIX_OPERATION__OPERAND, - ErrorCode.WrongType - ) - } - } - SdsPrefixOperationOperator.Minus -> { - val hasWrongType = operandType !is ClassType || - operandType.isNullable || - operandType.sdsClass.qualifiedNameOrNull() !in setOf(StdlibClasses.Float, StdlibClasses.Int) - - if (hasWrongType) { - error( - "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'.", - Literals.SDS_PREFIX_OPERATION__OPERAND, - ErrorCode.WrongType - ) - } - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/YieldTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/YieldTypeChecker.kt deleted file mode 100644 index a64ec6181..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/typeChecking/YieldTypeChecker.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.larsreimann.safeds.validation.typeChecking - -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.staticAnalysis.typing.UnresolvedType -import com.larsreimann.safeds.staticAnalysis.typing.isSubstitutableFor -import com.larsreimann.safeds.staticAnalysis.typing.type -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check -import org.eclipse.xtext.validation.CheckType - -class YieldTypeChecker : AbstractSafeDSChecker() { - - @Check(CheckType.NORMAL) - fun value(sdsYield: SdsYield) { - val yieldedValue = sdsYield.assignedOrNull() ?: return - val yieldedValueType = yieldedValue.type() - if (yieldedValueType is UnresolvedType) { - return // Scoping error already shown - } - - val resultType = (sdsYield.result ?: return).type() - - if (!yieldedValueType.isSubstitutableFor(resultType)) { - var yieldedValueTypeString = yieldedValueType.toSimpleString() - var resultTypeString = resultType.toSimpleString() - - if (yieldedValueTypeString == resultTypeString) { - yieldedValueTypeString = yieldedValueType.toString() - resultTypeString = resultType.toString() - } - - error( - "A value of type '$yieldedValueTypeString' cannot be assigned to a result of type '$resultTypeString'.", - yieldedValue, - null, - ErrorCode.WrongType - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/CallableTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/CallableTypeChecker.kt deleted file mode 100644 index a8a14867c..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/CallableTypeChecker.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.larsreimann.safeds.validation.types - -import com.larsreimann.safeds.emf.isOptional -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage.Literals -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class CallableTypeChecker : AbstractSafeDSChecker() { - - @Check - fun uniqueNames(sdsCallableType: SdsCallableType) { - val declarations = sdsCallableType.parametersOrEmpty() + sdsCallableType.resultsOrEmpty() - declarations.reportDuplicateNames { - "A parameter or result with name '${it.name}' exists already in this callable type." - } - } - - @Check - fun noOptionalParameters(sdsCallableType: SdsCallableType) { - sdsCallableType.parametersOrEmpty().forEach { - if (it.isOptional()) { - error( - "Parameters in callable types must not be optional.", - it, - Literals.SDS_PARAMETER__DEFAULT_VALUE, - ErrorCode.NoOptionalParametersInCallableType - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/NamedTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/NamedTypeChecker.kt deleted file mode 100644 index 387797c8a..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/NamedTypeChecker.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.larsreimann.safeds.validation.types - -import com.larsreimann.safeds.emf.typeParametersOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSPackage -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import org.eclipse.xtext.validation.Check - -class NamedTypeChecker : AbstractSafeDSChecker() { - - @Check - fun missingTypeArgumentList(sdsNamedType: SdsNamedType) { - if (sdsNamedType.typeArgumentList != null) { - return - } - - val declaration = sdsNamedType.declaration - val typeParameters = when { - declaration.eIsProxy() -> return - declaration is SdsClass -> declaration.typeParametersOrEmpty() - declaration is SdsEnumVariant -> declaration.typeParametersOrEmpty() - declaration is SdsFunction -> declaration.typeParametersOrEmpty() - else -> return - } - - if (typeParameters.isNotEmpty()) { - error( - "Missing type argument list.", - SafeDSPackage.Literals.SDS_NAMED_TYPE__DECLARATION, - ErrorCode.MISSING_TYPE_ARGUMENT_LIST - ) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/UnionTypeChecker.kt b/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/UnionTypeChecker.kt deleted file mode 100644 index fd88178f1..000000000 --- a/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation/types/UnionTypeChecker.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.larsreimann.safeds.validation.types - -import com.larsreimann.safeds.emf.typeArgumentsOrEmpty -import com.larsreimann.safeds.safeDS.SdsUnionType -import com.larsreimann.safeds.validation.AbstractSafeDSChecker -import com.larsreimann.safeds.validation.codes.ErrorCode -import com.larsreimann.safeds.validation.codes.InfoCode -import org.eclipse.xtext.validation.Check - -class UnionTypeChecker : AbstractSafeDSChecker() { - - @Check - fun numberOfTypeArguments(sdsUnionType: SdsUnionType) { - when (sdsUnionType.typeArgumentsOrEmpty().size) { - 0 -> { - error( - "A union type must have least one type argument.", - null, - ErrorCode.UNION_TYPE_WITHOUT_TYPE_ARGUMENTS - ) - } - 1 -> { - info( - "A union type with one type argument is equivalent to the the type argument itself.", - null, - InfoCode.UnnecessaryUnionType - ) - } - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/codeGeneration.sdsstub b/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/codeGeneration.sdsstub deleted file mode 100644 index 9744f828c..000000000 --- a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/codeGeneration.sdsstub +++ /dev/null @@ -1,24 +0,0 @@ -package safeds.lang - -@Description("The qualified name of the corresponding Python module (default is the qualified name of the package).") -@Target(AnnotationTarget.CompilationUnit) -annotation PythonModule( - @Description("The qualified name of the corresponding Python module.") - qualifiedName: String -) - -@Description("The name of the corresponding API element in Python (default is the name of the declaration in the stubs).") -@Target( - AnnotationTarget.Attribute, - AnnotationTarget.Class, - AnnotationTarget.Enum, - AnnotationTarget.EnumVariant, - AnnotationTarget.Function, - AnnotationTarget.Parameter, - AnnotationTarget.Step, - AnnotationTarget.Pipeline -) -annotation PythonName( - @Description("The name of the corresponding API element in Python.") - name: String -) diff --git a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/coreAnnotations.sdsstub b/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/coreAnnotations.sdsstub deleted file mode 100644 index 1ccdcd91d..000000000 --- a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/coreAnnotations.sdsstub +++ /dev/null @@ -1,105 +0,0 @@ -package safeds.lang - -@Description("The annotation can target these declaration types. If the @Target annotation is not used any declaration type can be targeted.") -@Target(AnnotationTarget.Annotation) -annotation Target( - @Description("The valid targets.") - vararg targets: AnnotationTarget -) - -@Description("The declaration types that can be targeted by annotations.") -enum AnnotationTarget { - @Description("The annotation can be called on annotations.") - Annotation - - @Description("The annotation can be called on attributes.") - Attribute - - @Description("The annotation can be called on classes.") - Class - - @Description("The annotation can be called on compilation units (i.e. files).") - CompilationUnit - - @Description("The annotation can be called on enums.") - Enum - - @Description("The annotation can be called on enum variants.") - EnumVariant - - @Description("The annotation can be called on functions.") - Function - - @Description("The annotation can be called on parameters.") - Parameter - - @Description("The annotation can be called on pipelines.") - Pipeline - - @Description("The annotation can be called on results.") - Result - - @Description("The annotation can be called on steps.") - Step - - @Description("The annotation can be called on type parameters.") - TypeParameter -} - -@Description("The annotation can be called multiple times for the same declaration.") -@Target(AnnotationTarget.Annotation) -annotation Repeatable - -@Description("The declaration should no longer be used.") -@Target( - AnnotationTarget.Annotation, - AnnotationTarget.Attribute, - AnnotationTarget.Class, - AnnotationTarget.Enum, - AnnotationTarget.EnumVariant, - AnnotationTarget.Function, - AnnotationTarget.Parameter, - AnnotationTarget.Result, - AnnotationTarget.Step, - AnnotationTarget.TypeParameter, -) -annotation Deprecated( - @Description("What to use instead.") - alternative: String? = null, - - @Description("Why the declaration was deprecated.") - reason: String? = null, - - @Description("When the declaration was deprecated.") - sinceVersion: String? = null, - - @Description("When the declaration will be removed.") - removalVersion: String? = null, -) - -@Description("The declaration might change without a major version bump.") -@Target( - AnnotationTarget.Annotation, - AnnotationTarget.Attribute, - AnnotationTarget.Class, - AnnotationTarget.Enum, - AnnotationTarget.EnumVariant, - AnnotationTarget.Function, - AnnotationTarget.Parameter, - AnnotationTarget.Result, - AnnotationTarget.Step, - AnnotationTarget.TypeParameter, -) -annotation Experimental - -@Description("The function has no side effects and returns the same results for the same arguments.") -@Target(AnnotationTarget.Function) -annotation Pure - -@Description("The function has no side effects.") -@Target(AnnotationTarget.Function) -annotation NoSideEffects - -@Description("Values assigned to this parameter must be constant.") -@Target(AnnotationTarget.Parameter) -annotation Constant diff --git a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/coreClasses.sdsstub b/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/coreClasses.sdsstub deleted file mode 100644 index 857657ea9..000000000 --- a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/coreClasses.sdsstub +++ /dev/null @@ -1,22 +0,0 @@ -package safeds.lang - -@Description("The common superclass of all classes.") -class Any - -@Description("The common subclass of all classes.") -class Nothing - -@Description("A truth value.") -class Boolean - -@Description("A number.") -class Number - -@Description("An integer.") -class Int sub Number - -@Description("A floating-point number.") -class Float sub Number - -@Description("Some text.") -class String diff --git a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/documentation.sdsstub b/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/documentation.sdsstub deleted file mode 100644 index 92e887873..000000000 --- a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/documentation.sdsstub +++ /dev/null @@ -1,17 +0,0 @@ -package safeds.lang - -@Description("The purpose of a declaration.") -annotation Description( - @Description("The purpose of a declaration.") - description: String -) - -@Description("The version in which a declaration was added.") -annotation Since( - @Description("The version in which a declaration was added.") - version: String -) - -@Description("This parameter should only be used by expert users.") -@Target(AnnotationTarget.Parameter) -annotation Expert diff --git a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/schemaEffects.sdsstub b/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/schemaEffects.sdsstub deleted file mode 100644 index 9a54b5bd2..000000000 --- a/DSL/com.larsreimann.safeds/src/main/resources/stdlib/safeds/lang/schemaEffects.sdsstub +++ /dev/null @@ -1,43 +0,0 @@ -package safeds.lang - -@Description("Reads the initial data schema of a dataset.") -abstract predicate $readSchema ( - datasetPath: String, -) -> ::InitialSchema - -@Description("Checks if the columns with the names 'columnName' exist in the data schema.") -abstract predicate $checkColumn ( - ::CurrentSchema, - vararg columnName: String, -) -> ::SchemaOut - -@Description("Remove all the columns with the names 'columnName' from the data schema.") -abstract predicate $removeColumn ( - ::CurrentSchema, - vararg columnName: String, -) -> ::SchemaOut - -@Description("Remove all the columns other than the ones with names 'columnName' from the data schema.") -abstract predicate $keepColumn ( - ::CurrentSchema, - vararg columnName: String, -) -> ::SchemaOut - -@Description("Rename the column with name 'currentColumnName' to 'newColumnName' in the data schema if the column exists.") -abstract predicate $renameColumn ( - ::CurrentSchema, - currentColumnName: String, - newColumnName: String, -) -> ::SchemaOut - -@Description("Add a column with name 'newColumnName' and datatype 'NewColumnDataType' in the data schema unless there is already one with the same name.") -abstract predicate $addColumn ( - ::CurrentSchema, - newColumnName: String, -) -> ::SchemaOut - -@Description("Change the datatype to 'NewColumnDataType' of a column with name 'ColumnName' in the data schema.") -abstract predicate $changeColumnType ( - ::CurrentSchema, - columnName: String, -) -> ::SchemaOut \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/IssueFinderTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/IssueFinderTest.kt deleted file mode 100644 index 7bea21d61..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/IssueFinderTest.kt +++ /dev/null @@ -1,220 +0,0 @@ -package com.larsreimann.safeds - -import com.google.inject.Inject -import com.larsreimann.safeds.emf.OriginalFilePath -import com.larsreimann.safeds.testing.CategorizedTest -import com.larsreimann.safeds.testing.FindTestRangesResult -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.ExpectedIssue -import com.larsreimann.safeds.testing.assertions.shouldHaveNoIssue -import com.larsreimann.safeds.testing.assertions.shouldHaveNoSemanticError -import com.larsreimann.safeds.testing.assertions.shouldHaveNoSemanticInfo -import com.larsreimann.safeds.testing.assertions.shouldHaveNoSemanticWarning -import com.larsreimann.safeds.testing.assertions.shouldHaveNoSyntaxError -import com.larsreimann.safeds.testing.assertions.shouldHaveSemanticError -import com.larsreimann.safeds.testing.assertions.shouldHaveSemanticInfo -import com.larsreimann.safeds.testing.assertions.shouldHaveSemanticWarning -import com.larsreimann.safeds.testing.assertions.shouldHaveSyntaxError -import com.larsreimann.safeds.testing.assertions.stringify -import com.larsreimann.safeds.testing.createDynamicTestsFromResourceFolder -import com.larsreimann.safeds.testing.findTestRanges -import com.larsreimann.safeds.testing.getResourcePath -import com.larsreimann.safeds.testing.testDisplayName -import com.larsreimann.safeds.utils.outerZipBy -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.eclipse.xtext.testing.validation.ValidationTestHelper -import org.eclipse.xtext.validation.Issue -import org.junit.jupiter.api.DynamicNode -import org.junit.jupiter.api.DynamicTest.dynamicTest -import org.junit.jupiter.api.TestFactory -import org.junit.jupiter.api.extension.ExtendWith -import java.nio.file.Path -import java.util.stream.Stream - -private const val SYNTAX_ERROR = "syntax_error" -private const val NO_SYNTAX_ERROR = "no_syntax_error" -private const val SEMANTIC_ERROR = "semantic_error" -private const val NO_SEMANTIC_ERROR = "no_semantic_error" -private const val SEMANTIC_WARNING = "semantic_warning" -private const val NO_SEMANTIC_WARNING = "no_semantic_warning" -private const val SEMANTIC_INFO = "semantic_info" -private const val NO_SEMANTIC_INFO = "no_semantic_info" -private const val NO_ISSUE = "no_issue" -private val validSeverities = setOf( - SYNTAX_ERROR, - NO_SYNTAX_ERROR, - SEMANTIC_ERROR, - NO_SEMANTIC_ERROR, - SEMANTIC_WARNING, - NO_SEMANTIC_WARNING, - SEMANTIC_INFO, - NO_SEMANTIC_INFO, - NO_ISSUE, -) -private val semanticSeverities = setOf( - SEMANTIC_ERROR, - NO_SEMANTIC_ERROR, - SEMANTIC_WARNING, - NO_SEMANTIC_WARNING, - SEMANTIC_INFO, - NO_SEMANTIC_INFO, -) - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class IssueFinderTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var validationHelper: ValidationTestHelper - - @TestFactory - fun `should parse test files correctly`(): Stream { - return javaClass.classLoader - .getResourcePath("grammar") - ?.createDynamicTestsFromResourceFolder(::validateTestFile, ::createTest) - ?: Stream.empty() - } - - @TestFactory - fun `should validate test files correctly`(): Stream { - return javaClass.classLoader - .getResourcePath("validation") - ?.createDynamicTestsFromResourceFolder(::validateTestFile, ::createTest) - ?: Stream.empty() - } - - /** - * Checks if the given program is a valid test. If there are issues a description of the issue is returned, - * otherwise this returns `null`. - */ - private fun validateTestFile( - @Suppress("UNUSED_PARAMETER") resourcePath: Path, - filePath: Path, - program: String - ): String? { - val severities = severities(program) - - // Must contain at least one severity - if (severities.isEmpty()) { - return "No expected issue is specified." - } - - // Severities must be valid - severities.forEach { - if (it !in validSeverities) { - return "Severity '$it' is invalid." - } - } - - // Opening and closing test markers must match - val locations = when (val locationsResult = findTestRanges(program)) { - is FindTestRangesResult.Success -> locationsResult.ranges - is FindTestRangesResult.Failure -> return locationsResult.message - } - - // Must not contain more locations markers than severities - if (severities.size < locations.size) { - return "Test file contains more locations (»«) than severities." - } - - // Must be able to parse the test file - if (parseHelper.parseProgramText(program) == null) { - return "Could not parse test file." - } - - // Must not combine syntax errors with checks of semantic errors - if (severities.intersect(semanticSeverities).isNotEmpty()) { - if (severities.contains(SYNTAX_ERROR)) { - return "Cannot combine severity 'syntax_error' with check of semantic errors." - } - - val syntaxErrors = actualIssues(program, filePath).filter { it.isSyntaxError } - if (syntaxErrors.isNotEmpty()) { - return "File checks for semantic issues but has syntax errors${syntaxErrors.stringify()}" - } - } - - return null - } - - private fun createTest(resourcePath: Path, filePath: Path, program: String) = sequence { - expectedIssues(program) - .groupBy { it.severity to it.message } - .keys - .forEach { (severity, message) -> - yield( - CategorizedTest( - severity, - dynamicTest(testDisplayName(resourcePath, filePath, message), filePath.toUri()) { - parsingTest(program, filePath, severity, message) - } - ) - ) - } - } - - private fun parsingTest(program: String, filePath: Path, severity: String, message: String) { - val actualIssues = actualIssues(program, filePath) - expectedIssues(program) - .filter { it.severity == severity && it.message == message } - .forEach { - when (it.severity) { - SYNTAX_ERROR -> actualIssues.shouldHaveSyntaxError(it) - NO_SYNTAX_ERROR -> actualIssues.shouldHaveNoSyntaxError(it) - SEMANTIC_ERROR -> actualIssues.shouldHaveSemanticError(it) - NO_SEMANTIC_ERROR -> actualIssues.shouldHaveNoSemanticError(it) - SEMANTIC_WARNING -> actualIssues.shouldHaveSemanticWarning(it) - NO_SEMANTIC_WARNING -> actualIssues.shouldHaveNoSemanticWarning(it) - SEMANTIC_INFO -> actualIssues.shouldHaveSemanticInfo(it) - NO_SEMANTIC_INFO -> actualIssues.shouldHaveNoSemanticInfo(it) - NO_ISSUE -> actualIssues.shouldHaveNoIssue(it) - } - } - } - - private fun expectedIssues(program: String): List { - val locations = when (val locationsResult = findTestRanges(program)) { - is FindTestRangesResult.Success -> locationsResult.ranges - else -> return emptyList() - } - - return outerZipBy(severitiesAndMessages(program), locations) { severityAndMessage, location -> - ExpectedIssue( - severityAndMessage!!.severity, - severityAndMessage.message, - severityAndMessage.messageIsRegex, - location - ) - } - } - - private fun severities(program: String): List { - return severitiesAndMessages(program).map { it.severity } - } - - private fun severitiesAndMessages(program: String): List { - return """//\s*(?\S+)\s*(?:(?r)?"(?[^"]*)")?""" - .toRegex() - .findAll(program) - .map { - ExpectedIssue( - it.groupValues[1], - it.groupValues[3], - it.groupValues[2] == "r", - null - ) - } - .toList() - } - - private fun actualIssues(program: String, filePath: Path): List { - val parsingResult = parseHelper.parseProgramText(program) ?: return emptyList() - parsingResult.eResource().eAdapters().add(OriginalFilePath(filePath.toString())) - return validationHelper.validate(parsingResult) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/StdlibTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/StdlibTest.kt deleted file mode 100644 index 39b6c1571..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/StdlibTest.kt +++ /dev/null @@ -1,51 +0,0 @@ -package com.larsreimann.safeds - -import com.google.inject.Inject -import com.larsreimann.safeds.emf.OriginalFilePath -import com.larsreimann.safeds.stdlibAccess.listStdlibFiles -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.shouldHaveNoErrorsOrWarnings -import io.kotest.matchers.nulls.shouldNotBeNull -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.eclipse.xtext.testing.validation.ValidationTestHelper -import org.junit.jupiter.api.DynamicNode -import org.junit.jupiter.api.DynamicTest -import org.junit.jupiter.api.TestFactory -import org.junit.jupiter.api.extension.ExtendWith -import java.nio.file.Files -import java.util.stream.Stream - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class StdlibTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var validationHelper: ValidationTestHelper - - @TestFactory - fun `should not have syntax or semantic errors`(): Stream { - val allStdlibFiles = listStdlibFiles().map { it.first.toString() }.toList() - - return listStdlibFiles() - .map { (filePath, _) -> - - // We must do this here and not in the callback of the dynamicTest so the JAR file system is still open - val otherStdlibFiles = allStdlibFiles - filePath.toString() - val program = Files.readString(filePath) - val parsingResult = parseHelper.parseProgramText(program, context = otherStdlibFiles, loadStdlib = false) - - DynamicTest.dynamicTest(filePath.toString(), filePath.toUri()) { - parsingResult.shouldNotBeNull() - parsingResult.eResource().eAdapters().add(OriginalFilePath(filePath.toString())) - validationHelper.validate(parsingResult).shouldHaveNoErrorsOrWarnings() - } - } - .toList() - .stream() - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSIDValueConverterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSIDValueConverterTest.kt deleted file mode 100644 index 91bfe9821..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSIDValueConverterTest.kt +++ /dev/null @@ -1,88 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsClass -import com.larsreimann.safeds.emf.createSdsCompilationUnit -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.conversion.impl.IDValueConverter -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSIDValueConverterTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var idValueConverter: IDValueConverter - - @Nested - inner class toValue { - @Test - fun `should remove backticks (direct converter call)`() { - idValueConverter.toValue("`package`", null) shouldBe "package" - } - - @Test - fun `should remove backticks (file)`() { - val compilationUnit = - parseHelper.parseResource("conversion/idValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - val `class` = compilationUnit.findUniqueDeclarationOrFail("class") - `class`.shouldNotBeNull() - } - } - - @Nested - inner class toString { - @Test - fun `should escape keywords (direct converter call)`() { - idValueConverter.toString("package") shouldBe "`package`" - } - - @Test - fun `should escape keywords (creator)`() { - val `class` = createSdsClass("class") - val compilationUnit = createSdsCompilationUnit(packageName = "test", members = listOf(`class`)) - createSdsDummyResource("test", SdsFileExtension.Test, compilationUnit) - - val result = `class`.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "class `class`" - } - - @Test - fun `should not escape non-keywords (direct converter call)`() { - idValueConverter.toString("notAKeyword") shouldBe "notAKeyword" - } - - @Test - fun `should not escape non-keywords (creator)`() { - val `class` = createSdsClass("notAKeyword") - val compilationUnit = createSdsCompilationUnit(packageName = "notAKeyword", members = listOf(`class`)) - createSdsDummyResource("test", SdsFileExtension.Test, compilationUnit) - - val result = `class`.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "class notAKeyword" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSINTValueConverterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSINTValueConverterTest.kt deleted file mode 100644 index d387840ce..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSINTValueConverterTest.kt +++ /dev/null @@ -1,81 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.emf.createSdsInt -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.sdsExpressionStatement -import com.larsreimann.safeds.emf.sdsPipeline -import com.larsreimann.safeds.safeDS.SdsInt -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.conversion.impl.INTValueConverter -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSINTValueConverterTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var intValueConverter: INTValueConverter - - @Nested - inner class toValue { - @Test - fun `should convert string to int (direct converter call)`() { - intValueConverter.toValue("1", null) shouldBe 1 - } - - @Test - fun `should convert string to int (file)`() { - val compilationUnit = parseHelper.parseResource( - "conversion/intValueConverter.sdstest", - ) // readProgramTextFromResource(resourceName)?.let { parseHelper.parse(it) } - compilationUnit.shouldNotBeNull() - - val int = compilationUnit.descendants().toList() - int.shouldHaveSize(1) - - int[0].value shouldBe 1 - } - } - - @Nested - inner class toString { - @Test - fun `should convert int to string (direct converter call)`() { - intValueConverter.toString(1) shouldBe "1" - } - - @Test - fun `should convert int to string (creator)`() { - val int = createSdsInt(1) - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline("test") { - sdsExpressionStatement(int) - } - } - - val result = int.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "1" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSQualifiedNameValueConverterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSQualifiedNameValueConverterTest.kt deleted file mode 100644 index 04ec2ffda..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSQualifiedNameValueConverterTest.kt +++ /dev/null @@ -1,149 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsCompilationUnit -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.emf.createSdsImport -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSQualifiedNameValueConverterTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var qualifiedNameValueConverter: QualifiedNameValueConverter - - @Nested - inner class toValue { - @Test - fun `should remove backticks (direct converter call, no wildcard)`() { - qualifiedNameValueConverter.toValue("safeds.`package`", null) shouldBe "safeds.package" - } - - @Test - fun `should remove backticks (direct converter call, with wildcard)`() { - qualifiedNameValueConverter.toValue("safeds.`package`.*", null) shouldBe "safeds.package.*" - } - - @Test - fun `should remove backticks (file, no wildcard)`() { - val compilationUnit = - parseHelper.parseResource("conversion/qualifiedNameValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - compilationUnit.name shouldBe "safeds.package" - } - - @Test - fun `should remove backticks (file, with wildcard)`() { - val compilationUnit = - parseHelper.parseResource("conversion/qualifiedNameValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - compilationUnit.name.shouldNotBeNull() - - val imports = compilationUnit.imports - imports.shouldHaveSize(1) - - imports[0].importedNamespace shouldBe "safeds.package.*" - } - } - - @Nested - inner class toString { - @Test - fun `should escape keywords (direct converter call, no wildcard)`() { - qualifiedNameValueConverter.toString("safeds.package") shouldBe "safeds.`package`" - } - - @Test - fun `should escape keywords (direct converter call, with wildcard)`() { - qualifiedNameValueConverter.toString("safeds.package.*") shouldBe "safeds.`package`.*" - } - - @Test - fun `should escape keywords (creator, no wildcard)`() { - val compilationUnit = createSdsCompilationUnit(packageName = "safeds.package") - createSdsDummyResource( - "test", - SdsFileExtension.Test, - compilationUnit - ) - - val result = compilationUnit.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "package safeds.`package`" - } - - @Test - fun `should escape keywords (creator, with wildcard)`() { - val import = createSdsImport("safeds.package.*") - createSdsDummyResource( - fileName = "test", - SdsFileExtension.Test, - createSdsCompilationUnit(packageName = "test", imports = listOf(import)) - ) - - val result = import.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "import safeds.`package`.*" - } - - @Test - fun `should not escape non-keywords (direct converter call, no wildcard)`() { - qualifiedNameValueConverter.toString("safeds.notAKeyword") shouldBe "safeds.notAKeyword" - } - - @Test - fun `should not escape non-keywords (direct converter call, with wildcard)`() { - qualifiedNameValueConverter.toString("safeds.notAKeyword.*") shouldBe "safeds.notAKeyword.*" - } - - @Test - fun `should not escape non-keywords (creator, no wildcard)`() { - val compilationUnit = createSdsCompilationUnit(packageName = "safeds.notAKeyword") - createSdsDummyResource( - "test", - SdsFileExtension.Test, - compilationUnit - ) - - val result = compilationUnit.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "package safeds.notAKeyword" - } - - @Test - fun `should not escape non-keywords (creator, with wildcard)`() { - val import = createSdsImport("safeds.notAKeyword.*") - createSdsDummyResource( - fileName = "test", - SdsFileExtension.Test, - createSdsCompilationUnit(packageName = "test", imports = listOf(import)) - ) - - val result = import.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "import safeds.notAKeyword.*" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSSTRINGValueConverterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSSTRINGValueConverterTest.kt deleted file mode 100644 index cfda61f81..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSSTRINGValueConverterTest.kt +++ /dev/null @@ -1,169 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.emf.createSdsString -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.sdsExpressionStatement -import com.larsreimann.safeds.emf.sdsPipeline -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsString -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.conversion.impl.STRINGValueConverter -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSSTRINGValueConverterTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var stringValueConverter: STRINGValueConverter - - @Nested - inner class toValue { - @Test - fun `should unescape opening curly brace (direct converter call)`() { - stringValueConverter.toValue("\"\\{\"", null) shouldBe "{" - } - - @Test - fun `should unescape opening curly brace (file)`() { - val compilationUnit = - parseHelper.parseResource("conversion/stringValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("escapedOpeningBrace") - - val strings = pipeline.descendants().toList() - strings.shouldHaveSize(1) - strings[0].value shouldBe "{" - } - - @Test - fun `should unescape single quote (direct converter call)`() { - stringValueConverter.toValue("\"\\'\"", null) shouldBe "'" - } - - @Test - fun `should unescape single quote (file)`() { - val compilationUnit = - parseHelper.parseResource("conversion/stringValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("escapedSingleQuote") - - val strings = pipeline.descendants().toList() - strings.shouldHaveSize(1) - strings[0].value shouldBe "'" - } - } - - @Nested - inner class toString { - @Test - fun `should escape opening curly brace (direct converter call)`() { - stringValueConverter.toString("{") shouldBe "\"\\{\"" - } - - @Test - fun `should keep escaped opening curly brace (file)`() { - val compilationUnit = - parseHelper.parseResource("conversion/stringValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("escapedOpeningBrace") - - val strings = pipeline.descendants().toList() - strings.shouldHaveSize(1) - - val result = strings[0].serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "\"\\{\"" - } - - @Test - fun `should keep unescaped opening curly brace (file)`() { - val compilationUnit = - parseHelper.parseResource("conversion/stringValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("unescapedOpeningBrace") - - val strings = pipeline.descendants().toList() - strings.shouldHaveSize(1) - - val result = strings[0].serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "\"{\"" - } - - @Test - fun `should always escape opening curly brace (creator)`() { - val string = createSdsString("{") - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline("test") { - sdsExpressionStatement(string) - } - } - - val result = string.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "\"\\{\"" - } - - @Test - fun `should not escape single quote (direct converter call)`() { - stringValueConverter.toString("'") shouldBe "\"'\"" - } - - @Test - fun `should not escape single quote (file)`() { - val compilationUnit = - parseHelper.parseResource("conversion/stringValueConverter.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("unescapedSingleQuote") - - val strings = pipeline.descendants().toList() - strings.shouldHaveSize(1) - - val result = strings[0].serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "\"'\"" - } - - @Test - fun `should not escape single quote (creator)`() { - val string = createSdsString("'") - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline("test") { - sdsExpressionStatement(string) - } - } - - val result = string.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "\"'\"" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_ENDValueConverterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_ENDValueConverterTest.kt deleted file mode 100644 index 0ec31a5cc..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_ENDValueConverterTest.kt +++ /dev/null @@ -1,87 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.emf.createSdsNull -import com.larsreimann.safeds.emf.createSdsTemplateString -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.sdsExpressionStatement -import com.larsreimann.safeds.emf.sdsPipeline -import com.larsreimann.safeds.safeDS.SdsTemplateStringEnd -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSTEMPLATE_STRING_ENDValueConverterTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var templateStringEndValueConverter: SafeDSTEMPLATE_STRING_ENDValueConverter - - @Nested - inner class toValue { - @Test - fun `should remove delimiters (direct converter call)`() { - templateStringEndValueConverter.toValue("}}end\"", null) shouldBe "end" - } - - @Test - fun `should remove delimiters (file)`() { - val compilationUnit = parseHelper.parseResource( - "conversion/templateStringPartValueConverter.sdstest", - ) // readProgramTextFromResource(resourceName)?.let { parseHelper.parse(it) } - compilationUnit.shouldNotBeNull() - - val stringTemplateParts = compilationUnit.descendants().toList() - stringTemplateParts.shouldHaveSize(1) - - stringTemplateParts[0].value shouldBe "end" - } - } - - @Nested - inner class toString { - @Test - fun `should add delimiters (direct converter call)`() { - templateStringEndValueConverter.toString("end") shouldBe "}}end\"" - } - - @Test - fun `should add delimiters (creator)`() { - val stringTemplate = createSdsTemplateString( - listOf("start", "end"), - listOf(createSdsNull()), - ) - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline("test") { - sdsExpressionStatement(stringTemplate) - } - } - - val expressions = stringTemplate.expressions - expressions.shouldHaveSize(3) - - val result = expressions[2].serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "}}end\"" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_INNERValueConverterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_INNERValueConverterTest.kt deleted file mode 100644 index c478cd79f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_INNERValueConverterTest.kt +++ /dev/null @@ -1,87 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.emf.createSdsNull -import com.larsreimann.safeds.emf.createSdsTemplateString -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.sdsExpressionStatement -import com.larsreimann.safeds.emf.sdsPipeline -import com.larsreimann.safeds.safeDS.SdsTemplateStringInner -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSTEMPLATE_STRING_INNERValueConverterTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var templateStringInnerValueConverter: SafeDSTEMPLATE_STRING_INNERValueConverter - - @Nested - inner class toValue { - @Test - fun `should remove delimiters (direct converter call)`() { - templateStringInnerValueConverter.toValue("}}inner{{", null) shouldBe "inner" - } - - @Test - fun `should remove delimiters (file)`() { - val compilationUnit = parseHelper.parseResource( - "conversion/templateStringPartValueConverter.sdstest", - ) // readProgramTextFromResource(resourceName)?.let { parseHelper.parse(it) } - compilationUnit.shouldNotBeNull() - - val stringTemplateParts = compilationUnit.descendants().toList() - stringTemplateParts.shouldHaveSize(1) - - stringTemplateParts[0].value shouldBe "inner" - } - } - - @Nested - inner class toString { - @Test - fun `should add delimiters (direct converter call)`() { - templateStringInnerValueConverter.toString("inner") shouldBe "}}inner{{" - } - - @Test - fun `should add delimiters (creator)`() { - val stringTemplate = createSdsTemplateString( - listOf("start", "inner", "end"), - listOf(createSdsNull(), createSdsNull()), - ) - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline("test") { - sdsExpressionStatement(stringTemplate) - } - } - - val expressions = stringTemplate.expressions - expressions.shouldHaveSize(5) - - val result = expressions[2].serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "}}inner{{" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_STARTValueConverterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_STARTValueConverterTest.kt deleted file mode 100644 index 7ff55202d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion/SafeDSTEMPLATE_STRING_STARTValueConverterTest.kt +++ /dev/null @@ -1,87 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.conversion - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.emf.createSdsNull -import com.larsreimann.safeds.emf.createSdsTemplateString -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.sdsExpressionStatement -import com.larsreimann.safeds.emf.sdsPipeline -import com.larsreimann.safeds.safeDS.SdsTemplateStringStart -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSTEMPLATE_STRING_STARTValueConverterTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var templateStringStartValueConverter: SafeDSTEMPLATE_STRING_STARTValueConverter - - @Nested - inner class toValue { - @Test - fun `should remove delimiters (direct converter call)`() { - templateStringStartValueConverter.toValue("\"start{{", null) shouldBe "start" - } - - @Test - fun `should remove delimiters (file)`() { - val compilationUnit = parseHelper.parseResource( - "conversion/templateStringPartValueConverter.sdstest", - ) // readProgramTextFromResource(resourceName)?.let { parseHelper.parse(it) } - compilationUnit.shouldNotBeNull() - - val stringTemplateParts = compilationUnit.descendants().toList() - stringTemplateParts.shouldHaveSize(1) - - stringTemplateParts[0].value shouldBe "start" - } - } - - @Nested - inner class toString { - @Test - fun `should add delimiters (direct converter call)`() { - templateStringStartValueConverter.toString("start") shouldBe "\"start{{" - } - - @Test - fun `should add delimiters (creator)`() { - val stringTemplate = createSdsTemplateString( - listOf("start", "end"), - listOf(createSdsNull()), - ) - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline("test") { - sdsExpressionStatement(stringTemplate) - } - } - - val expressions = stringTemplate.expressions - expressions.shouldHaveSize(3) - - val result = expressions[0].serializeToFormattedString() - result.shouldBeInstanceOf() - result.code shouldBe "\"start{{" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/emf/CreatorsTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/emf/CreatorsTest.kt deleted file mode 100644 index fd7d25683..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/emf/CreatorsTest.kt +++ /dev/null @@ -1,814 +0,0 @@ -package com.larsreimann.safeds.emf - -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.constant.SdsPrefixOperationOperator -import com.larsreimann.safeds.constant.SdsProtocolTokenClassValue -import com.larsreimann.safeds.constant.SdsTypeParameterConstraintOperator -import com.larsreimann.safeds.safeDS.SdsFloat -import com.larsreimann.safeds.safeDS.SdsInt -import com.larsreimann.safeds.safeDS.SdsLambdaParameterList -import com.larsreimann.safeds.safeDS.SdsParameterList -import com.larsreimann.safeds.safeDS.SdsPrefixOperation -import com.larsreimann.safeds.safeDS.SdsProtocol -import com.larsreimann.safeds.safeDS.SdsTemplateStringEnd -import com.larsreimann.safeds.safeDS.SdsTemplateStringInner -import com.larsreimann.safeds.safeDS.SdsTemplateStringStart -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.shouldBeCloseTo -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import io.kotest.assertions.asClue -import io.kotest.assertions.throwables.shouldNotThrow -import io.kotest.assertions.throwables.shouldThrow -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -/** - * Includes tests for the (extension) functions in Creators.kt. Since most of the functions are straightforward, not - * everything is being tested. These are the guidelines for what should be tested: - * - * - Handling of annotations (features annotationCallList vs. annotations) - * - Extension functions should add created object to receiver - * - Creators for objects with cross-references that take a name instead of the referenced object - * - Should not create unnecessary syntax (like empty class bodies) - * - * There are also some special tests: - * - Dummy resource should be serializable - * - Assignments requires at least one assignee - * - Template string creator should check structure of template string - * - Union type requires at least one type argument - */ -@OptIn(ExperimentalSdsApi::class) -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class CreatorsTest { - - @Test - fun `createSdsDummyResource should create serializable dummy resource`() { - val result = createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") - - result.contents.shouldHaveSize(1) - result.contents[0].serializeToFormattedString().shouldBeInstanceOf() - } - - @Test - fun `createSdsAnnotation should store annotation uses in annotationCallList`() { - val annotation = createSdsAnnotation( - "Test", - listOf(createSdsAnnotationCall("Test")), - ) - - annotation.annotationCalls.shouldHaveSize(0) - - val annotationCallList = annotation.annotationCallList - annotationCallList.shouldNotBeNull() - annotationCallList.annotationCalls.shouldHaveSize(1) - } - - @Test - fun `createSdsAnnotation should omit empty parameter lists`() { - val annotation = createSdsAnnotation( - "Test", - parameters = emptyList(), - ) - - annotation.parameterList.shouldBeNull() - } - - @Test - fun `sdsAnnotation should add the created annotation to the receiving compilation unit`() { - val compilationUnit = createSdsCompilationUnit(packageName = "test") { - sdsAnnotation("Test") - } - - compilationUnit.members.shouldHaveSize(1) - } - - @Test - fun `createSdsAnnotationUse should omit empty argument lists`() { - val annotationUse = createSdsAnnotationCall( - "Test", - arguments = emptyList(), - ) - annotationUse.argumentList.shouldBeNull() - } - - @Test - fun `createSdsAnnotationUse should create an SdsAnnotation when only a name is passed`() { - val annotationUse = createSdsAnnotationCall("Test") - val annotation = annotationUse.annotation - annotation.shouldNotBeNull() - annotation.name shouldBe "Test" - } - - @Test - fun `createSdsArgument should create an SdsParameter when only a name is passed`() { - val argument = createSdsArgument(createSdsInt(1), "Test") - val parameter = argument.parameter - parameter.shouldNotBeNull() - parameter.name shouldBe "Test" - } - - @Test - fun `sdsAssignment should throw if no type arguments are passed`() { - shouldThrow { - createSdsAssignment(listOf(), createSdsInt(1)) - } - } - - @Test - fun `sdsAssignment should add the created assignment to the receiving lambda`() { - val lambda = createSdsBlockLambda { - sdsAssignment( - listOf(createSdsWildcard()), - createSdsInt(1), - ) - } - - val body = lambda.body - body.shouldNotBeNull() - body.statements.shouldHaveSize(1) - } - - @Test - fun `sdsAssignment should add the created assignment to the receiving pipeline`() { - val pipeline = createSdsPipeline("Test") { - sdsAssignment( - listOf(createSdsWildcard()), - createSdsInt(1), - ) - } - - val body = pipeline.body - body.shouldNotBeNull() - body.statements.shouldHaveSize(1) - } - - @Test - fun `sdsAssignment should add the created assignment to the receiving step`() { - val step = createSdsStep("Test") { - sdsAssignment( - listOf(createSdsWildcard()), - createSdsInt(1), - ) - } - - val body = step.body - body.shouldNotBeNull() - body.statements.shouldHaveSize(1) - } - - @Test - fun `createSdsAttribute should store annotation uses in annotationCallList`() { - val attribute = createSdsAttribute( - "Test", - listOf(createSdsAnnotationCall("Test")), - ) - - attribute.annotationCalls.shouldHaveSize(0) - - val annotationCallList = attribute.annotationCallList - annotationCallList.shouldNotBeNull() - annotationCallList.annotationCalls.shouldHaveSize(1) - } - - @Test - fun `sdsAttribute should add the created attribute to the receiver`() { - val `class` = createSdsClass("Test") { - sdsAttribute("Test") - } - - val body = `class`.body - body.shouldNotBeNull() - body.members.shouldHaveSize(1) - } - - @Test - fun `createSdsBlockLambda should not omit empty parameter lists`() { - val lambda = createSdsBlockLambda(parameters = emptyList()) - lambda.parameterList.shouldBeInstanceOf() - } - - @Test - fun `createSdsBlockLambda should use a lambda parameter list for parameters`() { - val lambda = createSdsBlockLambda() - lambda.parameterList.shouldBeInstanceOf() - } - - @Test - fun `createSdsBlockLambda should create a serializable block lambda`() { - val lambda = createSdsBlockLambda() - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline(name = "test") { - sdsExpressionStatement(lambda) - } - } - - lambda.serializeToFormattedString().shouldBeInstanceOf() - } - - @Test - fun `createSdsCall should omit empty type argument lists`() { - val call = createSdsCall( - createSdsNull(), - typeArguments = emptyList(), - ) - call.typeArgumentList.shouldBeNull() - } - - @Test - fun `createSdsClass should store annotation uses in annotationCallList`() { - val `class` = createSdsClass( - "Test", - listOf(createSdsAnnotationCall("Test")), - ) - - `class`.annotationCalls.shouldHaveSize(0) - - val annotationCallList = `class`.annotationCallList - annotationCallList.shouldNotBeNull() - annotationCallList.annotationCalls.shouldHaveSize(1) - } - - @Test - fun `createSdsClass should omit empty body`() { - val `class` = createSdsClass( - "Test", - members = emptyList(), - ) - `class`.body.shouldBeNull() - } - - @Test - fun `createSdsClass should not omit empty parameter lists`() { - val `class` = createSdsClass( - "Test", - parameters = emptyList(), - ) - `class`.parameterList.shouldBeInstanceOf() - } - - @Test - fun `createSdsClass should omit empty parent type list`() { - val `class` = createSdsClass( - "Test", - parentTypes = emptyList(), - ) - `class`.parentTypeList.shouldBeNull() - } - - @Test - fun `createSdsClass should omit empty type parameter list`() { - val `class` = createSdsClass( - "Test", - typeParameters = emptyList(), - ) - `class`.typeParameterList.shouldBeNull() - } - -// constraints are now a member, doesn't make sense -// -// @Test -// fun `createSdsClass should omit empty constraint list`() { -// val `class` = createSdsClass( -// "Test", -// constraints = emptyList() -// ) -// `class`.constraintList.shouldBeNull() -// } - - @Test - fun `sdsClass should add the created class to the receiving class`() { - val `class` = createSdsClass("Test") { - sdsClass("Test") - } - - val body = `class`.body - body.shouldNotBeNull() - body.members.shouldHaveSize(1) - } - - @Test - fun `sdsClass should add the created class to the receiving compilation unit`() { - val compilationUnit = createSdsCompilationUnit(packageName = "test") { - sdsClass("Test") - } - - compilationUnit.members.shouldHaveSize(1) - } - - @Test - fun `createSdsCompilationUnit should store annotation uses in annotationCalls`() { - val compilationUnit = createSdsCompilationUnit( - packageName = "test", - listOf(createSdsAnnotationCall("Test")), - ) - - compilationUnit.annotationCalls.shouldHaveSize(1) - compilationUnit.annotationCallList.shouldBeNull() - } - - @Test - fun `createSdsEnum should store annotation uses in annotationCallList`() { - val `enum` = createSdsEnum( - "Test", - listOf(createSdsAnnotationCall("Test")), - ) - - `enum`.annotationCalls.shouldHaveSize(0) - - val annotationCallList = `enum`.annotationCallList - annotationCallList.shouldNotBeNull() - annotationCallList.annotationCalls.shouldHaveSize(1) - } - - @Test - fun `createSdsEnum should omit empty body`() { - val enum = createSdsEnum( - "Test", - variants = emptyList(), - ) - enum.body.shouldBeNull() - } - - @Test - fun `sdsEnum should add the created enum to the receiving class`() { - val `class` = createSdsClass("Test") { - sdsEnum("Test") - } - - val body = `class`.body - body.shouldNotBeNull() - body.members.shouldHaveSize(1) - } - - @Test - fun `sdsEnum should add the created enum to the receiving compilation unit`() { - val compilationUnit = createSdsCompilationUnit(packageName = "test") { - sdsEnum("Test") - } - - compilationUnit.members.shouldHaveSize(1) - } - - @Test - fun `createSdsEnumVariant should store annotation uses in annotations`() { - val variant = createSdsEnumVariant( - "Test", - listOf(createSdsAnnotationCall("Test")), - ) - - variant.annotationCalls.shouldHaveSize(1) - variant.annotationCallList.shouldBeNull() - } - - @Test - fun `createSdsEnumVariant should omit empty type parameter list`() { - val enum = createSdsEnumVariant( - "Test", - typeParameters = emptyList(), - ) - enum.typeParameterList.shouldBeNull() - } - - @Test - fun `createSdsEnumVariant should omit empty parameter list`() { - val enum = createSdsEnumVariant( - "Test", - parameters = emptyList(), - ) - enum.parameterList.shouldBeNull() - } - - @Test - fun `createSdsEnumVariant should omit empty constraint list`() { - val enum = createSdsEnumVariant( - "Test", - ) - enum.constraint.shouldBeNull() - } - - @Test - fun `sdsEnumVariant should add the created variant to the receiver`() { - val enum = createSdsEnum("Test") { - sdsEnumVariant("Test") - } - - val body = enum.body - body.shouldNotBeNull() - body.variants.shouldHaveSize(1) - } - - @Test - fun `createSdsExpressionLambda should use a lambda parameter list for parameters`() { - val lambda = createSdsExpressionLambda(result = createSdsNull()) - lambda.parameterList.shouldBeInstanceOf() - } - - @Test - fun `createSdsExpressionLambda should create a serializable expression lambda`() { - val lambda = createSdsExpressionLambda(result = createSdsNull()) - - createSdsDummyResource(fileName = "test", SdsFileExtension.Test, packageName = "test") { - sdsPipeline(name = "test") { - sdsExpressionStatement(lambda) - } - } - - lambda.serializeToFormattedString().shouldBeInstanceOf() - } - - @Test - fun `sdsExpressionStatement should add the created expression statement to the receiving lambda`() { - val lambda = createSdsBlockLambda { - sdsExpressionStatement(createSdsInt(1)) - } - - val body = lambda.body - body.shouldNotBeNull() - body.statements.shouldHaveSize(1) - } - - @Test - fun `sdsExpressionStatement should add the created expression statement to the receiving pipeline`() { - val pipeline = createSdsPipeline("Test") { - sdsExpressionStatement(createSdsInt(1)) - } - - val body = pipeline.body - body.shouldNotBeNull() - body.statements.shouldHaveSize(1) - } - - @Test - fun `sdsExpressionStatement should add the created expression statement to the receiving step`() { - val step = createSdsStep("Test") { - sdsExpressionStatement(createSdsInt(1)) - } - - val body = step.body - body.shouldNotBeNull() - body.statements.shouldHaveSize(1) - } - - @Test - fun `createSdsFloat should wrap negative numbers in a prefix operation (-)`() { - val float = createSdsFloat(-1.0) - - float.shouldBeInstanceOf() - float.operator shouldBe SdsPrefixOperationOperator.Minus.operator - - val operand = float.operand - operand.shouldBeInstanceOf() - operand.value shouldBeCloseTo 1.0 - } - - @Test - fun `createSdsFunction should store annotation uses in annotationCallList`() { - val function = createSdsFunction( - "test", - listOf(createSdsAnnotationCall("Test")), - ) - - function.annotationCalls.shouldHaveSize(0) - - val annotationCallList = function.annotationCallList - annotationCallList.shouldNotBeNull() - annotationCallList.annotationCalls.shouldHaveSize(1) - } - - @Test - fun `createSdsFunction should omit empty result list`() { - val function = createSdsFunction( - "test", - results = emptyList(), - ) - function.resultList.shouldBeNull() - } - - @Test - fun `createSdsFunction should omit empty type parameter list`() { - val function = createSdsFunction( - "test", - typeParameters = emptyList(), - ) - function.typeParameterList.shouldBeNull() - } - - @Test - fun `sdsFunction should add the created function to the receiving class`() { - val `class` = createSdsClass("Test") { - sdsFunction("test") - } - - val body = `class`.body - body.shouldNotBeNull() - body.members.shouldHaveSize(1) - } - - @Test - fun `sdsFunction should add the created function to the receiving compilation unit`() { - val compilationUnit = createSdsCompilationUnit(packageName = "test") { - sdsFunction("test") - } - - compilationUnit.members.shouldHaveSize(1) - } - - @Test - fun `createSdsInt should wrap negative numbers in a prefix operation (-)`() { - val int = createSdsInt(-1) - - int.shouldBeInstanceOf() - int.operator shouldBe SdsPrefixOperationOperator.Minus.operator - - val operand = int.operand - operand.shouldBeInstanceOf() - operand.value shouldBe 1 - } - - @Test - fun `createSdsNamedType should omit empty type argument lists`() { - val namedType = createSdsNamedType( - createSdsClass("Int"), - typeArguments = emptyList(), - ) - namedType.typeArgumentList.shouldBeNull() - } - - @Test - fun `createSdsParameter should store annotation uses in annotations`() { - val parameter = createSdsParameter( - "test", - listOf(createSdsAnnotationCall("Test")), - ) - - parameter.annotationCalls.shouldHaveSize(1) - parameter.annotationCallList.shouldBeNull() - } - - @Test - fun `createSdsProtocol should omit empty subterm list`() { - val protocol = createSdsProtocol(emptyList()) - protocol.body.shouldNotBeNull() - protocol.body.subtermList.shouldBeNull() - } - - @Test - fun `sdsProtocol should add the created protocol to the receiving class`() { - val `class` = createSdsClass("Test") { - sdsProtocol() - } - - `class`.body.shouldNotBeNull() - `class`.body.members.filterIsInstance().shouldHaveSize(1) - } - - @Test - fun `createSdsProtocolAlternative should throw if fewer than two terms are passed`() { - shouldThrow { - createSdsProtocolAlternative(listOf()) - } - - shouldThrow { - createSdsProtocolAlternative( - listOf( - createSdsProtocolTokenClass(SdsProtocolTokenClassValue.Anything), - ), - ) - } - - shouldNotThrow { - createSdsProtocolAlternative( - listOf( - createSdsProtocolTokenClass(SdsProtocolTokenClassValue.Anything), - createSdsProtocolTokenClass(SdsProtocolTokenClassValue.Anything), - ), - ) - } - } - - @Test - fun `createSdsProtocolComplement should omit empty reference list`() { - val complement = createSdsProtocolComplement() - complement.referenceList.shouldBeNull() - } - - @Test - fun `createSdsProtocolSequence should throw if fewer than two terms are passed`() { - shouldThrow { - createSdsProtocolSequence(listOf()) - } - - shouldThrow { - createSdsProtocolSequence( - listOf( - createSdsProtocolTokenClass(SdsProtocolTokenClassValue.Anything), - ), - ) - } - - shouldNotThrow { - createSdsProtocolSequence( - listOf( - createSdsProtocolTokenClass(SdsProtocolTokenClassValue.Anything), - createSdsProtocolTokenClass(SdsProtocolTokenClassValue.Anything), - ), - ) - } - } - - @Test - fun `sdsProtocolSubterm should add the created subterm to the receiving protocol`() { - val protocol = createSdsProtocol { - sdsProtocolSubterm("test", createSdsProtocolTokenClass(SdsProtocolTokenClassValue.Anything)) - } - - protocol.body.shouldNotBeNull() - protocol.body.subtermList.shouldNotBeNull() - protocol.body.subtermList.subterms.shouldHaveSize(1) - } - - @Test - fun `createSdsResult should store annotation uses in annotations`() { - val result = createSdsResult( - "Test", - listOf(createSdsAnnotationCall("Test")), - ) - - result.annotationCalls.shouldHaveSize(1) - result.annotationCallList.shouldBeNull() - } - - @Test - fun `createSdsTemplate should throw if there are fewer than 2 string parts`() { - shouldThrow { - createSdsTemplateString( - listOf("Test"), - listOf(createSdsInt(1)), - ) - } - } - - @Test - fun `createSdsTemplate should throw if there is no template expression`() { - shouldThrow { - createSdsTemplateString( - listOf("Test", "Test"), - listOf(), - ) - } - } - - @Test - fun `createSdsTemplate should throw if numbers of string parts and template expressions don't match`() { - shouldThrow { - createSdsTemplateString( - listOf("Test", "Test", "Test"), - listOf(createSdsInt(1)), - ) - } - } - - @Test - fun `createSdsTemplate should interleave string parts and template expressions`() { - val templateString = createSdsTemplateString( - listOf("Start", "Inner", "Inner", "End"), - listOf(createSdsInt(1), createSdsInt(1), createSdsInt(1)), - ) - - templateString.expressions.asClue { - it.shouldHaveSize(7) - it[0].shouldBeInstanceOf() - it[1].shouldBeInstanceOf() - it[2].shouldBeInstanceOf() - it[3].shouldBeInstanceOf() - it[4].shouldBeInstanceOf() - it[5].shouldBeInstanceOf() - it[6].shouldBeInstanceOf() - } - } - - @Test - fun `createSdsTypeArgument should create an SdsTypeParameter when only a name is passed`() { - val typeArgument = createSdsTypeArgument( - createSdsStarProjection(), - "Test", - ) - val typeParameter = typeArgument.typeParameter - typeParameter.shouldNotBeNull() - typeParameter.name shouldBe "Test" - } - - @Test - fun `createSdsTypeParameter should store annotation uses in annotations`() { - val result = createSdsTypeParameter( - "Test", - listOf(createSdsAnnotationCall("Test")), - ) - - result.annotationCalls.shouldHaveSize(1) - result.annotationCallList.shouldBeNull() - } - - @Test - fun `createTypeParameterConstraint should create an SdsTypeParameter when only a name is passed`() { - val constraint = createSdsTypeParameterConstraint( - "Test", - SdsTypeParameterConstraintOperator.SubclassOf, - createSdsNamedType(createSdsClass("Test")), - ) - val leftOperand = constraint.leftOperand - leftOperand.shouldNotBeNull() - leftOperand.name shouldBe "Test" - } - - @Test - fun `createSdsUnionType should throw if no type arguments are passed`() { - shouldThrow { - createSdsUnionType(listOf()) - } - - shouldNotThrow { - createSdsUnionType( - listOf( - createSdsTypeArgument( - createSdsStarProjection(), - ), - ), - ) - } - } - - @Test - fun `createSdsYield should create an SdsResult when only a name is passed`() { - val yield = createSdsYield("test") - val result = `yield`.result - result.shouldNotBeNull() - result.name shouldBe "test" - } - - @Test - fun `createSdsStep should store annotation uses in annotationCallList`() { - val step = createSdsStep( - "test", - listOf(createSdsAnnotationCall("Test")), - ) - - step.annotationCalls.shouldHaveSize(0) - - val annotationCallList = step.annotationCallList - annotationCallList.shouldNotBeNull() - annotationCallList.annotationCalls.shouldHaveSize(1) - } - - @Test - fun `createSdsStep should omit empty result list`() { - val function = createSdsStep( - "test", - results = emptyList(), - ) - function.resultList.shouldBeNull() - } - - @Test - fun `sdsStep should add the created step to the receiving compilation unit`() { - val compilationUnit = createSdsCompilationUnit(packageName = "test") { - sdsStep("test") - } - - compilationUnit.members.shouldHaveSize(1) - } - - @Test - fun `createSdsPipeline should store annotation uses in annotationCallList`() { - val pipeline = createSdsPipeline( - "test", - listOf(createSdsAnnotationCall("Test")), - ) - - pipeline.annotationCalls.shouldHaveSize(0) - - val annotationCallList = pipeline.annotationCallList - annotationCallList.shouldNotBeNull() - annotationCallList.annotationCalls.shouldHaveSize(1) - } - - @Test - fun `sdsPipeline should add the created pipeline to the receiving compilation unit`() { - val compilationUnit = createSdsCompilationUnit(packageName = "test") { - sdsPipeline("test") - } - - compilationUnit.members.shouldHaveSize(1) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/formatting2/FormatterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/formatting2/FormatterTest.kt deleted file mode 100644 index 85264b170..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/formatting2/FormatterTest.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.larsreimann.safeds.formatting2 - -import com.google.inject.Inject -import com.larsreimann.safeds.testing.CategorizedTest -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.createDynamicTestsFromResourceFolder -import com.larsreimann.safeds.testing.getResourcePath -import com.larsreimann.safeds.testing.testDisplayName -import com.larsreimann.safeds.testing.withSystemLineBreaks -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.eclipse.xtext.testing.formatter.FormatterTestHelper -import org.junit.jupiter.api.DynamicNode -import org.junit.jupiter.api.DynamicTest -import org.junit.jupiter.api.TestFactory -import org.junit.jupiter.api.extension.ExtendWith -import java.nio.file.Path -import java.util.stream.Stream - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class FormatterTest { - - @Inject - lateinit var formatter: FormatterTestHelper - - private val separator = Regex("// -*") - - @TestFactory - fun `should be formatted properly`(): Stream { - return javaClass.classLoader - .getResourcePath("formatting") - ?.createDynamicTestsFromResourceFolder(::validateTestFile, ::createTest) - ?: Stream.empty() - } - - /** - * Checks if the given program is a valid test. If there are issues a description of the issue is returned, otherwise - * this returns null. - */ - @Suppress("UNUSED_PARAMETER") - private fun validateTestFile(resourcePath: Path, filePath: Path, program: String): String? { - if (separator !in program) { - return "Did not find a separator between the original and the formatted code." - } - - return null - } - - private fun createTest(resourcePath: Path, filePath: Path, program: String) = sequence { - yield( - CategorizedTest( - "formatter tests", - DynamicTest.dynamicTest(testDisplayName(resourcePath, filePath), filePath.toUri()) { - assertFormatted(toBeFormatted(program), expectedResult(program)) - } - ) - ) - } - - private fun toBeFormatted(program: String): String { - return program.split(separator)[0].trim() - } - - private fun expectedResult(program: String): String { - return program - .split(separator)[1] - .trim() - .withSystemLineBreaks() - } - - private fun assertFormatted(toBeFormatted: String, expectedResult: String) { - formatter.assertFormatted { - it.toBeFormatted = toBeFormatted - it.expectation = expectedResult + System.lineSeparator() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/generator/GeneratorUtilsTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/generator/GeneratorUtilsTest.kt deleted file mode 100644 index fd31b4d20..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/generator/GeneratorUtilsTest.kt +++ /dev/null @@ -1,194 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.generator - -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsCompilationUnit -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.safeDS.SafeDSFactory -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.string.shouldStartWith -import org.eclipse.emf.common.util.URI -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class GeneratorUtilsTest { - - @Nested - inner class baseFileName { - - @Test - fun `should keep only last segment`() { - val resource = createSdsDummyResource( - "dir/file", - SdsFileExtension.Pipeline, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull().shouldStartWith("file") - } - - @Test - fun `should remove all characters that are not legal in Safe-DS identifiers except spaces`() { - val resource = createSdsDummyResource( - "MyöáúName1", - SdsFileExtension.Pipeline, - createSdsCompilationUnit(packageName = "MyName1"), - ) - - resource.baseFileNameOrNull() shouldBe "MyName1" - } - - @Test - fun `should replace spaces with underscores`() { - val resource = createSdsDummyResource( - "file with spaces", - SdsFileExtension.Pipeline, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "file_with_spaces" - } - - @Test - fun `should replace twice URL encoded spaces with underscores`() { - val resource = createSdsDummyResource( - "_skip_%2520context%2520same%2520package", - SdsFileExtension.Pipeline, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "_skip__context_same_package" - } - - @Test - fun `should replace dots with underscores`() { - val resource = createSdsDummyResource( - "file.with.dots", - SdsFileExtension.Pipeline, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "file_with_dots" - } - - @Test - fun `should replace dashes with underscores`() { - val resource = createSdsDummyResource( - "file-with-dashes", - SdsFileExtension.Pipeline, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "file_with_dashes" - } - - @Test - fun `should remove 'sdspipe' extension`() { - val resource = createSdsDummyResource( - "file", - SdsFileExtension.Pipeline, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "file" - } - - @Test - fun `should remove 'sdsschema' extension`() { - val resource = createSdsDummyResource( - "file", - SdsFileExtension.Schema, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "file" - } - - @Test - fun `should remove 'sdsstub' extension`() { - val resource = createSdsDummyResource( - "file", - SdsFileExtension.Stub, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "file" - } - - @Test - fun `should remove 'sdstest' extension`() { - val resource = createSdsDummyResource( - "file", - SdsFileExtension.Test, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseFileNameOrNull() shouldBe "file" - } - - @Test - fun `should not remove other extension`() { - val uri = URI.createURI("dummy:/test.other") - val resource = XtextResource(uri) - - resource.baseFileNameOrNull() shouldBe "test_other" - } - - @Test - fun `should return null if the resource has no URI`() { - val resource = XtextResource(null) - - resource.baseFileNameOrNull().shouldBeNull() - } - } - - @Nested - inner class baseGeneratedFilePath { - - @Test - fun `should return the base path for generated files if possible`() { - val resource = createSdsDummyResource( - "file", - SdsFileExtension.Test, - createSdsCompilationUnit(packageName = "test"), - ) - - resource.baseGeneratedFilePathOrNull() shouldBe "test/gen_file" - } - - @Test - fun `should return null if the resource has no compilation unit`() { - val uri = URI.createURI("dummy:/test.other") - val resource = XtextResource(uri) - - resource.baseGeneratedFilePathOrNull().shouldBeNull() - } - - @Test - fun `should return null if the compilation unit has no package`() { - val resource = createSdsDummyResource( - "file", - SdsFileExtension.Test, - SafeDSFactory.eINSTANCE.createSdsCompilationUnit(), - ) - - resource.baseGeneratedFilePathOrNull().shouldBeNull() - } - - @Test - fun `should return null if the resource has no URI`() { - val resource = XtextResource(null) - - resource.baseGeneratedFilePathOrNull() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/generator/SafeDSGeneratorTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/generator/SafeDSGeneratorTest.kt deleted file mode 100644 index 819c85cdd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/generator/SafeDSGeneratorTest.kt +++ /dev/null @@ -1,179 +0,0 @@ -package com.larsreimann.safeds.generator - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension.Pipeline -import com.larsreimann.safeds.constant.SdsFileExtension.Stub -import com.larsreimann.safeds.constant.SdsFileExtension.Test -import com.larsreimann.safeds.emf.OriginalFilePath -import com.larsreimann.safeds.emf.resourceSetOrNull -import com.larsreimann.safeds.testing.CategorizedTest -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.ResourceName -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.stringify -import com.larsreimann.safeds.testing.createDynamicTestsFromResourceFolder -import com.larsreimann.safeds.testing.getResourcePath -import com.larsreimann.safeds.testing.testDisplayName -import com.larsreimann.safeds.testing.withSystemLineBreaks -import io.kotest.assertions.forEachAsClue -import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.xtext.diagnostics.Severity -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.eclipse.xtext.testing.validation.ValidationTestHelper -import org.eclipse.xtext.validation.Issue -import org.eclipse.xtext.xbase.testing.CompilationTestHelper -import org.junit.jupiter.api.DynamicNode -import org.junit.jupiter.api.DynamicTest -import org.junit.jupiter.api.TestFactory -import org.junit.jupiter.api.extension.ExtendWith -import java.nio.file.Files -import java.nio.file.Path -import java.util.stream.Stream -import kotlin.io.path.extension -import kotlin.io.path.name -import kotlin.io.path.readText -import kotlin.streams.asSequence - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SafeDSGeneratorTest { - - @Inject - private lateinit var compilationTestHelper: CompilationTestHelper - - @Inject - private lateinit var parseHelper: ParseHelper - - @Inject - private lateinit var validationHelper: ValidationTestHelper - - @TestFactory - fun `should compile test files correctly`(): Stream { - return javaClass.classLoader - .getResourcePath("generator") - ?.createDynamicTestsFromResourceFolder(::validateTestFile, ::createTest) - ?: Stream.empty() - } - - /** - * Checks if the given program is a valid test. If there are issues a description of the issue is returned, - * otherwise this returns `null`. - */ - @Suppress("UNUSED_PARAMETER") - private fun validateTestFile(resourcePath: Path, filePath: Path, program: String): String? { - // Must be able to parse the test file - if (parseHelper.parseProgramText(program) == null) { - return "Could not parse test file." - } - - // Must not have errors - val errors = actualIssues(resourcePath, filePath, program).filter { it.severity == Severity.ERROR } - if (errors.isNotEmpty()) { - return "Program has errors:${errors.stringify()}" - } - - return null - } - - private fun actualIssues(resourcePath: Path, filePath: Path, program: String): List { - val context = context(resourcePath, filePath) - val parsingResult = parseHelper.parseProgramText(program, context) ?: return emptyList() - parsingResult.eResource().eAdapters().add(OriginalFilePath(filePath.toString())) - return validationHelper.validate(parsingResult) - } - - @Suppress("UNUSED_PARAMETER") - private fun createTest(resourcePath: Path, filePath: Path, program: String) = sequence { - yield( - CategorizedTest( - "valid test file", - DynamicTest.dynamicTest(testDisplayName(resourcePath, filePath), filePath.toUri()) { - generatorTest(resourcePath, filePath) - }, - ), - ) - } - - private fun generatorTest(resourcePath: Path, filePath: Path) { - val expectedOutputs = expectedOutputs(filePath) - val actualOutputs = actualOutputs(resourcePath, filePath) - - // File paths should match exactly - actualOutputs.map { it.filePath }.shouldContainExactlyInAnyOrder(expectedOutputs.map { it.filePath }) - - // Contents should match - actualOutputs.forEachAsClue { actualOutput -> - val expectedOutput = expectedOutputs.first { it.filePath == actualOutput.filePath } - actualOutput.content.withSystemLineBreaks() shouldBe expectedOutput.content.withSystemLineBreaks() - } - } - - private data class OutputFile(val filePath: String, val content: String) - - private fun context(resourcePath: Path, filePath: Path): List { - val root = filePath.parent - - return Files.walk(root) - .asSequence() - .filter { it.extension in setOf(Pipeline.extension, Stub.extension, Test.extension) } - .filter { it.name.startsWith("_skip_") } - .map { resourceName(resourcePath, it) } - .toList() - } - - private fun expectedOutputs(filePath: Path): List { - val root = filePath.parent - - return Files.walk(root) - .asSequence() - .filter { it.extension == "py" } - .map { - OutputFile( - root.relativize(it).toUnixString(), - it.readText(), - ) - } - .toList() - } - - private fun actualOutputs(resourcePath: Path, filePath: Path): List { - var actualOutput: List = emptyList() - - compilationTestHelper.compile(resourceSet(resourcePath, filePath)) { result -> - actualOutput = result.allGeneratedResources.map { - OutputFile(it.key.normalizePathPrefix(), it.value.toString()) - } - } - - return actualOutput - } - - private fun resourceSet(resourcePath: Path, filePath: Path): ResourceSet { - val context = context(resourcePath, filePath) - return parseHelper - .parseResource(resourceName(resourcePath, filePath), context) - ?.resourceSetOrNull() - .shouldNotBeNull() - } - - private fun resourceName(resourcePath: Path, filePath: Path): ResourceName { - return resourcePath - .parent - .relativize(filePath) - .toUnixString() - } - - private fun Path.toUnixString(): String { - return this.toString().replace("\\", "/") - } - - private fun String.normalizePathPrefix(): String { - return this - .removePrefix("/myProject/./") - .replace("src-gen", "output") - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/naming/QualifiedNameProviderTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/naming/QualifiedNameProviderTest.kt deleted file mode 100644 index 8ff4c40b9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/naming/QualifiedNameProviderTest.kt +++ /dev/null @@ -1,51 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.naming - -import com.larsreimann.safeds.emf.createSdsClass -import com.larsreimann.safeds.emf.createSdsCompilationUnit -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import io.kotest.matchers.shouldBe -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class QualifiedNameProviderTest { - - @Nested - inner class QualifiedNameOrNull { - - @Test - fun `should handle declarations with simple names`() { - val myClass = createSdsClass(name = "MyClass") - createSdsCompilationUnit(packageName = "tests", members = listOf(myClass)) - - myClass.qualifiedNameOrNull() shouldBe "tests.MyClass".toQualifiedName() - } - - @Test - fun `should handle declarations with escaped names`() { - val myClass = createSdsClass(name = "`MyClass`") - createSdsCompilationUnit(packageName = "`tests`", members = listOf(myClass)) - - myClass.qualifiedNameOrNull() shouldBe "`tests`.`MyClass`".toQualifiedName() - } - } - - @Nested - inner class toQualifiedName { - - @Test - fun `should convert string to qualified name`() { - val qualifiedName = "tests.MyClass".toQualifiedName() - - qualifiedName.segmentCount shouldBe 2 - qualifiedName.getSegment(0) shouldBe "tests" - qualifiedName.getSegment(1) shouldBe "MyClass" - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/scoping/ScopingTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/scoping/ScopingTest.kt deleted file mode 100644 index 5633ce027..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/scoping/ScopingTest.kt +++ /dev/null @@ -1,2486 +0,0 @@ -package com.larsreimann.safeds.scoping - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.annotationCallsOrEmpty -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsMemberType -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsPredicate -import com.larsreimann.safeds.safeDS.SdsProtocolReference -import com.larsreimann.safeds.safeDS.SdsProtocolSubterm -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.safeDS.SdsTypeParameterConstraint -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.ResourceName -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import com.larsreimann.safeds.testing.assertions.shouldBeResolved -import com.larsreimann.safeds.testing.assertions.shouldNotBeResolved -import io.kotest.assertions.forEachAsClue -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -private const val ANNOTATION_CALL = "annotationCall" -private const val ARGUMENT = "argument" -private const val IMPORT_WITH_ALIAS = "importWithAlias" -private const val NAMED_TYPE = "namedType" -private const val PROTOCOL_REFERENCE = "protocolReference" -private const val REFERENCE = "reference" -private const val GOAL_REFERENCE = "goalReference" -private const val TYPE_ARGUMENT = "typeArgument" -private const val TYPE_PARAMETER_CONSTRAINT = "typeParameterConstraint" -private const val YIELD = "yield" - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class ScopingTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Nested - inner class AnnotationCall { - - @Test - fun `should resolve annotations in same file`() = withResource(ANNOTATION_CALL) { - val annotationCalls = this.descendants().toList() - annotationCalls.shouldHaveSize(6) - - val annotationInSameFile = findUniqueDeclarationOrFail("AnnotationInSameFile") - - val referencedAnnotation = annotationCalls[0].annotation - referencedAnnotation.shouldBeResolved() - referencedAnnotation.shouldBe(annotationInSameFile) - } - - @Test - fun `should resolve annotations in same package`() = withResource(ANNOTATION_CALL) { - val annotationCalls = this.descendants().toList() - annotationCalls.shouldHaveSize(6) - - val annotation = annotationCalls[1].annotation - annotation.shouldBeResolved() - annotation.name.shouldBe("AnnotationInSamePackage") - } - - @Test - fun `should resolve annotations in another package if imported`() = withResource(ANNOTATION_CALL) { - val annotationCalls = this.descendants().toList() - annotationCalls.shouldHaveSize(6) - - val annotation = annotationCalls[2].annotation - annotation.shouldBeResolved() - annotation.name.shouldBe("AnnotationInOtherPackage1") - } - - @Test - fun `should not resolve annotations in another package if not imported`() = withResource(ANNOTATION_CALL) { - val annotationCalls = this.descendants().toList() - annotationCalls.shouldHaveSize(6) - annotationCalls[3].annotation.shouldNotBeResolved() - } - - @Test - fun `should not resolve unknown declaration`() = withResource(ANNOTATION_CALL) { - val annotationCalls = this.descendants().toList() - annotationCalls.shouldHaveSize(6) - annotationCalls[4].annotation.shouldNotBeResolved() - } - - @Test - fun `should not resolve something that is not an annotation`() = withResource(ANNOTATION_CALL) { - val annotationCalls = this.descendants().toList() - annotationCalls.shouldHaveSize(6) - annotationCalls[5].annotation.shouldNotBeResolved() - } - } - - @Nested - inner class Argument { - - @Test - fun `should resolve parameter in use annotation in same file`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInAnnotationInSameFile = - findUniqueDeclarationOrFail("parameterInAnnotationInSameFile") - - val referencedParameter = arguments[0].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInAnnotationInSameFile) - } - - @Test - fun `should resolve parameter in called block lambda in same step`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInLambdaInSameStep = - findUniqueDeclarationOrFail("parameterInBlockLambdaInSameStep") - - val referencedParameter = arguments[1].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInLambdaInSameStep) - } - - @Test - fun `should resolve parameter in called callable in same step`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInCallableInSameStep = - findUniqueDeclarationOrFail("parameterInCallableInSameStep") - - val referencedParameter = arguments[2].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInCallableInSameStep) - } - - @Test - fun `should resolve parameter in called class in same file`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInClassInSameFile = findUniqueDeclarationOrFail("parameterInClassInSameFile") - - val referencedParameter = arguments[3].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInClassInSameFile) - } - - @Test - fun `should resolve parameter in called enum variant in same file`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInEnumVariantInSameFile = - findUniqueDeclarationOrFail("parameterInEnumVariantInSameFile") - - val referencedParameter = arguments[4].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInEnumVariantInSameFile) - } - - @Test - fun `should resolve parameter in called expression lambda in same step`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInLambdaInSameStep = - findUniqueDeclarationOrFail("parameterInExpressionLambdaInSameStep") - - val referencedParameter = arguments[5].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInLambdaInSameStep) - } - - @Test - fun `should resolve parameter in called function in same file`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInFunctionSameFile = - findUniqueDeclarationOrFail("parameterInFunctionSameFile") - - val referencedParameter = arguments[6].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInFunctionSameFile) - } - - @Test - fun `should resolve parameter in called step in same file`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val parameterInStepInSameFile = findUniqueDeclarationOrFail("parameterInStepInSameFile") - - val referencedParameter = arguments[7].parameter - referencedParameter.shouldBeResolved() - referencedParameter.shouldBe(parameterInStepInSameFile) - } - - @Test - fun `should resolve parameter in called function in same package`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val referencedParameter = arguments[8].parameter - referencedParameter.shouldBeResolved() - referencedParameter.name.shouldBe("parameterInSamePackage") - } - - @Test - fun `should resolve parameter in called function that is imported and in another package`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - - val referencedParameter = arguments[9].parameter - referencedParameter.shouldBeResolved() - referencedParameter.name.shouldBe("parameterInOtherPackage1") - } - - @Test - fun `should not resolve parameter in called function that is not imported and in another package`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - arguments[10].parameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve parameter in function other than called one in same package`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - arguments[11].parameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve parameter in function other than called one that is imported and in another package`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - arguments[12].parameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve parameter in function other than called one that is not imported and in another package`() = - withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - arguments[13].parameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve unknown declaration`() = withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - arguments[14].parameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve something that is not a parameter`() = withResource(ARGUMENT) { - val arguments = this.descendants().toList() - arguments.shouldHaveSize(16) - arguments[15].parameter.shouldNotBeResolved() - } - } - - @Nested - inner class ImportWithAlias { - - @Test - fun `should resolve alias name of declaration in same file`() = withResource(IMPORT_WITH_ALIAS) { - val aliasNameInSameFile = findUniqueDeclarationOrFail("aliasNameInSameFile") - val classInSameFile = findUniqueDeclarationOrFail("ClassInSameFile") - - val type = aliasNameInSameFile.type - type.shouldBeInstanceOf() - - val declaration = type.declaration - declaration.shouldBeResolved() - declaration.shouldBe(classInSameFile) - } - - @Test - fun `should resolve original name of declaration in same file`() = withResource(IMPORT_WITH_ALIAS) { - val originalNameInSameFile = findUniqueDeclarationOrFail("originalNameInSameFile") - - val type = originalNameInSameFile.type - type.shouldBeInstanceOf() - - val declaration = type.declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("ClassInSameFile") - } - - @Test - fun `should resolve alias name of declaration in same package`() = withResource(IMPORT_WITH_ALIAS) { - val aliasNameInSamePackage = findUniqueDeclarationOrFail("aliasNameInSamePackage") - - val type = aliasNameInSamePackage.type - type.shouldBeInstanceOf() - - val declaration = type.declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("ClassInSamePackage") - } - - @Test - fun `should resolve original name of declaration in same package`() = withResource(IMPORT_WITH_ALIAS) { - val originalNameInSamePackage = findUniqueDeclarationOrFail("originalNameInSamePackage") - - val type = originalNameInSamePackage.type - type.shouldBeInstanceOf() - - val declaration = type.declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("ClassInSamePackage") - } - - @Test - fun `should resolve alias name of declaration in other package`() = withResource(IMPORT_WITH_ALIAS) { - val aliasNameInOtherPackage = findUniqueDeclarationOrFail("aliasNameInOtherPackage") - - val type = aliasNameInOtherPackage.type - type.shouldBeInstanceOf() - - val declaration = type.declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("ClassInOtherPackage") - } - - @Test - fun `should not resolve original name of declaration in other package`() = withResource(IMPORT_WITH_ALIAS) { - val originalNameInOtherPackage = findUniqueDeclarationOrFail("originalNameInOtherPackage") - - val type = originalNameInOtherPackage.type - type.shouldBeInstanceOf() - type.declaration.shouldNotBeResolved() - } - } - - @Nested - inner class NamedType { - - @Test - fun `should resolve class in same file`() = withResource(NAMED_TYPE) { - val paramClassInSameFile = findUniqueDeclarationOrFail("paramClassInSameFile") - val classInSameFile = findUniqueDeclarationOrFail("ClassInSameFile") - - val parameterType = paramClassInSameFile.type - parameterType.shouldBeInstanceOf() - - val referencedClass = parameterType.declaration - referencedClass.shouldBeResolved() - referencedClass.shouldBe(classInSameFile) - } - - @Test - fun `should resolve enum in same file`() = withResource(NAMED_TYPE) { - val paramEnumInSameFile = findUniqueDeclarationOrFail("paramEnumInSameFile") - val enumInSameFile = findUniqueDeclarationOrFail("EnumInSameFile") - - val parameterType = paramEnumInSameFile.type - parameterType.shouldBeInstanceOf() - - val referencedEnum = parameterType.declaration - referencedEnum.shouldBeResolved() - referencedEnum.shouldBe(enumInSameFile) - } - - @Test - fun `should resolve class in same package`() = withResource(NAMED_TYPE) { - val paramClassInSamePackage = findUniqueDeclarationOrFail("paramClassInSamePackage") - - val parameterType = paramClassInSamePackage.type - parameterType.shouldBeInstanceOf() - - val referencedClass = parameterType.declaration - referencedClass.shouldBeResolved() - referencedClass.name.shouldBe("ClassInSamePackage") - } - - @Test - fun `should resolve enum in same package`() = withResource(NAMED_TYPE) { - val paramEnumInSamePackage = findUniqueDeclarationOrFail("paramEnumInSamePackage") - - val parameterType = paramEnumInSamePackage.type - parameterType.shouldBeInstanceOf() - - val referencedEnum = parameterType.declaration - referencedEnum.shouldBeResolved() - referencedEnum.name.shouldBe("EnumInSamePackage") - } - - @Test - fun `should resolve class in another package if imported`() = withResource(NAMED_TYPE) { - val paramClassInOtherPackage1 = findUniqueDeclarationOrFail("paramClassInOtherPackage1") - - val parameterType = paramClassInOtherPackage1.type - parameterType.shouldBeInstanceOf() - - val referencedClass = parameterType.declaration - referencedClass.shouldBeResolved() - referencedClass.name.shouldBe("ClassInOtherPackage1") - } - - @Test - fun `should resolve enum in another package if imported`() = withResource(NAMED_TYPE) { - val paramEnumInOtherPackage1 = findUniqueDeclarationOrFail("paramEnumInOtherPackage1") - - val parameterType = paramEnumInOtherPackage1.type - parameterType.shouldBeInstanceOf() - - val referencedEnum = parameterType.declaration - referencedEnum.shouldBeResolved() - referencedEnum.name.shouldBe("EnumInOtherPackage1") - } - - @Test - fun `should not resolve class in another package if not imported`() = withResource(NAMED_TYPE) { - val paramClassInOtherPackage2 = findUniqueDeclarationOrFail("paramClassInOtherPackage2") - - val parameterType = paramClassInOtherPackage2.type - parameterType.shouldBeInstanceOf() - - val referencedClass = parameterType.declaration - referencedClass.shouldNotBeResolved() - } - - @Test - fun `should not resolve enum in another package if not imported`() = withResource(NAMED_TYPE) { - val paramEnumInOtherPackage2 = findUniqueDeclarationOrFail("paramEnumInOtherPackage2") - - val parameterType = paramEnumInOtherPackage2.type - parameterType.shouldBeInstanceOf() - - val referencedEnum = parameterType.declaration - referencedEnum.shouldNotBeResolved() - } - - @Test - fun `should resolve type parameters in same function`() = withResource(NAMED_TYPE) { - val paramTypeParameterInSameFunction = - findUniqueDeclarationOrFail("paramTypeParameterInSameFunction") - val typeParameter = findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_SAME_FUNCTION") - - val parameterType = paramTypeParameterInSameFunction.type - parameterType.shouldBeInstanceOf() - - val referencedTypeParameter = parameterType.declaration - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameter) - } - - @Test - fun `should not resolve type parameters in another declaration in same file`() = withResource(NAMED_TYPE) { - val paramTypeParameterInSameFile = findUniqueDeclarationOrFail("paramTypeParameterInSameFile") - - val parameterType = paramTypeParameterInSameFile.type - parameterType.shouldBeInstanceOf() - - val referencedInterface = parameterType.declaration - referencedInterface.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameters in another declaration in same package`() = withResource(NAMED_TYPE) { - val paramTypeParameterInSamePackage = - findUniqueDeclarationOrFail("paramTypeParameterInSamePackage") - - val parameterType = paramTypeParameterInSamePackage.type - parameterType.shouldBeInstanceOf() - - val referencedInterface = parameterType.declaration - referencedInterface.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameters in another declaration in another package`() = - withResource(NAMED_TYPE) { - val paramTypeParameterInOtherPackage = - findUniqueDeclarationOrFail("paramTypeParameterInOtherPackage") - - val parameterType = paramTypeParameterInOtherPackage.type - parameterType.shouldBeInstanceOf() - - val referencedInterface = parameterType.declaration - referencedInterface.shouldNotBeResolved() - } - - @Test - fun `should not resolve unknown declaration`() = withResource(NAMED_TYPE) { - val paramUnresolvedNamedTypeDeclaration = - findUniqueDeclarationOrFail("paramUnresolvedNamedTypeDeclaration") - - val parameterType = paramUnresolvedNamedTypeDeclaration.type - parameterType.shouldBeInstanceOf() - - val referencedInterface = parameterType.declaration - referencedInterface.shouldNotBeResolved() - } - - @Test - fun `should not resolve something that is not a named type declaration`() = withResource(NAMED_TYPE) { - val paramNotANamedTypeDeclaration = - findUniqueDeclarationOrFail("paramNotANamedTypeDeclaration") - - val parameterType = paramNotANamedTypeDeclaration.type - parameterType.shouldBeInstanceOf() - - val referencedInterface = parameterType.declaration - referencedInterface.shouldNotBeResolved() - } - - @Test - fun `should resolve type parameters in containing class from attribute`() = withResource(NAMED_TYPE) { - val attributeInClassWithTypeParameter = - findUniqueDeclarationOrFail("attributeInClassWithTypeParameter") - val typeParameter = findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_OUTER_CLASS") - - val attributeType = attributeInClassWithTypeParameter.type - attributeType.shouldBeInstanceOf() - - val referencedTypeParameter = attributeType.declaration - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameter) - } - - @Test - fun `should resolve type parameters in containing class from nested class`() = withResource(NAMED_TYPE) { - val paramClassInClassWithTypeParameter = - findUniqueDeclarationOrFail("paramClassInClassWithTypeParameter") - val typeParameter = findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_OUTER_CLASS") - - val parameterType = paramClassInClassWithTypeParameter.type - parameterType.shouldBeInstanceOf() - - val referencedTypeParameter = parameterType.declaration - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameter) - } - - @Test - fun `should resolve type parameters in containing class from nested enum variant`() = withResource(NAMED_TYPE) { - val paramEnumInClassWithTypeParameter = - findUniqueDeclarationOrFail("paramEnumInClassWithTypeParameter") - val typeParameter = findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_OUTER_CLASS") - - val parameterType = paramEnumInClassWithTypeParameter.type - parameterType.shouldBeInstanceOf() - - val referencedTypeParameter = parameterType.declaration - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameter) - } - - @Test - fun `should resolve type parameters in containing class from method`() = withResource(NAMED_TYPE) { - val paramMethodInClassWithTypeParameter = - findUniqueDeclarationOrFail("paramMethodInClassWithTypeParameter") - val typeParameter = findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_OUTER_CLASS") - - val parameterType = paramMethodInClassWithTypeParameter.type - parameterType.shouldBeInstanceOf() - - val referencedTypeParameter = parameterType.declaration - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameter) - } - - @Nested - inner class MemberType { - @Test - fun `should resolve class within class with qualified access`() = withResource(NAMED_TYPE) { - val paramClassInClassInSameFile = - findUniqueDeclarationOrFail("paramClassInClassInSameFile") - val classInSameFile = findUniqueDeclarationOrFail("ClassInClassInSameFile") - - val parameterType = paramClassInClassInSameFile.type - parameterType.shouldBeInstanceOf() - - val referencedClass = parameterType.member.declaration - referencedClass.shouldBeResolved() - referencedClass.shouldBe(classInSameFile) - } - - @Test - fun `should resolve enum within class with qualified access`() = withResource(NAMED_TYPE) { - val paramEnumInClassInSameFile = findUniqueDeclarationOrFail("paramEnumInClassInSameFile") - val enumInSameFile = findUniqueDeclarationOrFail("EnumInClassInSameFile") - - val parameterType = paramEnumInClassInSameFile.type - parameterType.shouldBeInstanceOf() - - val referencedEnum = parameterType.member.declaration - referencedEnum.shouldBeResolved() - referencedEnum.shouldBe(enumInSameFile) - } - - @Test - fun `should resolve enum variant with qualified access`() = withResource(NAMED_TYPE) { - val paramEnumVariantInSameFile = findUniqueDeclarationOrFail("paramEnumVariantInSameFile") - val enumVariantInSameFile = findUniqueDeclarationOrFail("EnumVariantInSameFile") - - val parameterType = paramEnumVariantInSameFile.type - parameterType.shouldBeInstanceOf() - - val referencedEnumVariant = parameterType.member.declaration - referencedEnumVariant.shouldBeResolved() - referencedEnumVariant.shouldBe(enumVariantInSameFile) - } - - @Test - fun `should not resolve class within class with unqualified access`() = withResource(NAMED_TYPE) { - val paramUnqualifiedClassInClassInSameFile = - findUniqueDeclarationOrFail("paramUnqualifiedClassInClassInSameFile") - - val parameterType = paramUnqualifiedClassInClassInSameFile.type - parameterType.shouldBeInstanceOf() - parameterType.declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve enum within class with unqualified access`() = withResource(NAMED_TYPE) { - val paramUnqualifiedEnumInClassInSameFile = - findUniqueDeclarationOrFail("paramUnqualifiedEnumInClassInSameFile") - - val parameterType = paramUnqualifiedEnumInClassInSameFile.type - parameterType.shouldBeInstanceOf() - parameterType.declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve enum variant with unqualified access`() = withResource(NAMED_TYPE) { - val paramUnqualifiedEnumVariantInSameFile = - findUniqueDeclarationOrFail("paramUnqualifiedEnumVariantInSameFile") - - val parameterType = paramUnqualifiedEnumVariantInSameFile.type - parameterType.shouldBeInstanceOf() - parameterType.declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve inherited class within class with qualified access`() = withResource(NAMED_TYPE) { - val paramClassInSuperClass = findUniqueDeclarationOrFail("paramClassInSuperClass") - val classInSameFile = findUniqueDeclarationOrFail("ClassInSuperClass") - - val parameterType = paramClassInSuperClass.type - parameterType.shouldBeInstanceOf() - - val referencedClass = parameterType.member.declaration - referencedClass.shouldBeResolved() - referencedClass.shouldBe(classInSameFile) - } - - @Test - fun `should resolve inherited enum within class with qualified access`() = withResource(NAMED_TYPE) { - val paramEnumInSuperClass = findUniqueDeclarationOrFail("paramEnumInSuperClass") - val enumInSameFile = findUniqueDeclarationOrFail("EnumInSuperClass") - - val parameterType = paramEnumInSuperClass.type - parameterType.shouldBeInstanceOf() - - val referencedEnum = parameterType.member.declaration - referencedEnum.shouldBeResolved() - referencedEnum.shouldBe(enumInSameFile) - } - } - } - - @Nested - inner class ProtocolReference { - - @Test - fun `should resolve static attribute in super class`() = withResource(PROTOCOL_REFERENCE) { - val superClassStaticAttributeReference = - findUniqueDeclarationOrFail("superClassStaticAttributeReference") - - val superClassStaticAttribute = findUniqueDeclarationOrFail("superClassStaticAttribute") - - val term = superClassStaticAttributeReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe superClassStaticAttribute - } - - @Test - fun `should resolve instance attribute in super class`() = withResource(PROTOCOL_REFERENCE) { - val superClassInstanceAttributeReference = - findUniqueDeclarationOrFail("superClassInstanceAttributeReference") - - val superClassInstanceAttribute = findUniqueDeclarationOrFail("superClassInstanceAttribute") - - val term = superClassInstanceAttributeReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe superClassInstanceAttribute - } - - @Test - fun `should resolve static method in super class`() = withResource(PROTOCOL_REFERENCE) { - val superClassStaticMethodReference = - findUniqueDeclarationOrFail("superClassStaticMethodReference") - - val superClassStaticMethod = findUniqueDeclarationOrFail("superClassStaticMethod") - - val term = superClassStaticMethodReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe superClassStaticMethod - } - - @Test - fun `should resolve instance method in super class`() = withResource(PROTOCOL_REFERENCE) { - val superClassInstanceMethodReference = - findUniqueDeclarationOrFail("superClassInstanceMethodReference") - - val superClassInstanceMethod = findUniqueDeclarationOrFail("superClassInstanceMethod") - - val term = superClassInstanceMethodReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe superClassInstanceMethod - } - - @Test - fun `should not resolve static attribute in container class`() = withResource(PROTOCOL_REFERENCE) { - val containerClassStaticAttributeReference = - findUniqueDeclarationOrFail("containerClassStaticAttributeReference") - - val term = containerClassStaticAttributeReference.term - term.shouldBeInstanceOf() - term.token.shouldNotBeResolved() - } - - @Test - fun `should not resolve instance attribute in container class`() = withResource(PROTOCOL_REFERENCE) { - val containerClassInstanceAttributeReference = - findUniqueDeclarationOrFail("containerClassInstanceAttributeReference") - - val term = containerClassInstanceAttributeReference.term - term.shouldBeInstanceOf() - term.token.shouldNotBeResolved() - } - - @Test - fun `should not resolve static method in container class`() = withResource(PROTOCOL_REFERENCE) { - val containerClassStaticMethodReference = - findUniqueDeclarationOrFail("containerClassStaticMethodReference") - - val term = containerClassStaticMethodReference.term - term.shouldBeInstanceOf() - term.token.shouldNotBeResolved() - } - - @Test - fun `should not resolve instance method in container class`() = withResource(PROTOCOL_REFERENCE) { - val containerClassInstanceMethodReference = - findUniqueDeclarationOrFail("containerClassInstanceMethodReference") - - val term = containerClassInstanceMethodReference.term - term.shouldBeInstanceOf() - term.token.shouldNotBeResolved() - } - - @Test - fun `should resolve static attribute in own class`() = withResource(PROTOCOL_REFERENCE) { - val subClassStaticAttributeReference = - findUniqueDeclarationOrFail("subClassStaticAttributeReference") - - val subClassStaticAttribute = findUniqueDeclarationOrFail("subClassStaticAttribute") - - val term = subClassStaticAttributeReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe subClassStaticAttribute - } - - @Test - fun `should resolve instance attribute in own class`() = withResource(PROTOCOL_REFERENCE) { - val subClassInstanceAttributeReference = - findUniqueDeclarationOrFail("subClassInstanceAttributeReference") - - val subClassInstanceAttribute = findUniqueDeclarationOrFail("subClassInstanceAttribute") - - val term = subClassInstanceAttributeReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe subClassInstanceAttribute - } - - @Test - fun `should resolve static method in own class`() = withResource(PROTOCOL_REFERENCE) { - val subClassStaticMethodReference = - findUniqueDeclarationOrFail("subClassStaticMethodReference") - - val subClassStaticMethod = findUniqueDeclarationOrFail("subClassStaticMethod") - - val term = subClassStaticMethodReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe subClassStaticMethod - } - - @Test - fun `should resolve instance method in own class`() = withResource(PROTOCOL_REFERENCE) { - val subClassInstanceMethodReference = - findUniqueDeclarationOrFail("subClassInstanceMethodReference") - - val subClassInstanceMethod = findUniqueDeclarationOrFail("subClassInstanceMethod") - - val term = subClassInstanceMethodReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe subClassInstanceMethod - } - - @Test - fun `should resolve overriding declaration`() = withResource(PROTOCOL_REFERENCE) { - val overriddenReference = findUniqueDeclarationOrFail("overriddenReference") - - val subClass = findUniqueDeclarationOrFail("SubClass") - val overridden = subClass.findUniqueDeclarationOrFail("overridden") - - val term = overriddenReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe overridden - } - - @Test - fun `should resolve other subterms`() = withResource(PROTOCOL_REFERENCE) { - val subtermReference = findUniqueDeclarationOrFail("subtermReference") - val forwardReference = findUniqueDeclarationOrFail("forwardReference") - - val term = subtermReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe forwardReference - } - - @Test - fun `should resolve shadowing subterm`() = withResource(PROTOCOL_REFERENCE) { - val shadowedReference = findUniqueDeclarationOrFail("shadowedReference") - val shadowed = findUniqueDeclarationOrFail("shadowed") - - val term = shadowedReference.term - term.shouldBeInstanceOf() - term.token.shouldBeResolved() - term.token shouldBe shadowed - } - - @Test - fun `should not resolve forward reference to subterm`() = withResource(PROTOCOL_REFERENCE) { - val forwardReference = findUniqueDeclarationOrFail("forwardReference") - - val term = forwardReference.term - term.shouldBeInstanceOf() - term.token.shouldNotBeResolved() - } - - @Test - fun `should not resolve unknown declaration`() = withResource(PROTOCOL_REFERENCE) { - val unresolvedReference = findUniqueDeclarationOrFail("unresolvedReference") - - val term = unresolvedReference.term - term.shouldBeInstanceOf() - term.token.shouldNotBeResolved() - } - - @Test - fun `should not resolve something that is not a protocol token`() = withResource(PROTOCOL_REFERENCE) { - val notAProtocolTokenReference = - findUniqueDeclarationOrFail("notAProtocolTokenReference") - - val term = notAProtocolTokenReference.term - term.shouldBeInstanceOf() - term.token.shouldNotBeResolved() - } - } - - @Nested - inner class Reference { - - @Test - fun `should not resolve annotation in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToAnnotations") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[0].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve annotation in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToAnnotations") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[1].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve annotation in another package if imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToAnnotations") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[2].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve annotation in another package if not imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToAnnotations") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[3].declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve class in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToClasses") - val classInSameFile = findUniqueDeclarationOrFail("ClassInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(classInSameFile) - } - - @Test - fun `should resolve class in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToClasses") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("ClassInSamePackage") - } - - @Test - fun `should resolve class in another package if imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToClasses") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("ClassInOtherPackage1") - } - - @Test - fun `should not resolve class in another package if not imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToClasses") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[3].declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve enum in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToEnums") - val enumInSameFile = findUniqueDeclarationOrFail("EnumInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumInSameFile) - } - - @Test - fun `should resolve enum in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToEnums") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("EnumInSamePackage") - } - - @Test - fun `should resolve enum in another package if imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToEnums") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("EnumInOtherPackage1") - } - - @Test - fun `should not resolve enum in another package if not imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToEnums") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[3].declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve global function in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToGlobalFunctions") - val globalFunctionInSameFile = findUniqueDeclarationOrFail("globalFunctionInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(globalFunctionInSameFile) - } - - @Test - fun `should resolve global function in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToGlobalFunctions") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("globalFunctionInSamePackage") - } - - @Test - fun `should resolve global function in another package if imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToGlobalFunctions") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("globalFunctionInOtherPackage1") - } - - @Test - fun `should not resolve global function in another package if not imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToGlobalFunctions") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[3].declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve goal in same file`() = withResource(GOAL_REFERENCE) { - val predicate = findUniqueDeclarationOrFail("directReferencesToPredicates") - val predicateInSameFile = findUniqueDeclarationOrFail("predicateInSameFile") - - val references = predicate.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(predicateInSameFile) - } - - @Test - fun `should resolve goal in same package`() = withResource(GOAL_REFERENCE) { - val predicate = findUniqueDeclarationOrFail("directReferencesToPredicates") - - val references = predicate.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("predicateInSamePackage") - } - - @Test - fun `should resolve goal in another package if imported`() = withResource(GOAL_REFERENCE) { - val predicate = findUniqueDeclarationOrFail("directReferencesToPredicates") - - val references = predicate.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("predicateInOtherPackage1") - } - - @Test - fun `should not resolve goal in another package if not imported`() = withResource(GOAL_REFERENCE) { - val predicate = findUniqueDeclarationOrFail("directReferencesToPredicates") - - val references = predicate.descendants().toList() - references.shouldHaveSize(4) - references[3].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve lambda result`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToLambdaResults") - - val reference = step.descendants().firstOrNull() - reference.shouldNotBeNull() - reference.declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve parameter of step in same step`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToParameters") - val parameterInStep = step.findUniqueDeclarationOrFail("parameterInStep") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameterInStep) - } - - @Test - fun `should resolve parameter of step in block lambda in same step`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToParameters") - val parameterInStep = step.findUniqueDeclarationOrFail("parameterInStep") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameterInStep) - } - - @Test - fun `should resolve parameter of block lambda in same block lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToParameters") - val parameterInLambda = step.findUniqueDeclarationOrFail("parameterInBlockLambda") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameterInLambda) - } - - @Test - fun `should resolve parameter of step in block lambda within block lambda in same step`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToParameters") - val parameterInStep = step.findUniqueDeclarationOrFail("parameterInStep") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameterInStep) - } - - @Test - fun `should resolve parameter of block lambda in nested block lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToParameters") - val parameterInLambda = step.findUniqueDeclarationOrFail("parameterInBlockLambda") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[4].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameterInLambda) - } - - @Test - fun `should resolve parameter of expression lambda in same expression lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToParameters") - val parameterInLambda = step.findUniqueDeclarationOrFail("parameterInExpressionLambda") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameterInLambda) - } - - @Test - fun `should resolve placeholder of step in same step`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPlaceholders") - val placeholderInStep = step.findUniqueDeclarationOrFail("placeholderInStep") - - val references = step.descendants().toList() - references.shouldHaveSize(5) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(placeholderInStep) - } - - @Test - fun `should resolve placeholder of step in lambda in same step`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPlaceholders") - val placeholderInStep = step.findUniqueDeclarationOrFail("placeholderInStep") - - val references = step.descendants().toList() - references.shouldHaveSize(5) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(placeholderInStep) - } - - @Test - fun `should resolve placeholder of lambda in same lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPlaceholders") - val placeholderInLambda = step.findUniqueDeclarationOrFail("placeholderInLambda") - - val references = step.descendants().toList() - references.shouldHaveSize(5) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.shouldBe(placeholderInLambda) - } - - @Test - fun `should resolve placeholder of step in lambda within lambda in same step`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPlaceholders") - val placeholderInStep = step.findUniqueDeclarationOrFail("placeholderInStep") - - val references = step.descendants().toList() - references.shouldHaveSize(5) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(placeholderInStep) - } - - @Test - fun `should resolve placeholder of lambda in nested lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPlaceholders") - val placeholderInLambda = step.findUniqueDeclarationOrFail("placeholderInLambda") - - val references = step.descendants().toList() - references.shouldHaveSize(5) - - val declaration = references[4].declaration - declaration.shouldBeResolved() - declaration.shouldBe(placeholderInLambda) - } - - @Test - fun `should not resolve type parameters`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToTypeParameters") - - val reference = step.descendants().firstOrNull() - reference.shouldNotBeNull() - reference.declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve step in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - val stepInSameFile = findUniqueDeclarationOrFail("stepInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(stepInSameFile) - } - - @Test - fun `should resolve step in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("stepInSamePackage") - } - - @Test - fun `should resolve step in another package if imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("stepInOtherPackage1") - } - - @Test - fun `should not resolve step in another package if not imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - references[3].declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve internal step in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - val stepInSameFile = findUniqueDeclarationOrFail("internalStepInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - - val declaration = references[4].declaration - declaration.shouldBeResolved() - declaration.shouldBe(stepInSameFile) - } - - @Test - fun `should resolve private step in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - val stepInSameFile = findUniqueDeclarationOrFail("privateStepInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(stepInSameFile) - } - - @Test - fun `should resolve internal step in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - - val declaration = references[6].declaration - declaration.shouldBeResolved() - declaration.name.shouldBe("internalStepInSamePackage") - } - - @Test - fun `should not resolve private step in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - references[7].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve internal step in another package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - references[8].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve private step in another package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToSteps") - - val references = step.descendants().toList() - references.shouldHaveSize(10) - references[9].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve pipeline in same file`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPipelines") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[0].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve pipeline in same package`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPipelines") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[1].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve pipeline in another package if imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPipelines") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[2].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve pipeline in another package if not imported`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("directReferencesToPipelines") - - val references = step.descendants().toList() - references.shouldHaveSize(4) - references[3].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve placeholder declared later in same step`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("forwardReferences") - - val references = step.descendants().toList() - references.shouldHaveSize(3) - references[0].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve placeholder declared later from nested lambda`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("forwardReferences") - - val references = step.descendants().toList() - references.shouldHaveSize(3) - references[1].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve placeholder that lambda is assigned to from body of lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("forwardReferences") - - val references = step.descendants().toList() - references.shouldHaveSize(3) - references[2].declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve declaration shadowed by parameter of step`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("shadowedReferences") - - val parameters = step.parametersOrEmpty() - parameters.shouldHaveSize(1) - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[0].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameters[0]) - } - - @Test - fun `should resolve declaration shadowed by placeholder of step`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("shadowedReferences") - - val placeholders = step.descendants().toList() - placeholders.shouldHaveSize(3) - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(placeholders[0]) - } - - @Test - fun `should resolve declaration shadowed by parameter of lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("shadowedReferences") - - val parameters = step.body.descendants().toList() - parameters.shouldHaveSize(1) - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.shouldBe(parameters[0]) - } - - @Test - fun `should resolve declaration shadowed by placeholder of lambda`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("shadowedReferences") - - val placeholders = step.descendants().toList() - placeholders.shouldHaveSize(3) - - val references = step.descendants().toList() - references.shouldHaveSize(4) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(placeholders[2]) - } - - @Test - fun `should not resolve function locals`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToFunctionLocals") - - val references = step.descendants().toList() - references.shouldHaveSize(2) - references.forEachAsClue { - it.declaration.shouldNotBeResolved() - } - } - - @Test - fun `should not resolve lambda locals`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToLambdaLocals") - - val references = step.descendants().toList() - references.shouldHaveSize(3) - references[0].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve step locals`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToStepLocals") - - val references = step.descendants().toList() - references.shouldHaveSize(3) - references.forEachAsClue { - it.declaration.shouldNotBeResolved() - } - } - - @Test - fun `should not resolve unknown declaration`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("unresolvedReferences") - - val references = step.descendants().toList() - references.shouldHaveSize(1) - references[0].declaration.shouldNotBeResolved() - } - - @Nested - inner class MemberAccess { - - @Test - fun `should resolve static class attribute accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToClassMembers") - val classStaticAttributeInSameFile = - findUniqueDeclarationOrFail("classStaticAttributeInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(classStaticAttributeInSameFile) - } - - @Test - fun `should resolve instance class attribute accessed from class instance`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToClassMembers") - val classInstanceAttributeInSameFile = - findUniqueDeclarationOrFail("classInstanceAttributeInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(classInstanceAttributeInSameFile) - } - - @Test - fun `should resolve nested class accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToClassMembers") - val classInClassInSameFile = - findUniqueDeclarationOrFail("ClassInClassInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(classInClassInSameFile) - } - - @Test - fun `should resolve nested enum accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToClassMembers") - val enumInClassInSameFile = - findUniqueDeclarationOrFail("EnumInClassInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[7].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumInClassInSameFile) - } - - @Test - fun `should resolve static class method accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToClassMembers") - val classStaticMethodInSameFile = - findUniqueDeclarationOrFail("classStaticMethodInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[9].declaration - declaration.shouldBeResolved() - declaration.shouldBe(classStaticMethodInSameFile) - } - - @Test - fun `should resolve instance class method accessed from class instance`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToClassMembers") - val classInstanceMethodInSameFile = - findUniqueDeclarationOrFail("classInstanceMethodInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[11].declaration - declaration.shouldBeResolved() - declaration.shouldBe(classInstanceMethodInSameFile) - } - - @Test - fun `should resolve enum variants`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToEnumVariants") - val enumVariantInSameFile = - findUniqueDeclarationOrFail("EnumVariantInSameFile") - - val references = step.body.descendants().toList() - references.shouldHaveSize(2) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumVariantInSameFile) - } - - @Test - fun `should resolve enum variants from step annotation`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToEnumVariants") - val enumVariantInSameFile = - findUniqueDeclarationOrFail("EnumVariantInSameFile") - - val annotations = step.annotationCallsOrEmpty() - annotations.shouldHaveSize(1) - - val references = annotations[0].descendants().toList() - references.shouldHaveSize(2) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumVariantInSameFile) - } - - @Test - fun `should resolve enum variants from parameter annotation`() = withResource(REFERENCE) { - val parameter = - findUniqueDeclarationOrFail("referenceToEnumVariantFromParameterAnnotation") - val enumVariantInSameFile = - findUniqueDeclarationOrFail("EnumVariantInSameFile") - - val annotations = parameter.annotationCallsOrEmpty() - annotations.shouldHaveSize(1) - - val references = annotations[0].descendants().toList() - references.shouldHaveSize(2) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumVariantInSameFile) - } - - @Test - fun `should resolve enum variants of nested enum from class annotation`() = withResource(REFERENCE) { - val parameter = findUniqueDeclarationOrFail("ReferencesToEnumVariantsInnerClass") - val enumVariantInSameFile = - findUniqueDeclarationOrFail("EnumVariantInSameClass") - - val annotations = parameter.annotationCallsOrEmpty() - annotations.shouldHaveSize(2) - - val references = annotations[0].descendants().toList() - references.shouldHaveSize(2) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumVariantInSameFile) - } - - @Test - fun `should resolve enum variants of global enum from class annotation`() = withResource(REFERENCE) { - val parameter = findUniqueDeclarationOrFail("ReferencesToEnumVariantsInnerClass") - val enumVariantInSameClass = - findUniqueDeclarationOrFail("EnumVariantInSameFile") - - val annotations = parameter.annotationCallsOrEmpty() - annotations.shouldHaveSize(2) - - val references = annotations[1].descendants().toList() - references.shouldHaveSize(2) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumVariantInSameClass) - } - - @Test - fun `should resolve parameters of enum variants`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToEnumVariantParameters") - val enumVariantParameterInSameFile = - findUniqueDeclarationOrFail("enumVariantParameterInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(3) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumVariantParameterInSameFile) - } - - @Test - fun `should resolve inherited static class attribute accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToInheritedClassMembers") - val superClassStaticAttribute = - findUniqueDeclarationOrFail("superClassStaticAttribute") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(superClassStaticAttribute) - } - - @Test - fun `should resolve inherited instance class attribute accessed from class instance`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToInheritedClassMembers") - val superClassInstanceAttribute = - findUniqueDeclarationOrFail("superClassInstanceAttribute") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(superClassInstanceAttribute) - } - - @Test - fun `should resolve inherited nested class accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToInheritedClassMembers") - val classInSuperClass = - findUniqueDeclarationOrFail("ClassInSuperClass") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(classInSuperClass) - } - - @Test - fun `should resolve inherited nested enum accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToInheritedClassMembers") - val enumInSuperClass = - findUniqueDeclarationOrFail("EnumInSuperClass") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[7].declaration - declaration.shouldBeResolved() - declaration.shouldBe(enumInSuperClass) - } - - @Test - fun `should resolve inherited static class method accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToInheritedClassMembers") - val superClassStaticMethod = - findUniqueDeclarationOrFail("superClassStaticMethod") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[9].declaration - declaration.shouldBeResolved() - declaration.shouldBe(superClassStaticMethod) - } - - @Test - fun `should resolve inherited instance class method accessed from class instance`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToInheritedClassMembers") - val superClassInstanceMethod = - findUniqueDeclarationOrFail("superClassInstanceMethod") - - val references = step.descendants().toList() - references.shouldHaveSize(12) - - val declaration = references[11].declaration - declaration.shouldBeResolved() - declaration.shouldBe(superClassInstanceMethod) - } - - @Test - fun `should resolve overridden instance attribute`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToOverriddenMembers") - val subClassForOverriding = findUniqueDeclarationOrFail("SubClassForOverriding") - val instanceAttributeForOverriding = - subClassForOverriding.findUniqueDeclarationOrFail("instanceAttributeForOverriding") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(instanceAttributeForOverriding) - } - - @Test - fun `should resolve overridden instance method`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToOverriddenMembers") - val subClassForOverriding = findUniqueDeclarationOrFail("SubClassForOverriding") - val instanceMethodForOverriding = - subClassForOverriding.findUniqueDeclarationOrFail("instanceMethodForOverriding") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[7].declaration - declaration.shouldBeResolved() - declaration.shouldBe(instanceMethodForOverriding) - } - - @Test - fun `should resolve hidden static attribute`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToHiddenMembers") - val subClassForHiding = findUniqueDeclarationOrFail("SubClassForHiding") - val staticAttributeForHiding = - subClassForHiding.findUniqueDeclarationOrFail("staticAttributeForHiding") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(staticAttributeForHiding) - } - - @Test - fun `should resolve hidden nested class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToHiddenMembers") - val subClassForHiding = findUniqueDeclarationOrFail("SubClassForHiding") - val nestedClassForHiding = - subClassForHiding.findUniqueDeclarationOrFail("NestedClassForHiding") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(nestedClassForHiding) - } - - @Test - fun `should resolve hidden nested enum`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToHiddenMembers") - val subClassForHiding = findUniqueDeclarationOrFail("SubClassForHiding") - val nestedEnumForHiding = - subClassForHiding.findUniqueDeclarationOrFail("NestedEnumForHiding") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(nestedEnumForHiding) - } - - @Test - fun `should resolve hidden static method`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToHiddenMembers") - val subClassForHiding = findUniqueDeclarationOrFail("SubClassForHiding") - val staticMethodForHiding = - subClassForHiding.findUniqueDeclarationOrFail("staticMethodForHiding") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[7].declaration - declaration.shouldBeResolved() - declaration.shouldBe(staticMethodForHiding) - } - - @Test - fun `should not resolve static class members accessed from instance`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToStaticClassMembersFromInstance") - val classInSameFile = findUniqueDeclarationOrFail("ClassInSameFile") - - val references = step.descendants() - .filter { it.declaration != classInSameFile } - .toList() - references.shouldHaveSize(8) - references.forEachAsClue { - it.declaration.shouldNotBeResolved() - } - } - - @Test - fun `should not resolve instance class members accessed from class`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToInstanceClassMembersFromClass") - val classInSameFile = findUniqueDeclarationOrFail("ClassInSameFile") - - val references = step.descendants() - .filter { it.declaration != classInSameFile } - .toList() - references.shouldHaveSize(4) - references.forEachAsClue { - it.declaration.shouldNotBeResolved() - } - } - - @Test - fun `should not resolve class members with unqualified access`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("unqualifiedReferencesToClassMembers") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - references.forEachAsClue { - it.declaration.shouldNotBeResolved() - } - } - - @Test - fun `should not resolve enum variants with unqualified access`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("unqualifiedReferencesToEnumVariants") - - val references = step.descendants().toList() - references.shouldHaveSize(1) - references[0].declaration.shouldNotBeResolved() - } - - @Test - fun `should not resolve parameters of enum variants with unqualified access`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("unqualifiedReferencesToEnumVariantParameters") - - val references = step.descendants().toList() - references.shouldHaveSize(1) - references[0].declaration.shouldNotBeResolved() - } - - @Test - fun `should resolve result of callable type with one result without matching member`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToCallableTypeResults") - val singleResult = step.findUniqueDeclarationOrFail("singleResult") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(singleResult) - } - - @Test - fun `should resolve attribute for callable type with one result with matching class attribute`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToCallableTypeResults") - val classForResultMemberAccess = findUniqueDeclarationOrFail("ClassForResultMemberAccess") - val result = classForResultMemberAccess.findUniqueDeclarationOrFail("result") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result) - } - - @Test - fun `should resolve result for callable type with one result with matching enum variant`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToCallableTypeResults") - val callableWithOneResultWithIdenticalEnumVariant = - step.findUniqueDeclarationOrFail("callableWithOneResultWithIdenticalEnumVariant") - val result = - callableWithOneResultWithIdenticalEnumVariant.findUniqueDeclarationOrFail("result") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result) - } - - @Test - fun `should resolve result of callable type with multiple results`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToCallableTypeResults") - val result1 = step.findUniqueDeclarationOrFail("result1") - - val references = step.descendants().toList() - references.shouldHaveSize(8) - - val declaration = references[7].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result1) - } - - @Test - fun `should resolve result of function with one result without matching member`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToFunctionResults") - val globalFunctionResultInSameFile = - findUniqueDeclarationOrFail("globalFunctionResultInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(globalFunctionResultInSameFile) - } - - @Test - fun `should resolve member for function with one result with matching member`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToFunctionResults") - val classForResultMemberAccess = findUniqueDeclarationOrFail("ClassForResultMemberAccess") - val result = classForResultMemberAccess.findUniqueDeclarationOrFail("result") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result) - } - - @Test - fun `should resolve result of function with multiple results`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToFunctionResults") - val globalFunctionWithTwoResults = - findUniqueDeclarationOrFail("globalFunctionWithTwoResults") - val result1 = globalFunctionWithTwoResults.findUniqueDeclarationOrFail("result1") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result1) - } - - @Test - fun `should resolve result of lambda with one result without matching member`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToLambdaResults") - val singleResult = step.findUniqueDeclarationOrFail("singleResult") - - val references = step.descendants().toList() - references.shouldHaveSize(7) - - val declaration = references[2].declaration - declaration.shouldBeResolved() - declaration.shouldBe(singleResult) - } - - @Test - fun `should resolve member for lambda with one result with matching member`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToLambdaResults") - val classForResultMemberAccess = findUniqueDeclarationOrFail("ClassForResultMemberAccess") - val result = classForResultMemberAccess.findUniqueDeclarationOrFail("result") - - val references = step.descendants().toList() - references.shouldHaveSize(7) - - val declaration = references[4].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result) - } - - @Test - fun `should resolve result of lambda with multiple results`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToLambdaResults") - val result1 = step.findUniqueDeclarationOrFail("result1") - - val references = step.descendants().toList() - references.shouldHaveSize(7) - - val declaration = references[6].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result1) - } - - @Test - fun `should resolve result of step with one result without matching member`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToStepResults") - val stepResultInSameFile = findUniqueDeclarationOrFail("stepResultInSameFile") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[1].declaration - declaration.shouldBeResolved() - declaration.shouldBe(stepResultInSameFile) - } - - @Test - fun `should resolve member for step with one result with matching member`() = - withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToStepResults") - val classForResultMemberAccess = findUniqueDeclarationOrFail("ClassForResultMemberAccess") - val result = classForResultMemberAccess.findUniqueDeclarationOrFail("result") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[3].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result) - } - - @Test - fun `should resolve result of step with multiple results`() = withResource(REFERENCE) { - val step = findUniqueDeclarationOrFail("referencesToStepResults") - val stepInSameFileWithTwoResults = - findUniqueDeclarationOrFail("stepWithTwoResults") - val result1 = stepInSameFileWithTwoResults.findUniqueDeclarationOrFail("result1") - - val references = step.descendants().toList() - references.shouldHaveSize(6) - - val declaration = references[5].declaration - declaration.shouldBeResolved() - declaration.shouldBe(result1) - } - } - } - - @Nested - inner class TypeArgument { - - @Test - fun `should resolve type parameter in used class in same file`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - - val typeParameterInSameFile = - findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_CLASS_IN_SAME_FILE") - - val referencedTypeParameter = typeArguments[0].typeParameter - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameterInSameFile) - } - - @Test - fun `should resolve type parameter in used enum variant in same file`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - - val typeParameterInSameFile = - findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_ENUM_VARIANT_IN_SAME_FILE") - - val referencedTypeParameter = typeArguments[1].typeParameter - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameterInSameFile) - } - - @Test - fun `should resolve type parameter in used function in same file`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - - val typeParameterInSameFile = - findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_FUNCTION_IN_SAME_FILE") - - val referencedTypeParameter = typeArguments[2].typeParameter - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameterInSameFile) - } - - @Test - fun `should resolve type parameter in used declaration in same package`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - - val referencedTypeParameter = typeArguments[3].typeParameter - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.name.shouldBe("TYPE_PARAMETER_IN_SAME_PACKAGE") - } - - @Test - fun `should resolve type parameter in used declaration that is imported and in another package`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - - val referencedTypeParameter = typeArguments[4].typeParameter - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.name.shouldBe("TYPE_PARAMETER_IN_OTHER_PACKAGE1") - } - - @Test - fun `should not resolve type parameter in used declaration that is not imported and in another package`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - typeArguments[5].typeParameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameter in declaration other than used one in same package`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - typeArguments[6].typeParameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameter in declaration other than used one that is imported and in another package`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - typeArguments[7].typeParameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameter in declaration other than used one that is not imported and in another package`() = - withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - typeArguments[8].typeParameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve unknown declaration`() = withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - typeArguments[9].typeParameter.shouldNotBeResolved() - } - - @Test - fun `should not resolve something that is not a type parameter`() = withResource(TYPE_ARGUMENT) { - val typeArguments = this.descendants().toList() - typeArguments.shouldHaveSize(11) - typeArguments[10].typeParameter.shouldNotBeResolved() - } - } - - @Nested - inner class TypeParameterConstraint { - - @Test - fun `should resolve type parameter in same class`() = withResource(TYPE_PARAMETER_CONSTRAINT) { - val testClass = findUniqueDeclarationOrFail("TestClass") - val typeParameterConstraintsGoal = testClass.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(1) - - val typeParameterInSameDeclaration = - findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_SAME_CLASS") - - val referencedTypeParameter = typeParameterConstraintsGoal[0].leftOperand - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameterInSameDeclaration) - } - - @Test - fun `should resolve type parameter in same enum variant`() = withResource(TYPE_PARAMETER_CONSTRAINT) { - val testEnumVariant = findUniqueDeclarationOrFail("TestEnumVariant") - val typeParameterConstraintsGoal = testEnumVariant.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(1) - - val typeParameterInSameDeclaration = - findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_SAME_ENUM_VARIANT") - - val referencedTypeParameter = typeParameterConstraintsGoal[0].leftOperand - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameterInSameDeclaration) - } - - @Test - fun `should resolve type parameter in same function`() = withResource(TYPE_PARAMETER_CONSTRAINT) { - val testFunction = findUniqueDeclarationOrFail("testFunction") - val typeParameterConstraintsGoal = testFunction.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(7) - - val typeParameterInSameDeclaration = - findUniqueDeclarationOrFail("TYPE_PARAMETER_IN_SAME_FUNCTION") - - val referencedTypeParameter = typeParameterConstraintsGoal[0].leftOperand - referencedTypeParameter.shouldBeResolved() - referencedTypeParameter.shouldBe(typeParameterInSameDeclaration) - } - - @Test - fun `should not resolve type parameter in another declaration in same file`() = withResource( - TYPE_PARAMETER_CONSTRAINT, - ) { - val testFunction = findUniqueDeclarationOrFail("testFunction") - val typeParameterConstraintsGoal = testFunction.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(7) - typeParameterConstraintsGoal[1].leftOperand.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameter in another declaration in same package`() = - withResource(TYPE_PARAMETER_CONSTRAINT) { - val testFunction = findUniqueDeclarationOrFail("testFunction") - val typeParameterConstraintsGoal = testFunction.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(7) - typeParameterConstraintsGoal[2].leftOperand.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameter in another declaration that is imported and in another package`() = - withResource(TYPE_PARAMETER_CONSTRAINT) { - val testFunction = findUniqueDeclarationOrFail("testFunction") - val typeParameterConstraintsGoal = testFunction.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(7) - typeParameterConstraintsGoal[3].leftOperand.shouldNotBeResolved() - } - - @Test - fun `should not resolve type parameter in another declaration that is not imported and in another package`() = - withResource(TYPE_PARAMETER_CONSTRAINT) { - val testFunction = findUniqueDeclarationOrFail("testFunction") - val typeParameterConstraintsGoal = testFunction.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(7) - typeParameterConstraintsGoal[4].leftOperand.shouldNotBeResolved() - } - - @Test - fun `should not resolve unknown declaration`() = withResource(TYPE_PARAMETER_CONSTRAINT) { - val testFunction = findUniqueDeclarationOrFail("testFunction") - val typeParameterConstraintsGoal = testFunction.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(7) - typeParameterConstraintsGoal[5].leftOperand.shouldNotBeResolved() - } - - @Test - fun `should not something that is not a type parameter`() = withResource(TYPE_PARAMETER_CONSTRAINT) { - val testFunction = findUniqueDeclarationOrFail("testFunction") - val typeParameterConstraintsGoal = testFunction.descendants().toList() - typeParameterConstraintsGoal.shouldHaveSize(7) - typeParameterConstraintsGoal[6].leftOperand.shouldNotBeResolved() - } - } - - @Nested - inner class Yield { - - @Test - fun `should resolve result in same step`() = withResource(YIELD) { - val yields = this.descendants().toList() - yields.shouldHaveSize(7) - - val resultsInSameFunction = findUniqueDeclarationOrFail("resultInSameStep") - - val referencedResult = yields[0].result - referencedResult.shouldBeResolved() - referencedResult.shouldBe(resultsInSameFunction) - } - - @Test - fun `should not resolve result in another step in same file`() = withResource(YIELD) { - val yields = this.descendants().toList() - yields.shouldHaveSize(7) - yields[1].result.shouldNotBeResolved() - } - - @Test - fun `should not resolve result in another step in same package`() = withResource(YIELD) { - val yields = this.descendants().toList() - yields.shouldHaveSize(7) - yields[2].result.shouldNotBeResolved() - } - - @Test - fun `should not resolve result in another step that is imported and in another package`() = - withResource(YIELD) { - val yields = this.descendants().toList() - yields.shouldHaveSize(7) - yields[3].result.shouldNotBeResolved() - } - - @Test - fun `should not resolve result in another step that is not imported and in another package`() = - withResource(YIELD) { - val yields = this.descendants().toList() - yields.shouldHaveSize(7) - yields[4].result.shouldNotBeResolved() - } - - @Test - fun `should not resolve unknown declaration`() = withResource(YIELD) { - val yields = this.descendants().toList() - yields.shouldHaveSize(7) - yields[5].result.shouldNotBeResolved() - } - - @Test - fun `should not something that is not a result`() = withResource(YIELD) { - val yields = this.descendants().toList() - yields.shouldHaveSize(7) - yields[6].result.shouldNotBeResolved() - } - } - - private fun withResource( - resourceName: ResourceName, - lambda: SdsCompilationUnit.() -> Unit, - ) { - val compilationUnit = - parseHelper.parseResource( - "scoping/$resourceName/main.${SdsFileExtension.Test}", - listOf( - "scoping/$resourceName/externalsInOtherPackage.${SdsFileExtension.Test}", - "scoping/$resourceName/externalsInSamePackage.${SdsFileExtension.Test}", - ), - ) ?: throw IllegalArgumentException("File is not a compilation unit.") - - compilationUnit.apply(lambda) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/serializer/SerializerExtensionsTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/serializer/SerializerExtensionsTest.kt deleted file mode 100644 index 3c45a6855..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/serializer/SerializerExtensionsTest.kt +++ /dev/null @@ -1,113 +0,0 @@ -@file:Suppress("ClassName") - -package com.larsreimann.safeds.serializer - -import com.google.inject.Inject -import com.larsreimann.safeds.emf.createSdsCompilationUnit -import com.larsreimann.safeds.safeDS.SafeDSPackage -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.string.shouldNotContain -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SerializerExtensionsTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - private val factory = SafeDSPackage.eINSTANCE.safeDSFactory - - @Nested - inner class serializeToFormattedString { - - @Test - fun `should serialize and format a complete EMF model created from a resource`() { - val compilationUnit = - parseHelper.parseResource("serialization/extensionsTest.sdstest") - compilationUnit.shouldNotBeNull() - - val result = compilationUnit.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code.shouldBe( - """ - |package tests - | - |class MyClass { - | attr myAttribute: Int - |} - """.trimMargin() - ) - } - - @Test - fun `should serialize and format a subtree of the EMF model from a resource`() { - val compilationUnit = - parseHelper.parseResource("serialization/extensionsTest.sdstest") - compilationUnit.shouldNotBeNull() - - val `class` = compilationUnit.findUniqueDeclarationOrFail("MyClass") - - val result = `class`.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code.shouldBe( - """class MyClass { - | attr myAttribute: Int - |} - """.trimMargin() - ) - } - - @Test - fun `should use line feed as line separator`() { - val compilationUnit = - parseHelper.parseResource("serialization/extensionsTest.sdstest") - compilationUnit.shouldNotBeNull() - - val `class` = compilationUnit.findUniqueDeclarationOrFail("MyClass") - - val result = `class`.serializeToFormattedString() - result.shouldBeInstanceOf() - result.code.count { it == '\n' } shouldBe 2 - - if (System.lineSeparator() != "\n") { - result.code.shouldNotContain(System.lineSeparator()) - } - } - - @Test - fun `should not serialize EObjects without Resource`() { - val compilationUnit = createSdsCompilationUnit(packageName = "test") - - val result = compilationUnit.serializeToFormattedString() - result.shouldBeInstanceOf() - } - - @Test - fun `should not serialize wrong EMF models`() { - val compilationUnit = factory.createSdsCompilationUnit().apply { - // Missing SdsAnnotationCallHolder - members += factory.createSdsClass().apply { - name = "tests" - } - } - - val dummyResource = XtextResource() - dummyResource.contents += compilationUnit - - val result = compilationUnit.serializeToFormattedString() - result.shouldBeInstanceOf() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/RecursionTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/RecursionTest.kt deleted file mode 100644 index 952949cdb..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/RecursionTest.kt +++ /dev/null @@ -1,75 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis - -import com.google.inject.Inject -import com.larsreimann.safeds.emf.annotationCallsOrEmpty -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.assertions.asClue -import io.kotest.matchers.booleans.shouldNotBeTrue -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import org.eclipse.xtext.nodemodel.util.NodeModelUtils -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.BeforeAll -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.Arguments -import org.junit.jupiter.params.provider.MethodSource - -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class RecursionTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - private lateinit var compilationUnit: SdsCompilationUnit - - @BeforeAll - fun reset() { - compilationUnit = parseHelper - .parseResource("staticAnalysis/recursion.sdstest") - .shouldNotBeNull() - } - - @ParameterizedTest(name = "isRecursive should return {1} for all calls in {0}") - @MethodSource("stepSource") - fun `should mark exactly calls that trigger recursion as recursive`( - stepName: String, - callsShouldBeRecursive: Boolean - ) { - val step = compilationUnit - .findUniqueDeclarationOrFail(stepName) - .shouldNotBeNull() - - step.descendants().toList().forEach { call -> - NodeModelUtils.getNode(call).text.trim().asClue { - call.isRecursive() shouldBe callsShouldBeRecursive - } - } - } - - private fun stepSource(): List { - return compilationUnit.descendants() - .mapNotNull { step -> - val callsShouldBeRecursive = step.annotationCallsOrEmpty().any { - it.annotation.name == "CallsShouldBeRecursive" - } - val callsShouldNotBeRecursive = step.annotationCallsOrEmpty().any { - it.annotation.name == "CallsShouldNotBeRecursive" - } - (callsShouldBeRecursive && callsShouldNotBeRecursive).shouldNotBeTrue() - - Arguments.of(step.name, callsShouldBeRecursive) - } - .toList() - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/SideEffectsTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/SideEffectsTest.kt deleted file mode 100644 index 81a3901ef..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/SideEffectsTest.kt +++ /dev/null @@ -1,75 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis - -import com.google.inject.Inject -import com.larsreimann.safeds.emf.annotationCallsOrEmpty -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.assertions.asClue -import io.kotest.matchers.booleans.shouldNotBeTrue -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import org.eclipse.xtext.nodemodel.util.NodeModelUtils -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.BeforeAll -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.Arguments -import org.junit.jupiter.params.provider.MethodSource - -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class SideEffectsTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - private lateinit var compilationUnit: SdsCompilationUnit - - @BeforeAll - fun reset() { - compilationUnit = parseHelper - .parseResource("staticAnalysis/sideEffects.sdstest") - .shouldNotBeNull() - } - - @ParameterizedTest(name = "isPureExpression should return {1} for all calls in {0}") - @MethodSource("stepSource") - fun `should mark exactly calls that trigger recursion as recursive`( - stepName: String, - callsShouldBePure: Boolean - ) { - val step = compilationUnit - .findUniqueDeclarationOrFail(stepName) - .shouldNotBeNull() - - step.descendants().toList().forEach { call -> - NodeModelUtils.getNode(call).text.trim().asClue { - call.expressionHasNoSideEffects() shouldBe callsShouldBePure - } - } - } - - private fun stepSource(): List { - return compilationUnit.descendants() - .mapNotNull { step -> - val shouldHaveNoSideEffects = step.annotationCallsOrEmpty().any { - it.annotation.name == "ShouldHaveNoSideEffects" - } - val shouldHaveSideEffects = step.annotationCallsOrEmpty().any { - it.annotation.name == "ShouldHaveSideEffects" - } - (shouldHaveNoSideEffects && shouldHaveSideEffects).shouldNotBeTrue() - - Arguments.of(step.name, shouldHaveNoSideEffects) - } - .toList() - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ArgumentToParameterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ArgumentToParameterTest.kt deleted file mode 100644 index 54e4a2f71..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ArgumentToParameterTest.kt +++ /dev/null @@ -1,188 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.linking - -import com.larsreimann.safeds.emf.createSdsAnnotation -import com.larsreimann.safeds.emf.createSdsAnnotationCall -import com.larsreimann.safeds.emf.createSdsArgument -import com.larsreimann.safeds.emf.createSdsArgumentList -import com.larsreimann.safeds.emf.createSdsCall -import com.larsreimann.safeds.emf.createSdsFunction -import com.larsreimann.safeds.emf.createSdsNull -import com.larsreimann.safeds.emf.createSdsParameter -import com.larsreimann.safeds.emf.createSdsParameterList -import com.larsreimann.safeds.emf.createSdsReference -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsAnnotationCall -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsParameter -import io.kotest.matchers.collections.shouldContainExactly -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.shouldBe -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test - -class ArgumentToParameterTest { - private lateinit var normalParameter: SdsParameter - private lateinit var variadicParameter: SdsParameter - - private lateinit var positionalArgument: SdsArgument - private lateinit var namedArgument: SdsArgument - - private lateinit var function: SdsFunction - private lateinit var call: SdsCall - - private lateinit var annotation: SdsAnnotation - private lateinit var annotationCall: SdsAnnotationCall - - @BeforeEach - fun reset() { - normalParameter = createSdsParameter(name = "normalParameter") - variadicParameter = createSdsParameter( - name = "variadicParameter", - isVariadic = true - ) - - positionalArgument = createSdsArgument( - value = createSdsNull() - ) - namedArgument = createSdsArgument( - value = createSdsNull(), - parameter = normalParameter, - ) - - function = createSdsFunction(name = "f") - call = createSdsCall( - createSdsReference(function) - ) - - annotation = createSdsAnnotation(name = "A") - annotationCall = createSdsAnnotationCall(annotation) - } - - @Nested - inner class ParameterOrNull { - - @Test - fun `should resolve argument (positional, function call, valid index)`() { - function.parameterList = createSdsParameterList(listOf(normalParameter)) - call.argumentList = createSdsArgumentList(listOf(positionalArgument)) - - positionalArgument.parameterOrNull() shouldBe normalParameter - } - - @Test - fun `should resolve argument (named, function call, valid index)`() { - function.parameterList = createSdsParameterList(listOf(normalParameter)) - call.argumentList = createSdsArgumentList(listOf(namedArgument)) - - namedArgument.parameterOrNull() shouldBe normalParameter - } - - @Test - fun `should resolve argument (positional, annotation call, valid index)`() { - annotation.parameterList = createSdsParameterList(listOf(normalParameter)) - annotationCall.argumentList = createSdsArgumentList(listOf(positionalArgument)) - - positionalArgument.parameterOrNull() shouldBe normalParameter - } - - @Test - fun `should resolve argument (named, annotation call, valid index)`() { - annotation.parameterList = createSdsParameterList(listOf(normalParameter)) - annotationCall.argumentList = createSdsArgumentList(listOf(namedArgument)) - - namedArgument.parameterOrNull() shouldBe normalParameter - } - - @Test - fun `should resolve arguments (function call, variadic)`() { - namedArgument.parameter = variadicParameter - function.parameterList = createSdsParameterList(listOf(variadicParameter)) - call.argumentList = createSdsArgumentList(listOf(positionalArgument, namedArgument)) - - namedArgument.parameterOrNull() shouldBe variadicParameter - positionalArgument.parameterOrNull() shouldBe variadicParameter - } - - @Test - fun `should resolve arguments (annotation call, variadic)`() { - namedArgument.parameter = variadicParameter - annotation.parameterList = createSdsParameterList(listOf(variadicParameter)) - annotationCall.argumentList = createSdsArgumentList(listOf(positionalArgument, namedArgument)) - - namedArgument.parameterOrNull() shouldBe variadicParameter - positionalArgument.parameterOrNull() shouldBe variadicParameter - } - - @Test - fun `should return null if named arguments precede positional arguments (function call)`() { - function.parameterList = createSdsParameterList(listOf(normalParameter)) - call.argumentList = createSdsArgumentList(listOf(namedArgument, positionalArgument)) - - positionalArgument.parameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if named arguments precede positional arguments (annotation call)`() { - annotation.parameterList = createSdsParameterList(listOf(normalParameter)) - annotationCall.argumentList = createSdsArgumentList(listOf(namedArgument, positionalArgument)) - - positionalArgument.parameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if no matching parameter exists (function call)`() { - call.argumentList = createSdsArgumentList(listOf(positionalArgument)) - - positionalArgument.parameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if no matching parameter exists (annotation call)`() { - annotationCall.argumentList = createSdsArgumentList(listOf(positionalArgument)) - - positionalArgument.parameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if argument list cannot be matched to parameter list`() { - createSdsArgumentList(listOf(positionalArgument)) - - positionalArgument.parameterOrNull().shouldBeNull() - } - - @Test - fun `should return null for positional arguments that are not in an argument list`() { - positionalArgument.parameterOrNull().shouldBeNull() - } - } - - @Nested - inner class ParametersOrNull { - - @Test - fun `should resolve argument list of function call`() { - function.parameterList = createSdsParameterList(listOf(normalParameter, variadicParameter)) - call.argumentList = createSdsArgumentList(emptyList()) - - call.argumentList.parametersOrNull().shouldContainExactly(normalParameter, variadicParameter) - } - - @Test - fun `should resolve argument list of annotation call`() { - annotation.parameterList = createSdsParameterList(listOf(normalParameter, variadicParameter)) - annotationCall.argumentList = createSdsArgumentList(emptyList()) - - annotationCall.argumentList.parametersOrNull().shouldContainExactly(normalParameter, variadicParameter) - } - - @Test - fun `should return null if the argument list cannot be resolved`() { - val argumentList = createSdsArgumentList(emptyList()) - - argumentList.parametersOrNull().shouldBeNull() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ResultToYieldTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ResultToYieldTest.kt deleted file mode 100644 index 9ebf1be85..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/ResultToYieldTest.kt +++ /dev/null @@ -1,102 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.linking - -import com.larsreimann.safeds.emf.createSdsAssignment -import com.larsreimann.safeds.emf.createSdsNull -import com.larsreimann.safeds.emf.createSdsResult -import com.larsreimann.safeds.emf.createSdsResultList -import com.larsreimann.safeds.emf.createSdsStep -import com.larsreimann.safeds.emf.createSdsWildcard -import com.larsreimann.safeds.emf.createSdsYield -import com.larsreimann.safeds.safeDS.SdsAssignment -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsYield -import io.kotest.matchers.collections.shouldBeEmpty -import io.kotest.matchers.collections.shouldContainExactly -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.shouldBe -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test - -class ResultToYieldTest { - private lateinit var firstResult: SdsResult - private lateinit var secondResult: SdsResult - - private lateinit var yieldOfFirstResult1: SdsYield - private lateinit var yieldOfFirstResult2: SdsYield - private lateinit var yieldOfSecondResult: SdsYield - - private lateinit var assignment: SdsAssignment - private lateinit var step: SdsStep - - @BeforeEach - fun reset() { - firstResult = createSdsResult(name = "firstResult") - secondResult = createSdsResult(name = "secondResult") - - yieldOfFirstResult1 = createSdsYield(firstResult) - yieldOfFirstResult2 = createSdsYield(firstResult) - yieldOfSecondResult = createSdsYield(secondResult) - - assignment = createSdsAssignment( - assignees = listOf(createSdsWildcard()), - expression = createSdsNull() - ) - step = createSdsStep( - name = "s", - statements = listOf(assignment) - ) - } - - @Nested - inner class UniqueYieldOrNull { - - @Test - fun `should return the unique corresponding yield`() { - step.resultList = createSdsResultList(listOf(firstResult)) - assignment.assigneeList.assignees += yieldOfFirstResult1 - - firstResult.uniqueYieldOrNull() shouldBe yieldOfFirstResult1 - } - - @Test - fun `should return null if no corresponding yields exist`() { - step.resultList = createSdsResultList(listOf(firstResult)) - - firstResult.uniqueYieldOrNull().shouldBeNull() - } - - @Test - fun `should return null if multiple corresponding yields exist`() { - step.resultList = createSdsResultList(listOf(firstResult)) - assignment.assigneeList.assignees += listOf(yieldOfFirstResult1, yieldOfFirstResult2) - - firstResult.uniqueYieldOrNull().shouldBeNull() - } - } - - @Nested - inner class YieldsOrEmpty { - - @Test - fun `should return all corresponding yields in the body of the step`() { - step.resultList = createSdsResultList(listOf(firstResult, secondResult)) - assignment.assigneeList.assignees += listOf(yieldOfFirstResult1, yieldOfFirstResult2, yieldOfSecondResult) - - firstResult.yieldsOrEmpty().shouldContainExactly(yieldOfFirstResult1, yieldOfFirstResult2) - } - - @Test - fun `should return an empty list if the result is not in a result list`() { - firstResult.yieldsOrEmpty().shouldBeEmpty() - } - - @Test - fun `should return an empty list if the result is not in a step`() { - createSdsResultList(listOf(firstResult)) - - firstResult.yieldsOrEmpty().shouldBeEmpty() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/TypeArgumentToTypeParameterTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/TypeArgumentToTypeParameterTest.kt deleted file mode 100644 index 7317ceeb2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/linking/TypeArgumentToTypeParameterTest.kt +++ /dev/null @@ -1,165 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.linking - -import com.larsreimann.safeds.emf.createSdsCall -import com.larsreimann.safeds.emf.createSdsClass -import com.larsreimann.safeds.emf.createSdsFunction -import com.larsreimann.safeds.emf.createSdsNamedType -import com.larsreimann.safeds.emf.createSdsReference -import com.larsreimann.safeds.emf.createSdsStarProjection -import com.larsreimann.safeds.emf.createSdsTypeArgument -import com.larsreimann.safeds.emf.createSdsTypeArgumentList -import com.larsreimann.safeds.emf.createSdsTypeParameter -import com.larsreimann.safeds.emf.createSdsTypeParameterList -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsTypeArgument -import com.larsreimann.safeds.safeDS.SdsTypeParameter -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import io.kotest.matchers.collections.shouldContainExactly -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.shouldBe -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test - -@OptIn(ExperimentalSdsApi::class) -class TypeArgumentToTypeParameterTest { - private lateinit var typeParameter: SdsTypeParameter - - private lateinit var positionalTypeArgument: SdsTypeArgument - private lateinit var namedTypeArgument: SdsTypeArgument - - private lateinit var function: SdsFunction - private lateinit var call: SdsCall - - private lateinit var `class`: SdsClass - private lateinit var namedType: SdsNamedType - - @BeforeEach - fun reset() { - typeParameter = createSdsTypeParameter(name = "T") - - positionalTypeArgument = createSdsTypeArgument( - value = createSdsStarProjection(), - ) - namedTypeArgument = createSdsTypeArgument( - value = createSdsStarProjection(), - typeParameter = typeParameter, - ) - - function = createSdsFunction(name = "f") - call = createSdsCall( - createSdsReference(function), - ) - - `class` = createSdsClass(name = "C") - namedType = createSdsNamedType(`class`) - } - - @Nested - inner class TypeParameterOrNull { - - @Test - fun `should resolve type argument (positional, call, valid index)`() { - function.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - call.typeArgumentList = createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - positionalTypeArgument.typeParameterOrNull() shouldBe typeParameter - } - - @Test - fun `should resolve type argument (named, call, valid index)`() { - function.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - call.typeArgumentList = createSdsTypeArgumentList(listOf(namedTypeArgument)) - - namedTypeArgument.typeParameterOrNull() shouldBe typeParameter - } - - @Test - fun `should resolve argument (positional, named type, valid index)`() { - `class`.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - namedType.typeArgumentList = createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - positionalTypeArgument.typeParameterOrNull() shouldBe typeParameter - } - - @Test - fun `should resolve argument (named, named type, valid index)`() { - `class`.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - namedType.typeArgumentList = createSdsTypeArgumentList(listOf(namedTypeArgument)) - - namedTypeArgument.typeParameterOrNull() shouldBe typeParameter - } - - @Test - fun `should return null if named type arguments precede positional type argument (call)`() { - function.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - call.typeArgumentList = createSdsTypeArgumentList(listOf(namedTypeArgument, positionalTypeArgument)) - - positionalTypeArgument.typeParameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if named type arguments precede positional type argument (named type)`() { - `class`.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - namedType.typeArgumentList = createSdsTypeArgumentList(listOf(namedTypeArgument, positionalTypeArgument)) - - positionalTypeArgument.typeParameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if no matching type parameter exists (call)`() { - call.typeArgumentList = createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - positionalTypeArgument.typeParameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if no matching type parameter exists (named type)`() { - namedType.typeArgumentList = createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - positionalTypeArgument.typeParameterOrNull().shouldBeNull() - } - - @Test - fun `should return null if type argument list cannot be matched to type parameter list`() { - createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - positionalTypeArgument.typeParameterOrNull().shouldBeNull() - } - - @Test - fun `should return null for positional type arguments that are not in a type argument list`() { - positionalTypeArgument.typeParameterOrNull().shouldBeNull() - } - } - - @Nested - inner class TypeParametersOrNull { - - @Test - fun `should resolve type argument list of call`() { - function.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - call.typeArgumentList = createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - call.typeArgumentList.typeParametersOrNull().shouldContainExactly(typeParameter) - } - - @Test - fun `should resolve type argument list of annotation call`() { - `class`.typeParameterList = createSdsTypeParameterList(listOf(typeParameter)) - namedType.typeArgumentList = createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - namedType.typeArgumentList.typeParametersOrNull().shouldContainExactly(typeParameter) - } - - @Test - fun `should return null if the type argument list cannot be resolved`() { - val typeArgumentList = createSdsTypeArgumentList(listOf(positionalTypeArgument)) - - typeArgumentList.typeParametersOrNull().shouldBeNull() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/ToConstantExpressionTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/ToConstantExpressionTest.kt deleted file mode 100644 index cb3ee1ca9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/partialEvaluation/ToConstantExpressionTest.kt +++ /dev/null @@ -1,1506 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.partialEvaluation - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsInfixOperationOperator -import com.larsreimann.safeds.constant.SdsPrefixOperationOperator -import com.larsreimann.safeds.emf.createSdsAnnotation -import com.larsreimann.safeds.emf.createSdsArgument -import com.larsreimann.safeds.emf.createSdsAssignment -import com.larsreimann.safeds.emf.createSdsAttribute -import com.larsreimann.safeds.emf.createSdsBlockLambda -import com.larsreimann.safeds.emf.createSdsBoolean -import com.larsreimann.safeds.emf.createSdsCall -import com.larsreimann.safeds.emf.createSdsEnum -import com.larsreimann.safeds.emf.createSdsEnumVariant -import com.larsreimann.safeds.emf.createSdsExpressionLambda -import com.larsreimann.safeds.emf.createSdsFloat -import com.larsreimann.safeds.emf.createSdsInfixOperation -import com.larsreimann.safeds.emf.createSdsInt -import com.larsreimann.safeds.emf.createSdsMemberAccess -import com.larsreimann.safeds.emf.createSdsNull -import com.larsreimann.safeds.emf.createSdsParameter -import com.larsreimann.safeds.emf.createSdsParenthesizedExpression -import com.larsreimann.safeds.emf.createSdsPlaceholder -import com.larsreimann.safeds.emf.createSdsPrefixOperation -import com.larsreimann.safeds.emf.createSdsReference -import com.larsreimann.safeds.emf.createSdsStep -import com.larsreimann.safeds.emf.createSdsString -import com.larsreimann.safeds.emf.createSdsTemplateString -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.statementsOrEmpty -import com.larsreimann.safeds.safeDS.SafeDSFactory -import com.larsreimann.safeds.safeDS.SdsAbstractExpression -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsExpressionStatement -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.CsvSource - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class ToConstantExpressionTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - private val factory = SafeDSFactory.eINSTANCE - - private lateinit var impureBlockLambda: SdsBlockLambda - private lateinit var pureBlockLambda: SdsBlockLambda - private lateinit var recursiveBlockLambda: SdsBlockLambda - private lateinit var impureExpressionLambda: SdsExpressionLambda - private lateinit var pureExpressionLambda: SdsExpressionLambda - private lateinit var recursiveExpressionLambda: SdsExpressionLambda - private lateinit var impureStep: SdsStep - private lateinit var pureStep: SdsStep - private lateinit var recursiveStep: SdsStep - - @BeforeEach - fun reset() { - val compilationUnit = parseHelper.parseResource("partialEvaluation/callables.sdstest") - compilationUnit.shouldNotBeNull() - - val blockLambdas = compilationUnit.descendants().toList() - blockLambdas.shouldHaveSize(3) - - impureBlockLambda = blockLambdas[0] - pureBlockLambda = blockLambdas[1] - recursiveBlockLambda = blockLambdas[2] - - val expressionLambdas = compilationUnit.descendants().toList() - expressionLambdas.shouldHaveSize(3) - - impureExpressionLambda = expressionLambdas[0] - pureExpressionLambda = expressionLambdas[1] - recursiveExpressionLambda = expressionLambdas[2] - - impureStep = compilationUnit.findUniqueDeclarationOrFail("impureStep") - pureStep = compilationUnit.findUniqueDeclarationOrFail("pureStep") - recursiveStep = compilationUnit.findUniqueDeclarationOrFail("recursiveStep") - } - - @Nested - inner class BaseCases { - - @Test - fun `should return value of boolean literal`() { - val testData = createSdsBoolean(true) - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(true) - } - - @Test - fun `should return value of float literal`() { - val testData = createSdsFloat(1.0) - testData.toConstantExpressionOrNull() shouldBe SdsConstantFloat(1.0) - } - - @Test - fun `should return value of int literal`() { - val testData = createSdsInt(1) - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should return value of null literal`() { - val testData = createSdsNull() - testData.toConstantExpressionOrNull() shouldBe SdsConstantNull - } - - @Test - fun `should return value of for string literal`() { - val testData = createSdsString("test") - testData.toConstantExpressionOrNull() shouldBe SdsConstantString("test") - } - - @Test - fun `should return value of template string start`() { - val testData = factory.createSdsTemplateStringStart().apply { value = "test" } - testData.toConstantExpressionOrNull() shouldBe SdsConstantString("test") - } - - @Test - fun `should return value of template string inner`() { - val testData = factory.createSdsTemplateStringInner().apply { value = "test" } - testData.toConstantExpressionOrNull() shouldBe SdsConstantString("test") - } - - @Test - fun `should return value of template string end`() { - val testData = factory.createSdsTemplateStringEnd().apply { value = "test" } - testData.toConstantExpressionOrNull() shouldBe SdsConstantString("test") - } - - @Test - fun `toConstantExpression should return null for block lambda`() { - val testData = createSdsBlockLambda() - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `simplify should return null for impure block lambda`() { - impureBlockLambda.simplify(emptyMap()).shouldBeNull() - } - - @Test - fun `simplify should return intermediate block lambda for pure block lambda`() { - pureBlockLambda.simplify(emptyMap()).shouldBeInstanceOf() - } - - @Test - fun `simplify should return null for block lambda with recursive call`() { - recursiveBlockLambda.simplify(emptyMap()).shouldBeNull() - } - - @Test - fun `toConstantExpression should return null for expression lambda`() { - val testData = createSdsExpressionLambda(result = createSdsNull()) - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `simplify should return null for impure expression lambda`() { - impureExpressionLambda.simplify(emptyMap()).shouldBeNull() - } - - @Test - fun `simplify should return intermediate expression lambda for pure expression lambda`() { - pureExpressionLambda.simplify(emptyMap()).shouldBeInstanceOf() - } - - @Test - fun `simplify should return null for expression lambda with recursive call`() { - recursiveExpressionLambda.simplify(emptyMap()).shouldBeNull() - } - } - - @Nested - inner class Argument { - - @Test - fun `should return value as constant expression for arguments`() { - val testData = createSdsArgument(value = createSdsNull()) - testData.toConstantExpressionOrNull() shouldBe SdsConstantNull - } - } - - @Nested - inner class InfixOperation { - - @Nested - inner class Or { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - false | false | false - false | true | true - true | false | true - true | true | true""", - ) - fun `should return if left or right operand is true`( - leftOperand: Boolean, - rightOperand: Boolean, - expected: Boolean, - ) { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(leftOperand), - operator = SdsInfixOperationOperator.Or, - rightOperand = createSdsBoolean(rightOperand), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(expected) - } - - @Test - fun `should return null if the left operand is not a constant boolean`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.Or, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant boolean`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.Or, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class And { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - false | false | false - false | true | false - true | false | false - true | true | true""", - ) - fun `should return if left and right operand is true`( - leftOperand: Boolean, - rightOperand: Boolean, - expected: Boolean, - ) { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(leftOperand), - operator = SdsInfixOperationOperator.And, - rightOperand = createSdsBoolean(rightOperand), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(expected) - } - - @Test - fun `should return null if the left operand is not a constant boolean`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.And, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant boolean`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.And, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Equals { - - @Test - fun `should return true boolean literal if left and right operands are equal`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.Equals, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(true) - } - - @Test - fun `should return false boolean literal if left and right operands are not equal`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.Equals, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(false) - } - - @Test - fun `should return null if the left operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsCall( - receiver = createSdsNull(), - ), - operator = SdsInfixOperationOperator.Equals, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.Equals, - rightOperand = createSdsCall( - receiver = createSdsNull(), - ), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class NotEquals { - - @Test - fun `should return true boolean literal if left and right operands are not equal`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.NotEquals, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(true) - } - - @Test - fun `should return false boolean literal if left and right operands are equal`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.NotEquals, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(false) - } - - @Test - fun `should return null if the left operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsCall( - receiver = createSdsNull(), - ), - operator = SdsInfixOperationOperator.NotEquals, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.NotEquals, - rightOperand = createSdsCall( - receiver = createSdsNull(), - ), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class IdenticalTo { - - @Test - fun `should return true boolean literal if left and right operands are identical`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.IdenticalTo, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(true) - } - - @Test - fun `should return false boolean literal if left and right operands are not identical`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.IdenticalTo, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(false) - } - - @Test - fun `should return null if the left operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsCall( - receiver = createSdsNull(), - ), - operator = SdsInfixOperationOperator.IdenticalTo, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.IdenticalTo, - rightOperand = createSdsCall( - receiver = createSdsNull(), - ), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class NotIdenticalTo { - - @Test - fun `should return true boolean literal if left and right operands are not identical`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.NotIdenticalTo, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(true) - } - - @Test - fun `should return false boolean literal if left and right operands are identical`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.NotIdenticalTo, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(false) - } - - @Test - fun `should return null if the left operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsCall( - receiver = createSdsNull(), - ), - operator = SdsInfixOperationOperator.NotIdenticalTo, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.NotIdenticalTo, - rightOperand = createSdsCall( - receiver = createSdsNull(), - ), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class LessThan { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 0.5 | 1.5 | true - 0.5 | 1 | true - 0 | 1.5 | true - 0 | 1 | true - 1.5 | 0.5 | false - 1.5 | 0 | false - 1 | 0.5 | false - 1 | 0 | false""", - ) - fun `should return whether left operand is less than right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Boolean, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.LessThan, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(expected) - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.LessThan, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.LessThan, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class LessThanOrEquals { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 0.5 | 0.5 | true - 0.5 | 1 | true - 0 | 1.5 | true - 0 | 1 | true - 1.5 | 0.5 | false - 1.5 | 0 | false - 1 | 0.5 | false - 1 | 0 | false""", - ) - fun `should return whether left operand is less than or equal to right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Boolean, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.LessThanOrEquals, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(expected) - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.LessThanOrEquals, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.LessThanOrEquals, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class GreaterThanOrEquals { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 0.5 | 0.5 | true - 1.5 | 0 | true - 1 | 0.5 | true - 1 | 0 | true - 0.5 | 1.5 | false - 0.5 | 1 | false - 0 | 1.5 | false - 0 | 1 | false""", - ) - fun `should return whether left operand is greater than or equal to right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Boolean, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.GreaterThanOrEquals, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(expected) - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.GreaterThanOrEquals, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.GreaterThanOrEquals, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class GreaterThan { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 1.5 | 0.5 | true - 1.5 | 0 | true - 1 | 0.5 | true - 1 | 0 | true - 0.5 | 1.5 | false - 0.5 | 1 | false - 0 | 1.5 | false - 0 | 1 | false""", - ) - fun `should return whether left operand is greater than right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Boolean, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.GreaterThan, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(expected) - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.GreaterThan, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.GreaterThan, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Plus { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 1.5 | 0.25 | 1.75 - 1.5 | 1 | 2.5 - 1 | 0.25 | 1.25 - 1 | 1 | 2""", - ) - fun `should return sum of left and right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Double, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.Plus, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe expected.toSdsNumber().toConstantExpressionOrNull() - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.Plus, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.Plus, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Minus { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 1.5 | 0.25 | 1.25 - 1.5 | 1 | 0.5 - 1 | 0.25 | 0.75 - 1 | 1 | 0""", - ) - fun `should return difference between left and right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Double, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.Minus, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe expected.toSdsNumber().toConstantExpressionOrNull() - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.Minus, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.Minus, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Times { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 1.5 | 0.5 | 0.75 - 1.5 | 1 | 1.5 - 1 | 0.25 | 0.25 - 1 | 1 | 1""", - ) - fun `should return product of left and right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Double, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.Times, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe expected.toSdsNumber().toConstantExpressionOrNull() - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.Times, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.Times, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class By { - - @ParameterizedTest - @CsvSource( - delimiter = '|', - textBlock = """ - 0.25 | 0.5 | 0.5 - 1.5 | 1 | 1.5 - 1 | 0.625 | 1.6 - 1 | 1 | 1""", - ) - fun `should return quotient of left and right operand`( - leftOperand: Double, - rightOperand: Double, - expected: Double, - ) { - val testData = createSdsInfixOperation( - leftOperand = leftOperand.toSdsNumber(), - operator = SdsInfixOperationOperator.By, - rightOperand = rightOperand.toSdsNumber(), - ) - - testData.toConstantExpressionOrNull() shouldBe expected.toSdsNumber().toConstantExpressionOrNull() - } - - @Test - fun `should return null if the left operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.By, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant number`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.By, - rightOperand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is constant integer 0`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.By, - rightOperand = createSdsInt(0), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is constant float 0`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.By, - rightOperand = createSdsFloat(0.0), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is constant float -0`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.By, - rightOperand = createSdsFloat(-0.0), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Elvis { - - @Test - fun `should return left operand if it does not evaluate to a constant null`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsBoolean(true), - operator = SdsInfixOperationOperator.Elvis, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(true) - } - - @Test - fun `should return right operand if the left operand evaluates to a constant null`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsNull(), - operator = SdsInfixOperationOperator.Elvis, - rightOperand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(true) - } - - @Test - fun `should return null if the left operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsCall( - receiver = createSdsNull(), - ), - operator = SdsInfixOperationOperator.Elvis, - rightOperand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null if the right operand is not a constant expression`() { - val testData = createSdsInfixOperation( - leftOperand = createSdsInt(1), - operator = SdsInfixOperationOperator.Elvis, - rightOperand = createSdsCall( - receiver = createSdsNull(), - ), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - } - - @Nested - inner class ParenthesizedExpression { - - @Test - fun `should return expression as constant expression for parenthesized expressions`() { - val testData = createSdsParenthesizedExpression(createSdsNull()) - testData.toConstantExpressionOrNull() shouldBe SdsConstantNull - } - } - - @Nested - inner class PrefixOperation { - - @Nested - inner class Not { - - @Test - fun `should return negated operand if it is a constant boolean`() { - val testData = createSdsPrefixOperation( - operator = SdsPrefixOperationOperator.Not, - operand = createSdsBoolean(true), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantBoolean(false) - } - - @Test - fun `should return null if the operand is not a constant boolean`() { - val testData = createSdsPrefixOperation( - operator = SdsPrefixOperationOperator.Not, - operand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Minus { - - @Test - fun `should return negated operand if it is a constant float`() { - val testData = createSdsPrefixOperation( - operator = SdsPrefixOperationOperator.Minus, - operand = createSdsFloat(1.0), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantFloat(-1.0) - } - - @Test - fun `should return negated operand if it is a constant int`() { - val testData = createSdsPrefixOperation( - operator = SdsPrefixOperationOperator.Minus, - operand = createSdsInt(1), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(-1) - } - - @Test - fun `should return null if the operand is not a constant number`() { - val testData = createSdsPrefixOperation( - operator = SdsPrefixOperationOperator.Minus, - operand = createSdsNull(), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - } - - @Nested - inner class TemplateString { - - @Test - fun `should return concatenated string`() { - val testData = createSdsTemplateString( - stringParts = listOf( - "start ", - " inner1 ", - " inner2 ", - " inner3 ", - " inner4 ", - " inner5 ", - " end", - ), - templateExpressions = listOf( - createSdsBoolean(true), - createSdsFloat(1.0), - createSdsInt(1), - createSdsNull(), - createSdsString("string"), - createSdsReference(createSdsEnumVariant("Variant")), - ), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantString( - value = "start true inner1 1.0 inner2 1 inner3 null inner4 string inner5 Variant end", - ) - } - - @Test - fun `should return null if any expression is converted to null`() { - val testData = createSdsTemplateString( - stringParts = listOf("start ", " end"), - templateExpressions = listOf( - createSdsCall(receiver = createSdsNull()), - ), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Call { - - private lateinit var compilationUnit: SdsCompilationUnit - - @BeforeEach - fun reset() { - compilationUnit = parseHelper.parseResource("partialEvaluation/calls.sdstest")!! - } - - @Test - fun `should evaluate calls of block lambdas`() { - val pipeline = compilationUnit.findUniqueDeclarationOrFail("callToBlockLambda") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should evaluate calls of expression lambdas`() { - val pipeline = compilationUnit.findUniqueDeclarationOrFail("callToExpressionLambda") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should evaluate calls of steps`() { - val pipeline = compilationUnit.findUniqueDeclarationOrFail("callToStep") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should evaluate calls of steps with variadic parameter`() { - val pipeline = compilationUnit.findUniqueDeclarationOrFail("callToStepWithVariadicParameter") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should evaluate calls of steps with indexed variadic parameter`() { - val pipeline = compilationUnit - .findUniqueDeclarationOrFail("callToStepWithIndexedVariadicParameter") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should substitute parameters that were bound at call of a lambda`() { - val pipeline = compilationUnit.findUniqueDeclarationOrFail( - "parameterAssignedDuringCall", - ) - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(10) - } - - @Test - fun `should substitute parameters that were bound at creation of a lambda`() { - val pipeline = compilationUnit.findUniqueDeclarationOrFail( - "parameterAssignedDuringCreationOfLambda", - ) - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should evaluate calls with lambda as parameter`() { - val pipeline = compilationUnit.findUniqueDeclarationOrFail("lambdaAsParameter") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should return null otherwise`() { - val testData = createSdsCall(receiver = createSdsNull()) - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class MemberAccess { - - @Test - fun `should return constant enum variant if referenced enum variant has no parameters`() { - val testEnumVariant = createSdsEnumVariant(name = "TestEnumVariant") - val testEnum = createSdsEnum( - name = "TestEnum", - variants = listOf(testEnumVariant), - ) - val testData = createSdsMemberAccess( - receiver = createSdsReference(testEnum), - member = createSdsReference(testEnumVariant), - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantEnumVariant(testEnumVariant) - } - - @Test - fun `should return null if referenced enum variant has parameters`() { - val testEnumVariant = createSdsEnumVariant( - name = "TestEnumVariant", - parameters = listOf( - createSdsParameter(name = "testParameter"), - ), - ) - val testEnum = createSdsEnum( - name = "TestEnum", - variants = listOf(testEnumVariant), - ) - val testData = createSdsMemberAccess( - receiver = createSdsReference(testEnum), - member = createSdsReference(testEnumVariant), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return constant null if receiver is constant null and member access is null safe`() { - val testData = createSdsMemberAccess( - receiver = createSdsNull(), - member = createSdsReference(createSdsAttribute("testAttribute")), - isNullSafe = true, - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantNull - } - - @Test - fun `should return null if receiver is constant null and member access is not null safe`() { - val testData = createSdsMemberAccess( - receiver = createSdsNull(), - member = createSdsReference(createSdsAttribute("testAttribute")), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should access the result of a call by name if result exists`() { - val compilationUnit = - parseHelper.parseResource("partialEvaluation/memberAccesses.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("successfulResultAccess") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should return null if accessed result does not exist`() { - val compilationUnit = - parseHelper.parseResource("partialEvaluation/memberAccesses.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("failedResultAccess") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should return null for other receivers`() { - val testData = createSdsMemberAccess( - receiver = createSdsInt(1), - member = createSdsReference( - createSdsEnumVariant( - name = "TestEnumVariant", - parameters = listOf( - createSdsParameter(name = "testParameter"), - ), - ), - ), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } - - @Nested - inner class Reference { - - @Test - fun `should return constant enum variant if referenced enum variant has no parameters`() { - val testEnumVariant = createSdsEnumVariant(name = "TestEnumVariant") - val testData = createSdsReference( - declaration = testEnumVariant, - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantEnumVariant(testEnumVariant) - } - - @Test - fun `should return null if referenced enum variant has parameters`() { - val testEnumVariant = createSdsEnumVariant( - name = "TestEnumVariant", - parameters = listOf( - createSdsParameter(name = "testParameter"), - ), - ) - val testData = createSdsReference( - declaration = testEnumVariant, - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should convert assigned value of referenced placeholder`() { - val testPlaceholder = createSdsPlaceholder("testPlaceholder") - createSdsAssignment( - assignees = listOf(testPlaceholder), - createSdsNull(), - ) - val testData = createSdsReference( - declaration = testPlaceholder, - ) - - testData.toConstantExpressionOrNull() shouldBe SdsConstantNull - } - - @Test - fun `should return null if referenced placeholder has no assigned value`() { - val testData = createSdsReference( - declaration = createSdsPlaceholder("testPlaceholder"), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `simplify should return substituted value if it exists`() { - val testParameter = createSdsParameter("testParameter") - val testData = createSdsReference( - declaration = testParameter, - ) - - testData.simplify(mapOf(testParameter to SdsConstantNull)) shouldBe SdsConstantNull - } - - @Test - fun `simplify should return default value if referenced parameter is not substituted but optional`() { - val testParameter = createSdsParameter( - name = "testParameter", - defaultValue = createSdsNull(), - ) - val testData = createSdsReference( - declaration = testParameter, - ) - - testData.simplify(emptyMap()) shouldBe SdsConstantNull - } - - @Test - fun `simplify should return null if referenced parameter is required and not substituted`() { - val testParameter = createSdsParameter("testParameter") - val testData = createSdsReference( - declaration = testParameter, - ) - - testData.simplify(emptyMap()).shouldBeNull() - } - - @Test - fun `toConstantExpression should return null if step is referenced`() { - val testData = createSdsReference(createSdsStep("testStep")) - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `simplify should return null if referenced step is impure`() { - val testData = createSdsReference(impureStep) - testData.simplify(emptyMap()).shouldBeNull() - } - - @Test - fun `simplify should return intermediate step if referenced step is pure`() { - val testData = createSdsReference(pureStep) - testData.simplify(emptyMap()).shouldBeInstanceOf() - } - - @Test - fun `simplify should return null if referenced step has recursive calls`() { - val testData = createSdsReference(recursiveStep) - testData.simplify(emptyMap()).shouldBeNull() - } - - @Test - fun `should return value of placeholders inside valid assignment with call as expression`() { - val compilationUnit = - parseHelper.parseResource("partialEvaluation/references.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("successfulRecordAssignment") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should return null for references to placeholders inside invalid assignment with call as expression`() { - val compilationUnit = - parseHelper.parseResource("partialEvaluation/references.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("failedRecordAssignment") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull().shouldBeNull() - } - - @Test - fun `should evaluate references to placeholders (assigned, called step has different yield order)`() { - val compilationUnit = - parseHelper.parseResource("partialEvaluation/references.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail( - "recordAssignmentWithDifferentYieldOrder", - ) - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should evaluate references to placeholders (assigned, called step has missing yield)`() { - val compilationUnit = - parseHelper.parseResource("partialEvaluation/references.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail("recordAssignmentWithMissingYield") - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should evaluate references to placeholders (assigned, called step has additional yield)`() { - val compilationUnit = - parseHelper.parseResource("partialEvaluation/references.sdstest") - compilationUnit.shouldNotBeNull() - - val pipeline = compilationUnit.findUniqueDeclarationOrFail( - "recordAssignmentWithAdditionalYield", - ) - val testData = pipeline.expectedExpression() - - testData.toConstantExpressionOrNull() shouldBe SdsConstantInt(1) - } - - @Test - fun `should return null for other declarations`() { - val testData = createSdsReference( - declaration = createSdsAnnotation("TestAnnotation"), - ) - - testData.toConstantExpressionOrNull().shouldBeNull() - } - } -} - -private fun Double.toSdsNumber(): SdsAbstractExpression { - return when { - this == this.toInt().toDouble() -> createSdsInt(this.toInt()) - else -> createSdsFloat(this) - } -} - -/** - * Helper method for tests loaded from a resource that returns the expression of the first expression statement in the - * pipeline. - */ -private fun SdsPipeline.expectedExpression() = statementsOrEmpty() - .filterIsInstance() - .firstOrNull() - .shouldNotBeNull() - .expression diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/schema/InitialSchemaInferenceTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/schema/InitialSchemaInferenceTest.kt deleted file mode 100644 index 379cf7441..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/schema/InitialSchemaInferenceTest.kt +++ /dev/null @@ -1,67 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.schema - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.emf.createSdsCompilationUnit -import com.larsreimann.safeds.emf.createSdsDummyResource -import com.larsreimann.safeds.serializer.SerializationResult -import com.larsreimann.safeds.serializer.serializeToFormattedString -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.getResourcePath -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class InitialSchemaInferenceTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - private val expectedSchema = """ - |package test - | - |schema dummyData { - | "Column0" : Int?, - | "Column1" : Int?, - | "Column2" : Int?, - | "Column3" : String?, - | "Column4" : String?, - | "Column5" : Int?, - | "Column6" : Int?, - | "Column7" : Int?, - | "Column8" : String?, - | "Column9" : Float?, - | "Column10" : String?, - | "Column11" : String? - |} - """.trimMargin() - - @Test - @OptIn(ExperimentalSdsApi::class) - fun inferInitialSchema() { - val context = parseHelper.parseProgramText("package test") - context.shouldNotBeNull() - - val csvPath = javaClass.classLoader.getResourcePath("schema/dummyData.csv") - csvPath.shouldNotBeNull() - - val schema = inferInitialSchema(context, csvPath) - schema.shouldNotBeNull() - - val compilationUnit = createSdsCompilationUnit(packageName = "test", members = listOf(schema)) - createSdsDummyResource("test", SdsFileExtension.Schema, compilationUnit) - - val result = compilationUnit.serializeToFormattedString() - result.shouldBeInstanceOf() - - result.code.shouldBe(expectedSchema) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeComputerTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeComputerTest.kt deleted file mode 100644 index 91a41f25d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/staticAnalysis/typing/TypeComputerTest.kt +++ /dev/null @@ -1,992 +0,0 @@ -package com.larsreimann.safeds.staticAnalysis.typing - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.constant.SdsInfixOperationOperator -import com.larsreimann.safeds.constant.operator -import com.larsreimann.safeds.emf.blockLambdaResultsOrEmpty -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.emf.parametersOrEmpty -import com.larsreimann.safeds.emf.resultsOrEmpty -import com.larsreimann.safeds.emf.typeArgumentsOrEmpty -import com.larsreimann.safeds.safeDS.SdsAbstractObject -import com.larsreimann.safeds.safeDS.SdsArgument -import com.larsreimann.safeds.safeDS.SdsAttribute -import com.larsreimann.safeds.safeDS.SdsBlockLambda -import com.larsreimann.safeds.safeDS.SdsBlockLambdaResult -import com.larsreimann.safeds.safeDS.SdsCall -import com.larsreimann.safeds.safeDS.SdsCallableType -import com.larsreimann.safeds.safeDS.SdsClass -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsEnum -import com.larsreimann.safeds.safeDS.SdsEnumVariant -import com.larsreimann.safeds.safeDS.SdsExpressionLambda -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.safeDS.SdsIndexedAccess -import com.larsreimann.safeds.safeDS.SdsInfixOperation -import com.larsreimann.safeds.safeDS.SdsMemberAccess -import com.larsreimann.safeds.safeDS.SdsMemberType -import com.larsreimann.safeds.safeDS.SdsNamedType -import com.larsreimann.safeds.safeDS.SdsParameter -import com.larsreimann.safeds.safeDS.SdsParenthesizedExpression -import com.larsreimann.safeds.safeDS.SdsParenthesizedType -import com.larsreimann.safeds.safeDS.SdsPipeline -import com.larsreimann.safeds.safeDS.SdsPlaceholder -import com.larsreimann.safeds.safeDS.SdsReference -import com.larsreimann.safeds.safeDS.SdsResult -import com.larsreimann.safeds.safeDS.SdsStep -import com.larsreimann.safeds.safeDS.SdsUnionType -import com.larsreimann.safeds.safeDS.SdsYield -import com.larsreimann.safeds.staticAnalysis.assignedOrNull -import com.larsreimann.safeds.stdlibAccess.StdlibClasses -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import com.larsreimann.safeds.testing.getResourcePath -import io.kotest.assertions.forEachAsClue -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.sequences.shouldHaveSize -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.ValueSource -import java.nio.file.Files -import java.nio.file.Path - -@Suppress("PrivatePropertyName") -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class TypeComputerTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - private val testRoot = javaClass.classLoader.getResourcePath("typeComputer").toString() - - // ***************************************************************************************************************** - // Assignees - // ****************************************************************************************************************/ - - @Nested - inner class BlockLambdaResults { - - @Test - fun `attributes should have declared type`() { - withCompilationUnitFromFile("assignees/blockLambdaResults") { - descendants().forEach { - val assigned = it.assignedOrNull() - assigned.shouldNotBeNull() - it shouldHaveType assigned - } - } - } - } - - @Nested - inner class Placeholders { - - @Test - fun `classes should have non-nullable class type`() { - withCompilationUnitFromFile("assignees/placeholders") { - descendants().forEach { - val assigned = it.assignedOrNull() - assigned.shouldNotBeNull() - it shouldHaveType assigned - } - } - } - } - - @Nested - inner class Yields { - - @Test - fun `enums should have non-nullable enum type`() { - withCompilationUnitFromFile("assignees/yields") { - descendants().forEach { - val assigned = it.assignedOrNull() - assigned.shouldNotBeNull() - it shouldHaveType assigned - } - } - } - } - - // ***************************************************************************************************************** - // Declarations - // ****************************************************************************************************************/ - - @Nested - inner class Attributes { - - @Test - fun `attributes should have declared type`() { - withCompilationUnitFromFile("declarations/attributes") { - descendants().forEach { - it shouldHaveType it.type - } - } - } - } - - @Nested - inner class Classes { - - @Test - fun `classes should have non-nullable class type`() { - withCompilationUnitFromFile("declarations/classes") { - descendants().forEach { - it shouldHaveType ClassType(it, isNullable = false) - } - } - } - } - - @Nested - inner class Enums { - - @Test - fun `enums should have non-nullable enum type`() { - withCompilationUnitFromFile("declarations/enums") { - descendants().forEach { - it shouldHaveType EnumType(it, isNullable = false) - } - } - } - } - - @Nested - inner class EnumVariants { - - @Test - fun `enum variants should have non-nullable enum variant type`() { - withCompilationUnitFromFile("declarations/enumVariants") { - descendants().forEach { - it shouldHaveType EnumVariantType(it, isNullable = false) - } - } - } - } - - @Nested - inner class Functions { - - @Test - fun `functions should have callable type with respective parameters and results`() { - withCompilationUnitFromFile("declarations/functions") { - descendants().forEach { function -> - function shouldHaveType CallableType( - function.parametersOrEmpty().map { it.type() }, - function.resultsOrEmpty().map { it.type() }, - ) - } - } - } - } - - @Nested - inner class Parameters { - - @Test - fun `parameters should have declared type`() { - withCompilationUnitFromFile("declarations/parameters") { - findUniqueDeclarationOrFail("myStepWithNormalParameter") - .descendants().forEach { - it shouldHaveType it.type - } - } - } - - @Test - fun `variadic parameters should have variadic type with declared element type`() { - withCompilationUnitFromFile("declarations/parameters") { - findUniqueDeclarationOrFail("myStepWithVariadicParameter") - .descendants().forEach { - it shouldHaveType VariadicType(it.type.type()) - } - } - } - - @Test - fun `lambda parameters should have type inferred from context`() { - withCompilationUnitFromFile("declarations/parameters") { - findUniqueDeclarationOrFail("myStepWithLambdas") - .descendants() - .toList() - .forEachAsClue { - it shouldHaveType String - } - } - } - } - - @Nested - inner class Results { - - @Test - fun `results should have declared type`() { - withCompilationUnitFromFile("declarations/results") { - descendants().forEach { - it shouldHaveType it.type - } - } - } - } - - @Nested - inner class Steps { - - @Test - fun `steps should have callable type with respective parameters and results`() { - withCompilationUnitFromFile("declarations/steps") { - descendants().forEach { step -> - step shouldHaveType CallableType( - step.parametersOrEmpty().map { it.type() }, - step.resultsOrEmpty().map { it.type() }, - ) - } - } - } - } - - // ***************************************************************************************************************** - // Expressions - // ****************************************************************************************************************/ - - @Nested - inner class Literals { - - @Test - fun `boolean literals should have type Boolean`() { - withCompilationUnitFromFile("expressions/literals") { - placeholderWithName("booleanLiteral").assignedValueOrFail() shouldHaveType Boolean - } - } - - @Test - fun `float literals should have type Float`() { - withCompilationUnitFromFile("expressions/literals") { - placeholderWithName("floatLiteral").assignedValueOrFail() shouldHaveType Float - } - } - - @Test - fun `int literals should have type Int`() { - withCompilationUnitFromFile("expressions/literals") { - placeholderWithName("intLiteral").assignedValueOrFail() shouldHaveType Int - } - } - - @Test - fun `null literals should have type nullable Nothing`() { - withCompilationUnitFromFile("expressions/literals") { - placeholderWithName("nullLiteral").assignedValueOrFail() shouldHaveType NothingOrNull - } - } - - @Test - fun `string literals should have type String`() { - withCompilationUnitFromFile("expressions/literals") { - placeholderWithName("stringLiteral").assignedValueOrFail() shouldHaveType String - } - } - } - - @Nested - inner class TemplateStrings { - - @Test - fun `template strings should have type String`() { - withCompilationUnitFromFile("expressions/templateStrings") { - placeholderWithName("templateString").assignedValueOrFail() shouldHaveType String - } - } - } - - @Nested - inner class Arguments { - - @Test - fun `arguments should have type of value`() { - withCompilationUnitFromFile("expressions/arguments") { - descendants().forEach { - it shouldHaveType it.value - } - } - } - } - - @Nested - inner class BlockLambdas { - - @Test - fun `block lambdas should have callable type (explicit parameter types)`() { - withCompilationUnitFromFile("expressions/blockLambdas") { - findUniqueDeclarationOrFail("lambdasWithExplicitParameterTypes") - .descendants().forEach { lambda -> - lambda shouldHaveType CallableType( - lambda.parametersOrEmpty().map { it.type() }, - lambda.blockLambdaResultsOrEmpty().map { it.type() }, - ) - } - } - } - - @Test - fun `block lambdas should have callable type (explicit variadic parameter type)`() { - withCompilationUnitFromFile("expressions/blockLambdas") { - findUniqueDeclarationOrFail("lambdasWithExplicitVariadicType") - .descendants().forEach { lambda -> - lambda shouldHaveType CallableType( - lambda.parametersOrEmpty().map { it.type() }, - lambda.blockLambdaResultsOrEmpty().map { it.type() }, - ) - } - } - } - - @Test - fun `block lambdas should have callable type (yielded)`() { - withCompilationUnitFromFile("expressions/blockLambdas") { - val step = findUniqueDeclarationOrFail("yieldedLambda") - - val result = step.findUniqueDeclarationOrFail("result") - val resultType = result.type.shouldBeInstanceOf() - - val lambdas = step.descendants() - lambdas.shouldHaveSize(1) - val lambda = lambdas.first() - - lambda shouldHaveType CallableType( - resultType.parametersOrEmpty().map { it.type() }, - lambda.blockLambdaResultsOrEmpty().map { it.type() }, - ) - } - } - - @Test - fun `block lambdas should have callable type (argument)`() { - withCompilationUnitFromFile("expressions/blockLambdas") { - val parameter = findUniqueDeclarationOrFail("parameter") - val parameterType = parameter.type.shouldBeInstanceOf() - - val step = findUniqueDeclarationOrFail("argumentLambda") - val lambdas = step.descendants() - lambdas.shouldHaveSize(1) - val lambda = lambdas.first() - - lambda shouldHaveType CallableType( - parameterType.parametersOrEmpty().map { it.type() }, - lambda.blockLambdaResultsOrEmpty().map { it.type() }, - ) - } - } - } - - @Nested - inner class Calls { - - @Test - fun `class call should have class type of called class`() { - withCompilationUnitFromFile("expressions/calls") { - val `class` = findUniqueDeclarationOrFail("C") - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[0] shouldHaveType ClassType(`class`, isNullable = false) - } - } - - @Test - fun `callable type call should have type of result (one result)`() { - withCompilationUnitFromFile("expressions/calls") { - val parameter = findUniqueDeclarationOrFail("p1") - val parameterType = parameter.type.shouldBeInstanceOf() - parameterType.resultsOrEmpty().shouldHaveSize(1) - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[1] shouldHaveType parameterType.resultsOrEmpty()[0] - } - } - - @Test - fun `callable type call should have record type (multiple result)`() { - withCompilationUnitFromFile("expressions/calls") { - val parameter = findUniqueDeclarationOrFail("p2") - val parameterType = parameter.type.shouldBeInstanceOf() - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[2] shouldHaveType RecordType(parameterType.resultsOrEmpty().map { it.name to it.type() }) - } - } - - @Test - fun `enum variant call should have enum variant type of called enum variant`() { - withCompilationUnitFromFile("expressions/calls") { - val enumVariant = findUniqueDeclarationOrFail("V") - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[3] shouldHaveType EnumVariantType(enumVariant, isNullable = false) - } - } - - @Test - fun `function call should have type of result (one result)`() { - withCompilationUnitFromFile("expressions/calls") { - val function = findUniqueDeclarationOrFail("f1") - function.resultsOrEmpty().shouldHaveSize(1) - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[4] shouldHaveType function.resultsOrEmpty()[0] - } - } - - @Test - fun `function call should have record type (multiple result)`() { - withCompilationUnitFromFile("expressions/calls") { - val function = findUniqueDeclarationOrFail("f2") - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[5] shouldHaveType RecordType(function.resultsOrEmpty().map { it.name to it.type() }) - } - } - - @Test - fun `block lambda call should have type of result (one result)`() { - withCompilationUnitFromFile("expressions/calls") { - val blockLambdas = descendants().toList() - blockLambdas.shouldHaveSize(2) - val blockLambda = blockLambdas[0] - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[6] shouldHaveType blockLambda.blockLambdaResultsOrEmpty()[0] - } - } - - @Test - fun `block lambda call should have record type (multiple result)`() { - withCompilationUnitFromFile("expressions/calls") { - val blockLambdas = descendants().toList() - blockLambdas.shouldHaveSize(2) - val blockLambda = blockLambdas[1] - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[7] shouldHaveType RecordType(blockLambda.blockLambdaResultsOrEmpty().map { it.name to it.type() }) - } - } - - @Test - fun `expression lambda call should have type of result`() { - withCompilationUnitFromFile("expressions/calls") { - val expressionLambdas = descendants().toList() - expressionLambdas.shouldHaveSize(1) - val expressionLambda = expressionLambdas[0] - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[8] shouldHaveType expressionLambda.result - } - } - - @Test - fun `step call should have type of result (one result)`() { - withCompilationUnitFromFile("expressions/calls") { - val step = findUniqueDeclarationOrFail("s1") - step.resultsOrEmpty().shouldHaveSize(1) - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[9] shouldHaveType step.resultsOrEmpty()[0] - } - } - - @Test - fun `step call should have record type (multiple result)`() { - withCompilationUnitFromFile("expressions/calls") { - val step = findUniqueDeclarationOrFail("s2") - - val calls = descendants().toList() - calls.shouldHaveSize(11) - calls[10] shouldHaveType RecordType(step.resultsOrEmpty().map { it.name to it.type() }) - } - } - } - - @Nested - inner class ExpressionLambdas { - - @Test - fun `expression lambdas should have callable type (explicit parameter types)`() { - withCompilationUnitFromFile("expressions/expressionLambdas") { - findUniqueDeclarationOrFail("lambdasWithExplicitParameterTypes") - .descendants().forEach { lambda -> - lambda shouldHaveType CallableType( - lambda.parametersOrEmpty().map { it.type() }, - listOf(lambda.result.type()), - ) - } - } - } - - @Test - fun `expression lambdas should have callable type (explicit variadic parameter type)`() { - withCompilationUnitFromFile("expressions/expressionLambdas") { - findUniqueDeclarationOrFail("lambdasWithExplicitVariadicType") - .descendants().forEach { lambda -> - lambda shouldHaveType CallableType( - lambda.parametersOrEmpty().map { it.type() }, - listOf(lambda.result.type()), - ) - } - } - } - - @Test - fun `expression lambdas should have callable type (yielded)`() { - withCompilationUnitFromFile("expressions/expressionLambdas") { - val step = findUniqueDeclarationOrFail("yieldedLambda") - - val result = step.findUniqueDeclarationOrFail("result") - val resultType = result.type.shouldBeInstanceOf() - - val lambdas = step.descendants() - lambdas.shouldHaveSize(1) - val lambda = lambdas.first() - - lambda shouldHaveType CallableType( - resultType.parametersOrEmpty().map { it.type() }, - listOf(lambda.result.type()), - ) - } - } - - @Test - fun `expression lambdas should have callable type (argument)`() { - withCompilationUnitFromFile("expressions/expressionLambdas") { - val parameter = findUniqueDeclarationOrFail("parameter") - val parameterType = parameter.type.shouldBeInstanceOf() - - val step = findUniqueDeclarationOrFail("argumentLambda") - val lambdas = step.descendants() - lambdas.shouldHaveSize(1) - val lambda = lambdas.first() - - lambda shouldHaveType CallableType( - parameterType.parametersOrEmpty().map { it.type() }, - listOf(lambda.result.type()), - ) - } - } - } - - @Nested - inner class IndexedAccesses { - - @Test - fun `indexed accesses should return element type if receiver is variadic (myStep1)`() { - withCompilationUnitFromFile("expressions/indexedAccesses") { - findUniqueDeclarationOrFail("myStep1") - .descendants() - .forEach { - it shouldHaveType Int - } - } - } - - @Test - fun `indexed accesses should return element type if receiver is variadic (myStep2)`() { - withCompilationUnitFromFile("expressions/indexedAccesses") { - findUniqueDeclarationOrFail("myStep2") - .descendants() - .forEach { - it shouldHaveType String - } - } - } - - @Test - fun `indexed accesses should return Nothing type if receiver is not variadic`() { - withCompilationUnitFromFile("expressions/indexedAccesses") { - findUniqueDeclarationOrFail("myStep3") - .descendants() - .forEach { - it shouldHaveType Nothing - } - } - } - - @Test - fun `indexed accesses should return Unresolved type if receiver is unresolved`() { - withCompilationUnitFromFile("expressions/indexedAccesses") { - findUniqueDeclarationOrFail("myStep4") - .descendants() - .forEach { - it shouldHaveType UnresolvedType - } - } - } - } - - @Nested - inner class MemberAccesses { - - @Test - fun `non-null-safe member accesses should have type of referenced member`() { - withCompilationUnitFromFile("expressions/memberAccesses") { - descendants() - .filter { !it.isNullSafe } - .forEach { - it shouldHaveType it.member - } - } - } - - @Test - fun `null-safe member accesses should have type of referenced member but nullable`() { - withCompilationUnitFromFile("expressions/memberAccesses") { - descendants() - .filter { it.isNullSafe } - .forEach { - it shouldHaveType it.member.type().setIsNullableOnCopy(isNullable = true) - } - } - } - } - - @Nested - inner class ParenthesizedExpressions { - - @Test - fun `parenthesized expressions should have type of expressions`() { - withCompilationUnitFromFile("expressions/parenthesizedExpressions") { - descendants().forEach { - it shouldHaveType it.expression - } - } - } - } - - @Nested - inner class References { - - @Test - fun `references should have type of referenced declaration`() { - withCompilationUnitFromFile("expressions/references") { - descendants().forEach { - it shouldHaveType it.declaration - } - } - } - } - - @Nested - inner class Operations { - - @ParameterizedTest - @ValueSource( - strings = [ - "additionIntInt", - "subtractionIntInt", - "multiplicationIntInt", - "divisionIntInt", - "negationInt", - ], - ) - fun `arithmetic operations with only Int operands should have type Int`(placeholderName: String) { - withCompilationUnitFromFile("expressions/operations/arithmetic") { - placeholderWithName(placeholderName).assignedValueOrFail() shouldHaveType Int - } - } - - @ParameterizedTest - @ValueSource( - strings = [ - "additionIntFloat", - "subtractionIntFloat", - "multiplicationIntFloat", - "divisionIntFloat", - "negationFloat", - "additionInvalid", - "subtractionInvalid", - "multiplicationInvalid", - "divisionInvalid", - "negationInvalid", - ], - ) - fun `arithmetic operations with non-Int operands should have type Float`(placeholderName: String) { - withCompilationUnitFromFile("expressions/operations/arithmetic") { - placeholderWithName(placeholderName).assignedValueOrFail() shouldHaveType Float - } - } - - @ParameterizedTest - @ValueSource( - strings = [ - "lessThan", - "lessThanOrEquals", - "greaterThanOrEquals", - "greaterThan", - "lessThanInvalid", - "lessThanOrEqualsInvalid", - "greaterThanOrEqualsInvalid", - "greaterThanInvalid", - ], - ) - fun `comparison operations should have type Boolean`(placeholderName: String) { - withCompilationUnitFromFile("expressions/operations/comparison") { - placeholderWithName(placeholderName).assignedValueOrFail() shouldHaveType Boolean - } - } - - @ParameterizedTest - @ValueSource( - strings = [ - "equals", - "notEquals", - ], - ) - fun `equality operations should have type Boolean`(placeholderName: String) { - withCompilationUnitFromFile("expressions/operations/equality") { - placeholderWithName(placeholderName).assignedValueOrFail() shouldHaveType Boolean - } - } - - @ParameterizedTest - @ValueSource( - strings = [ - "strictlyEquals", - "notStrictlyEquals", - ], - ) - fun `strict equality operations should have type Boolean`(placeholderName: String) { - withCompilationUnitFromFile("expressions/operations/strictEquality") { - placeholderWithName(placeholderName).assignedValueOrFail() shouldHaveType Boolean - } - } - - @ParameterizedTest - @ValueSource( - strings = [ - "conjunction", - "disjunction", - "negation", - "conjunctionInvalid", - "disjunctionInvalid", - "negationInvalid", - ], - ) - fun `logical operations should have type Boolean`(placeholderName: String) { - withCompilationUnitFromFile("expressions/operations/logical") { - placeholderWithName(placeholderName).assignedValueOrFail() shouldHaveType Boolean - } - } - - @Test - fun `elvis operator with non-nullable left operand should have type of left operand`() { - withCompilationUnitFromFile("expressions/operations/elvis") { - findUniqueDeclarationOrFail("elvisWithNonNullableLeftOperand") - .descendants() - .filter { it.operator() == SdsInfixOperationOperator.Elvis } - .forEach { it shouldHaveType it.leftOperand } - } - } - - @Test - fun `elvis operator with nullable left operand should have lowest common supertype of non-nullable left operand and right operand (intOrNullElseIntOrNull)`() { - withCompilationUnitFromFile("expressions/operations/elvis") { - placeholderWithName("intOrNullElseIntOrNull") shouldHaveType IntOrNull - } - } - - @Test - fun `elvis operator with nullable left operand should have lowest common supertype of non-nullable left operand and right operand (intOrNullElseNull)`() { - withCompilationUnitFromFile("expressions/operations/elvis") { - placeholderWithName("intOrNullElseNull") shouldHaveType IntOrNull - } - } - - @Test - fun `elvis operator with nullable left operand should have lowest common supertype of non-nullable left operand and right operand (intOrNullElseInt)`() { - withCompilationUnitFromFile("expressions/operations/elvis") { - placeholderWithName("intOrNullElseInt") shouldHaveType Int - } - } - - @Test - fun `elvis operator with nullable left operand should have lowest common supertype of non-nullable left operand and right operand (intOrNullElseFloat)`() { - withCompilationUnitFromFile("expressions/operations/elvis") { - placeholderWithName("intOrNullElseFloat") shouldHaveType Number - } - } - - @Test - fun `elvis operator with nullable left operand should have lowest common supertype of non-nullable left operand and right operand (intOrNullElseString)`() { - withCompilationUnitFromFile("expressions/operations/elvis") { - placeholderWithName("intOrNullElseString") shouldHaveType Any - } - } - - @Test - fun `elvis operator with nullable left operand should have lowest common supertype of non-nullable left operand and right operand (intOrNullElseStringOrNull)`() { - withCompilationUnitFromFile("expressions/operations/elvis") { - placeholderWithName("intOrNullElseStringOrNull") shouldHaveType AnyOrNull - } - } - } - -// ***************************************************************************************************************** -// Types -// ****************************************************************************************************************/ - - @Nested - inner class CallableTypes { - - @Test - fun `callable type should have callable type with respective parameters and results`() { - withCompilationUnitFromFile("types/callableTypes") { - descendants().forEach { callableType -> - callableType shouldHaveType CallableType( - callableType.parametersOrEmpty().map { it.type() }, - callableType.resultsOrEmpty().map { it.type() }, - ) - } - } - } - } - - @Nested - inner class MemberTypes { - - @Test - fun `non-nullable member type should have type of referenced member`() { - withCompilationUnitFromFile("types/memberTypes") { - findUniqueDeclarationOrFail("nonNullableMemberTypes") - .descendants().forEach { - it shouldHaveType it.member - } - } - } - - @Test - fun `nullable member type should have nullable type of referenced member`() { - withCompilationUnitFromFile("types/memberTypes") { - findUniqueDeclarationOrFail("nullableMemberTypes") - .descendants().forEach { - it shouldHaveType it.member.type().setIsNullableOnCopy(isNullable = true) - } - } - } - } - - @Nested - inner class NamedTypes { - - @Test - fun `non-nullable named type should have type of referenced declaration`() { - withCompilationUnitFromFile("types/namedTypes") { - findUniqueDeclarationOrFail("nonNullableNamedTypes") - .descendants().forEach { - it shouldHaveType it.declaration - } - } - } - - @Test - fun `nullable named type should have nullable type of referenced declaration`() { - withCompilationUnitFromFile("types/namedTypes") { - findUniqueDeclarationOrFail("nullableNamedTypes") - .descendants().forEach { - it shouldHaveType it.declaration.type().setIsNullableOnCopy(isNullable = true) - } - } - } - } - - @Nested - inner class ParenthesizedTypes { - - @Test - fun `parenthesized type should have type of type`() { - withCompilationUnitFromFile("types/parenthesizedTypes") { - descendants().forEach { - it shouldHaveType it.type - } - } - } - } - - @Nested - inner class UnionTypes { - - @Test - fun `union type should have union type over its type arguments`() { - withCompilationUnitFromFile("types/unionTypes") { - descendants().forEach { unionType -> - unionType shouldHaveType UnionType( - unionType.typeArgumentsOrEmpty().map { it.type() }.toSet(), - ) - } - } - } - } - -// ***************************************************************************************************************** -// Helpers -// ****************************************************************************************************************/ - - infix fun SdsAbstractObject.shouldHaveType(expectedType: Type) { - this.type().shouldBe(expectedType) - } - - infix fun SdsAbstractObject.shouldHaveType(expected: SdsAbstractObject) { - this.type().shouldBe(expected.type()) - } - - private fun SdsPlaceholder.assignedValueOrFail(): SdsAbstractObject { - return this.assignedOrNull() - ?: throw IllegalArgumentException("No value is assigned to placeholder with name '$name'.") - } - - private fun SdsCompilationUnit.placeholderWithName(name: String): SdsPlaceholder { - val candidates = this.eAllContents().asSequence() - .filterIsInstance() - .filter { it.name == name } - .toList() - - when (candidates.size) { - 1 -> return candidates.first() - else -> throw IllegalArgumentException("File contains ${candidates.size} placeholders with name '$name'.") - } - } - - private fun withCompilationUnitFromFile(file: String, lambda: SdsCompilationUnit.() -> Unit) { - val program = Files.readString(Path.of(testRoot, "$file.${SdsFileExtension.Test}")) - val compilationUnit = parseHelper.parseProgramText(program) - ?: throw IllegalArgumentException("File is not a compilation unit.") - compilationUnit.apply(lambda) - } - - private val SdsCompilationUnit.Any get() = stdlibType(this, StdlibClasses.Any) - private val SdsCompilationUnit.AnyOrNull get() = stdlibType(this, StdlibClasses.Any, isNullable = true) - private val SdsCompilationUnit.Boolean get() = stdlibType(this, StdlibClasses.Boolean) - private val SdsCompilationUnit.Number get() = stdlibType(this, StdlibClasses.Number) - private val SdsCompilationUnit.Float get() = stdlibType(this, StdlibClasses.Float) - private val SdsCompilationUnit.Int get() = stdlibType(this, StdlibClasses.Int) - private val SdsCompilationUnit.IntOrNull get() = stdlibType(this, StdlibClasses.Int, isNullable = true) - private val SdsCompilationUnit.Nothing get() = stdlibType(this, StdlibClasses.Nothing) - private val SdsCompilationUnit.NothingOrNull get() = stdlibType(this, StdlibClasses.Nothing, isNullable = true) - private val SdsCompilationUnit.String get() = stdlibType(this, StdlibClasses.String) -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibAnnotationsTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibAnnotationsTest.kt deleted file mode 100644 index 4f55059db..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/stdlibAccess/StdlibAnnotationsTest.kt +++ /dev/null @@ -1,197 +0,0 @@ -package com.larsreimann.safeds.stdlibAccess - -import com.google.inject.Inject -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.safeDS.SdsAnnotation -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.safeDS.SdsFunction -import com.larsreimann.safeds.testing.ParseHelper -import com.larsreimann.safeds.testing.SafeDSInjectorProvider -import com.larsreimann.safeds.testing.assertions.findUniqueDeclarationOrFail -import io.kotest.matchers.booleans.shouldBeFalse -import io.kotest.matchers.booleans.shouldBeTrue -import io.kotest.matchers.collections.shouldContainExactly -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.nulls.shouldNotBeNull -import io.kotest.matchers.shouldBe -import org.eclipse.xtext.testing.InjectWith -import org.eclipse.xtext.testing.extensions.InjectionExtension -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -private const val testRoot = "stdlibAccess/annotations" - -@ExtendWith(InjectionExtension::class) -@InjectWith(SafeDSInjectorProvider::class) -class StdlibAnnotationsTest { - - @Inject - private lateinit var parseHelper: ParseHelper - - @Nested - inner class DescriptionOrNull { - - @Test - fun `should return description if it exists and is unique`() = withCompilationUnit("description") { - val testData = findUniqueDeclarationOrFail("functionWithUniqueDescription") - testData.descriptionOrNull() shouldBe "Lorem ipsum" - } - - @Test - fun `should return null if description is not unique`() = withCompilationUnit("description") { - val testData = findUniqueDeclarationOrFail("functionWithMultipleDescriptions") - testData.descriptionOrNull().shouldBeNull() - } - - @Test - fun `should return null if declaration does not have a description`() = withCompilationUnit("description") { - val testData = findUniqueDeclarationOrFail("functionWithoutDescription") - testData.descriptionOrNull().shouldBeNull() - } - } - - @Nested - inner class IsDeprecated { - - @Test - fun `should return false if the declaration is not deprecated`() = withCompilationUnit("deprecated") { - val testData = findUniqueDeclarationOrFail("nonDeprecatedFunction") - testData.isDeprecated().shouldBeFalse() - } - - @Test - fun `should return true if the declaration is deprecated`() = withCompilationUnit("deprecated") { - val testData = findUniqueDeclarationOrFail("deprecatedFunction") - testData.isDeprecated().shouldBeTrue() - } - } - - @Nested - inner class IsPure { - - @Test - fun `should return false if the function is not pure`() = withCompilationUnit("pure") { - val testData = findUniqueDeclarationOrFail("impureFunction") - testData.isPure().shouldBeFalse() - } - - @Test - fun `should return true if the function is pure`() = withCompilationUnit("pure") { - val testData = findUniqueDeclarationOrFail("pureFunction") - testData.isPure().shouldBeTrue() - } - } - - @Nested - inner class IsRepeatable { - - @Test - fun `should return false if the annotation is not repeatable`() = withCompilationUnit("repeatable") { - val testData = findUniqueDeclarationOrFail("UnrepeatableAnnotation") - testData.isRepeatable().shouldBeFalse() - } - - @Test - fun `should return true if the annotation is repeatable`() = withCompilationUnit("repeatable") { - val testData = findUniqueDeclarationOrFail("RepeatableAnnotation") - testData.isRepeatable().shouldBeTrue() - } - } - - @Nested - inner class PythonModuleOrNull { - - @Test - fun `should return Python module if it exists and is unique`() = withCompilationUnit("pythonModule") { - pythonModuleOrNull() shouldBe "python_module" - } - - @Test - fun `should return null if Python module is not unique`() = - withCompilationUnit("pythonModuleMultipleAnnotations") { - pythonModuleOrNull().shouldBeNull() - } - - @Test - fun `should return null if compilation unit does not have a Python module`() = - withCompilationUnit("pythonModuleMissing") { - pythonModuleOrNull().shouldBeNull() - } - } - - @Nested - inner class PythonNameOrNull { - - @Test - fun `should return Python name if it exists and is unique`() = withCompilationUnit("pythonName") { - val testData = findUniqueDeclarationOrFail("functionWithUniquePythonName") - testData.pythonNameOrNull() shouldBe "function_with_python_name" - } - - @Test - fun `should return null if Python name is not unique`() = withCompilationUnit("pythonName") { - val testData = findUniqueDeclarationOrFail("functionWithMultiplePythonNames") - testData.pythonNameOrNull().shouldBeNull() - } - - @Test - fun `should return null if compilation unit does not have a Python name`() = withCompilationUnit("pythonName") { - val testData = findUniqueDeclarationOrFail("functionWithoutPythonName") - testData.pythonNameOrNull().shouldBeNull() - } - } - - @Nested - inner class SinceVersionOrNull { - - @Test - fun `should return version if it exists and is unique`() = withCompilationUnit("since") { - val testData = findUniqueDeclarationOrFail("functionWithUniqueSince") - testData.sinceVersionOrNull() shouldBe "1.0.0" - } - - @Test - fun `should return null if version is not unique`() = withCompilationUnit("since") { - val testData = findUniqueDeclarationOrFail("functionWithoutSince") - testData.sinceVersionOrNull().shouldBeNull() - } - - @Test - fun `should return null if declaration does not specify the version it was added`() = - withCompilationUnit("since") { - val testData = findUniqueDeclarationOrFail("functionWithMultipleSinces") - testData.sinceVersionOrNull().shouldBeNull() - } - } - - @Nested - inner class ValidTargets { - - @Test - fun `should return targets if it exists and is unique`() = withCompilationUnit("target") { - val testData = findUniqueDeclarationOrFail("AnnotationWithUniqueTarget") - testData.validTargets().shouldContainExactly(StdlibEnums.AnnotationTarget.Class) - } - - @Test - fun `should return all possible targets if targets is not unique`() = withCompilationUnit("target") { - val testData = findUniqueDeclarationOrFail("AnnotationWithoutTarget") - testData.validTargets() shouldBe StdlibEnums.AnnotationTarget.values() - } - - @Test - fun `should return all possible targets if annotation does not restrict its targets`() = - withCompilationUnit("target") { - val testData = findUniqueDeclarationOrFail("AnnotationWithMultipleTargets") - testData.validTargets() shouldBe StdlibEnums.AnnotationTarget.values() - } - } - - private fun withCompilationUnit(resourceName: String, check: SdsCompilationUnit.() -> Unit) { - parseHelper - .parseResource("$testRoot/$resourceName.${SdsFileExtension.Test}") - .shouldNotBeNull() - .check() - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/testing/TestRangesTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/testing/TestRangesTest.kt deleted file mode 100644 index efa311ee8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/testing/TestRangesTest.kt +++ /dev/null @@ -1,127 +0,0 @@ -package com.larsreimann.safeds.testing - -import com.larsreimann.safeds.location.XtextPosition -import com.larsreimann.safeds.location.XtextRange -import com.larsreimann.safeds.testing.FindTestRangesResult.CloseWithoutOpenFailure -import com.larsreimann.safeds.testing.FindTestRangesResult.OpenWithoutCloseFailure -import com.larsreimann.safeds.testing.FindTestRangesResult.Success -import com.larsreimann.safeds.testing.TestMarker.CLOSE -import com.larsreimann.safeds.testing.TestMarker.OPEN -import io.kotest.matchers.collections.shouldHaveSize -import io.kotest.matchers.shouldBe -import io.kotest.matchers.types.shouldBeInstanceOf -import org.junit.jupiter.api.Test - -class TestRangesTest { - - @Test - fun `should find all ranges enclosed by test markers in order of opening markers`() { - val result = findTestRanges("text${OPEN}text$CLOSE\n${OPEN}text$CLOSE") - result.shouldBeInstanceOf() - result.ranges.shouldHaveSize(2) - - result.ranges[0] shouldBe XtextRange.fromInts( - startLine = 1, - startColumn = 6, - endLine = 1, - endColumn = 10, - length = 4 - ) - - result.ranges[1] shouldBe XtextRange.fromInts( - startLine = 2, - startColumn = 2, - endLine = 2, - endColumn = 6, - length = 4 - ) - } - - @Test - fun `should handle nested test markers`() { - val result = findTestRanges("$OPEN\n $OPEN$CLOSE\n$CLOSE") - result.shouldBeInstanceOf() - result.ranges.shouldHaveSize(2) - - result.ranges[0] shouldBe XtextRange.fromInts( - startLine = 1, - startColumn = 2, - endLine = 3, - endColumn = 1, - length = 8 - ) - - result.ranges[1] shouldBe XtextRange.fromInts( - startLine = 2, - startColumn = 6, - endLine = 2, - endColumn = 6, - length = 0 - ) - } - - @Test - fun `should handle line feed (Unix)`() { - val result = findTestRanges("\n$OPEN\n$CLOSE") - result.shouldBeInstanceOf() - result.ranges.shouldHaveSize(1) - - result.ranges[0] shouldBe XtextRange.fromInts( - startLine = 2, - startColumn = 2, - endLine = 3, - endColumn = 1, - length = 1 - ) - } - - @Test - fun `should handle carriage return (MacOS)`() { - val result = findTestRanges("\r$OPEN\r$CLOSE") - result.shouldBeInstanceOf() - result.ranges.shouldHaveSize(1) - - result.ranges[0] shouldBe XtextRange.fromInts( - startLine = 2, - startColumn = 2, - endLine = 3, - endColumn = 1, - length = 1 - ) - } - - @Test - fun `should handle carriage return + line feed (Windows)`() { - val result = findTestRanges("\r\n$OPEN\r\n$CLOSE") - result.shouldBeInstanceOf() - result.ranges.shouldHaveSize(1) - - result.ranges[0] shouldBe XtextRange.fromInts( - startLine = 2, - startColumn = 2, - endLine = 3, - endColumn = 1, - length = 2 - ) - } - - @Test - fun `should report closing test markers without matching opening test marker`() { - val result = findTestRanges("$OPEN\n$CLOSE$CLOSE") - result.shouldBeInstanceOf() - result.position shouldBe XtextPosition.fromInts(line = 2, column = 2) - result.message shouldBe "Found '$CLOSE' without previous '$OPEN' at 2:2." - } - - @Test - fun `should report opening test markers without matching closing test marker`() { - val result = findTestRanges("$OPEN\n$OPEN$OPEN$CLOSE") - result.shouldBeInstanceOf() - - result.positions.shouldHaveSize(2) - result.positions[0] shouldBe XtextPosition.fromInts(line = 1, column = 1) - result.positions[1] shouldBe XtextPosition.fromInts(line = 2, column = 1) - - result.message shouldBe "Found '$OPEN' without following '$CLOSE' at 1:1, 2:1." - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/utils/CollectionUtilsTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/utils/CollectionUtilsTest.kt deleted file mode 100644 index 0eafacc80..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/utils/CollectionUtilsTest.kt +++ /dev/null @@ -1,94 +0,0 @@ -package com.larsreimann.safeds.utils - -import io.kotest.matchers.collections.shouldContainExactly -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.shouldBe -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test - -class CollectionUtilsTest { - - @Nested - inner class DuplicatesBy { - - @Test - fun `should keep only elements that are mapped to same non-null label as other element`() { - val actualResult = listOf(1, 1, 2, null).duplicatesBy { element -> element?.let { it + 1 } } - actualResult.shouldContainExactly(1, 1) - } - } - - @Nested - inner class UniqueBy { - - @Test - fun `should keep only elements that are mapped to unique non-null label`() { - val actualResult = listOf(1, 1, 2, null).uniqueBy { element -> element?.let { it + 1 } } - actualResult.shouldContainExactly(2) - } - } - - @Nested - inner class UniqueOrNull { - - @Test - fun `should return the sole element of the list if no filter is provided`() { - listOf(1).uniqueOrNull() shouldBe 1 - } - - @Test - fun `should return null if the list is empty and no filter is provided`() { - emptyList().uniqueOrNull().shouldBeNull() - } - - @Test - fun `should return null if the list has multiple elements and no filter is provided`() { - listOf(1, 2).uniqueOrNull().shouldBeNull() - } - - @Test - fun `should return the unique element that matches the filter`() { - listOf(1, 2).uniqueOrNull { it < 2 } shouldBe 1 - } - - @Test - fun `should return null if no element matches the filter`() { - listOf(1, 2).uniqueOrNull { it < 1 }.shouldBeNull() - } - - @Test - fun `should return null if multiple elements match the filter`() { - listOf(1, 2).uniqueOrNull { true }.shouldBeNull() - } - } - - @Nested - inner class NullIfEmptyElse { - - @Test - fun `should return null if the list is empty`() { - emptyList().nullIfEmptyElse { it }.shouldBeNull() - } - - @Test - fun `should call the initializer if the list is not empty`() { - listOf(1, 2, 3).nullIfEmptyElse { list -> list.map { it + 1 } }.shouldContainExactly(2, 3, 4) - } - } - - @Nested - inner class OuterZipBy { - - @Test - fun `should zip the two lists while padding the shorter list with nulls at the end (left shorter)`() { - val actualResult = outerZipBy(listOf(3), listOf(1, 2)) { a, b -> a to b } - actualResult.shouldContainExactly(3 to 1, null to 2) - } - - @Test - fun `should zip the two lists while padding the shorter list with nulls at the end (right shorter)`() { - val actualResult = outerZipBy(listOf(1, 2), listOf(3)) { a, b -> a to b } - actualResult.shouldContainExactly(1 to 3, 2 to null) - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/utils/IdManagerTest.kt b/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/utils/IdManagerTest.kt deleted file mode 100644 index 60bb50667..000000000 --- a/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/utils/IdManagerTest.kt +++ /dev/null @@ -1,112 +0,0 @@ -package com.larsreimann.safeds.utils - -import io.kotest.matchers.booleans.shouldBeFalse -import io.kotest.matchers.booleans.shouldBeTrue -import io.kotest.matchers.nulls.shouldBeNull -import io.kotest.matchers.shouldBe -import io.kotest.matchers.shouldNotBe -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test - -class IdManagerTest { - - class TestClass - - private lateinit var idManager: IdManager - - @BeforeEach - fun reset() { - idManager = IdManager() - } - - @Nested - inner class AssignIdIfAbsent { - - @Test - fun `should return a new unique ID for an unseen object`() { - val firstObject = TestClass() - val secondObject = TestClass() - - idManager.assignIdIfAbsent(firstObject) shouldNotBe idManager.assignIdIfAbsent(secondObject) - } - - @Test - fun `should return the same ID for the same object`() { - val obj = TestClass() - - idManager.assignIdIfAbsent(obj) shouldBe idManager.assignIdIfAbsent(obj) - } - } - - @Nested - inner class GetObjectById { - - @Test - fun `should return the object with the given ID if it exists`() { - val obj = TestClass() - val id = idManager.assignIdIfAbsent(obj) - - idManager.getObjectById(id) shouldBe obj - } - - @Test - fun `should return null if no object with the given ID exists`() { - idManager.getObjectById(Id(10)).shouldBeNull() - } - } - - @Nested - inner class KnowsObject { - - @Test - fun `should return whether an ID has been assigned to this object`() { - val firstObject = TestClass() - val secondObject = TestClass() - idManager.assignIdIfAbsent(firstObject) - - idManager.knowsObject(firstObject).shouldBeTrue() - idManager.knowsObject(secondObject).shouldBeFalse() - } - } - - @Nested - inner class KnowsId { - - @Test - fun `should return whether an ID is in use`() { - val obj = TestClass() - val id = idManager.assignIdIfAbsent(obj) - - idManager.knowsId(id).shouldBeTrue() - idManager.knowsId(Id(10)).shouldBeFalse() - } - } - - @Nested - inner class Reset { - - @Test - fun `should clear all mappings from object to ID`() { - val obj = TestClass() - val id = idManager.assignIdIfAbsent(obj) - - idManager.reset() - - idManager.knowsObject(obj).shouldBeFalse() - idManager.knowsId(id).shouldBeFalse() - } - - @Test - fun `should reset the counter`() { - val obj = TestClass() - val idBeforeClear = idManager.assignIdIfAbsent(obj) - - idManager.reset() - - val idAfterClear = idManager.assignIdIfAbsent(obj) - - idBeforeClear shouldBe idAfterClear - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/conversion/idValueConverter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/conversion/idValueConverter.sdstest deleted file mode 100644 index cb379ba8b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/conversion/idValueConverter.sdstest +++ /dev/null @@ -1 +0,0 @@ -class `class` diff --git a/DSL/com.larsreimann.safeds/src/test/resources/conversion/intValueConverter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/conversion/intValueConverter.sdstest deleted file mode 100644 index f785a6850..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/conversion/intValueConverter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -pipeline templateStringParts { - 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/conversion/qualifiedNameValueConverter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/conversion/qualifiedNameValueConverter.sdstest deleted file mode 100644 index b8e2c45b7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/conversion/qualifiedNameValueConverter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package safeds.`package` - -import safeds.`package`.* diff --git a/DSL/com.larsreimann.safeds/src/test/resources/conversion/stringValueConverter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/conversion/stringValueConverter.sdstest deleted file mode 100644 index 651c95e53..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/conversion/stringValueConverter.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -pipeline escapedOpeningBrace { - "\{"; -} - -pipeline unescapedOpeningBrace { - "{"; -} - -pipeline escapedSingleQuote { - "\'"; -} - -pipeline unescapedSingleQuote { - "'"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/conversion/templateStringPartValueConverter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/conversion/templateStringPartValueConverter.sdstest deleted file mode 100644 index 3eacc4279..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/conversion/templateStringPartValueConverter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -pipeline templateStringParts { - "start{{ 1 }}inner{{ 1 }}end"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/compilationUnits/empty.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/compilationUnits/empty.sdstest deleted file mode 100644 index 8ca91d28a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/compilationUnits/empty.sdstest +++ /dev/null @@ -1,2 +0,0 @@ - -// ----------------------------------------------------------------------------- diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/compilationUnits/withoutPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/compilationUnits/withoutPackage.sdstest deleted file mode 100644 index d4375c9a2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/compilationUnits/withoutPackage.sdstest +++ /dev/null @@ -1,14 +0,0 @@ - pipeline p1 { } pipeline p2 {} -pipeline p3 { - - - -} - -// ----------------------------------------------------------------------------- - -pipeline p1 {} - -pipeline p2 {} - -pipeline p3 {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotation.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotation.sdstest deleted file mode 100644 index 686babe80..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotation.sdstest +++ /dev/null @@ -1,23 +0,0 @@ - annotation MyAnnotation1 - - @Annotation1 @Annotation2 - annotation MyAnnotation2 - ( @AnnotationUse a : Int - , vararg b : Int - = 3 ) - - constraint { T2 super -Number , -T3 sub Number - - } -// ----------------------------------------------------------------------------- - -annotation MyAnnotation1 - -@Annotation1 -@Annotation2 -annotation MyAnnotation2(@AnnotationUse a: Int, vararg b: Int = 3) constraint { - T2 super Number, - T3 sub Number -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotationCall on compilation unit.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotationCall on compilation unit.sdstest deleted file mode 100644 index 80e8ad82d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotationCall on compilation unit.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -@ AnnotationUse ( 1 , b = 2 ) -class MyClass - -// ----------------------------------------------------------------------------- - -@AnnotationUse(1, b = 2) - -class MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotationCall on declaration.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotationCall on declaration.sdstest deleted file mode 100644 index e3bb9b6de..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/annotationCall on declaration.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package test - -@ AnnotationUse ( 1 , b = 2 ) -class MyClass - -// ----------------------------------------------------------------------------- - -package test - -@AnnotationUse(1, b = 2) -class MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/attribute.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/attribute.sdstest deleted file mode 100644 index 4256969b0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/attribute.sdstest +++ /dev/null @@ -1,32 +0,0 @@ -class MyClass { - attr myAttribute1 - - @Annotation1 - @Annotation2 - attr - myAttribute2 : Int - - static - attr myAttribute3 : Int - - @Annotation1 - @Annotation2 - static - attr myAttribute4 : Int -} - -// ----------------------------------------------------------------------------- - -class MyClass { - attr myAttribute1 - - @Annotation1 - @Annotation2 - attr myAttribute2: Int - - static attr myAttribute3: Int - - @Annotation1 - @Annotation2 - static attr myAttribute4: Int -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/class.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/class.sdstest deleted file mode 100644 index b78122830..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/class.sdstest +++ /dev/null @@ -1,38 +0,0 @@ - class - MyClass1 - - class MyClass2 { } - - @Annotation1 @Annotation2 class MyClass3 - < @AnnotationUse - T1 , in - T2 , out T3, T4 :: $SchemaType, T5 :: $ExpressionType , - T6 :: $BooleanType , T7 :: $NamedType > - ( - @AnnotationUse - a : - Int , vararg b : Int - = 3 ) sub SuperClass , SuperInterface - { constraint { T2 super Number , T3 sub - Number } - attr myAttribute1 attr myAttribute2 -} - -// ----------------------------------------------------------------------------- - -class MyClass1 - -class MyClass2 {} - -@Annotation1 -@Annotation2 -class MyClass3<@AnnotationUse T1, in T2, out T3, T4 :: $SchemaType, T5 :: $ExpressionType, T6 :: $BooleanType, T7 :: $NamedType>(@AnnotationUse a: Int, vararg b: Int = 3) sub SuperClass, SuperInterface { - constraint { - T2 super Number, - T3 sub Number - } - - attr myAttribute1 - - attr myAttribute2 -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/enum.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/enum.sdstest deleted file mode 100644 index 93ab3f6d8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/enum.sdstest +++ /dev/null @@ -1,24 +0,0 @@ -enum myEnum1 - - - enum myEnum2 { - } - -@Annotation1 @Annotation2 enum - myEnum3 { MyVariant1 - MyVariant2 - } - -// ----------------------------------------------------------------------------- - -enum myEnum1 - -enum myEnum2 {} - -@Annotation1 -@Annotation2 -enum myEnum3 { - MyVariant1 - - MyVariant2 -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/enumVariant.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/enumVariant.sdstest deleted file mode 100644 index cfae6709f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/enumVariant.sdstest +++ /dev/null @@ -1,38 +0,0 @@ -enum myEnum { - MyVariant1 - - - - @Annotation1 @Annotation2 - MyVariant2 < - @AnnotationUse - - T1, in T2, out - T3 > - ( - - @AnnotationUse - a : - Int , vararg - - b: - Int = 3 - ) constraint - { T2 - super Number , T3 sub - Number - } -} - -// ----------------------------------------------------------------------------- - -enum myEnum { - MyVariant1 - - @Annotation1 - @Annotation2 - MyVariant2<@AnnotationUse T1, in T2, out T3>(@AnnotationUse a: Int, vararg b: Int = 3) constraint { - T2 super Number, - T3 sub Number - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/function.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/function.sdstest deleted file mode 100644 index 7c279c53e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/function.sdstest +++ /dev/null @@ -1,69 +0,0 @@ -fun myFunction1 - ( ) - -@Annotation1 @Annotation2 fun - myFunction2 - < - @AnnotationUse - T1 , in - T2 , out T3 - >( @AnnotationUse - a : Int , vararg - b : Int = - 3 ) -> - ( - @AnnotationUse a : - Int , b : Int ) { constraint { - T2 super Number , T3 sub Number - } - } -class MyClass { - fun - myFunction1 ( - - - ) @Annotation1 @Annotation2 - - fun - myFunction2 ( ) --> - a : - Int - - - static - - fun myFunction3 ( ) @Annotation1 @Annotation2 static - - fun - myFunction4( - - ) -} - -// ----------------------------------------------------------------------------- - -fun myFunction1() - -@Annotation1 -@Annotation2 -fun myFunction2<@AnnotationUse T1, in T2, out T3>(@AnnotationUse a: Int, vararg b: Int = 3) -> (@AnnotationUse a: Int, b: Int) { - constraint { - T2 super Number, - T3 sub Number - } -} - -class MyClass { - fun myFunction1() - - @Annotation1 - @Annotation2 - fun myFunction2() -> a: Int - - static fun myFunction3() - - @Annotation1 - @Annotation2 - static fun myFunction4() -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/import.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/import.sdstest deleted file mode 100644 index c3d8ff7e3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/import.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -import tests . formatting as format import tests.formatting2 as format2 -import tests.formatting3 as format3 - -import tests . formatting4 import tests.formatting5 -import tests.formatting6 - -// ----------------------------------------------------------------------------- - -import tests.formatting as format -import tests.formatting2 as format2 -import tests.formatting3 as format3 -import tests.formatting4 -import tests.formatting5 -import tests.formatting6 diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/annotationUsesWithImports.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/annotationUsesWithImports.sdstest deleted file mode 100644 index db5683ea4..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/annotationUsesWithImports.sdstest +++ /dev/null @@ -1,11 +0,0 @@ - @AnnotationUse1 - - @AnnotationUse2 - import myPackage . MyClass - -// ----------------------------------------------------------------------------- - -@AnnotationUse1 -@AnnotationUse2 - -import myPackage.MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/annotationUsesWithName.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/annotationUsesWithName.sdstest deleted file mode 100644 index 21862115d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/annotationUsesWithName.sdstest +++ /dev/null @@ -1,11 +0,0 @@ - @AnnotationUse1 - - @AnnotationUse2 - package tests . formatting - -// ----------------------------------------------------------------------------- - -@AnnotationUse1 -@AnnotationUse2 - -package tests.formatting diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/full.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/full.sdstest deleted file mode 100644 index 6e25aea3c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/full.sdstest +++ /dev/null @@ -1,36 +0,0 @@ - - @AnnotationUse1 - - - @AnnotationUse2 - - package tests . formatting - - - import tests . formatting1 import tests.formatting2 -import tests.formatting3 - - - pipeline p1 { } pipeline p2 {} -pipeline p3 { - - - -} - -// ----------------------------------------------------------------------------- - -@AnnotationUse1 -@AnnotationUse2 - -package tests.formatting - -import tests.formatting1 -import tests.formatting2 -import tests.formatting3 - -pipeline p1 {} - -pipeline p2 {} - -pipeline p3 {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/importsAndMembers.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/importsAndMembers.sdstest deleted file mode 100644 index d7b52da5a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/importsAndMembers.sdstest +++ /dev/null @@ -1,22 +0,0 @@ - import tests . formatting1 import tests.formatting2 -import tests.formatting3 - - - pipeline p1 { } pipeline p2 {} -pipeline p3 { - - - -} - -// ----------------------------------------------------------------------------- - -import tests.formatting1 -import tests.formatting2 -import tests.formatting3 - -pipeline p1 {} - -pipeline p2 {} - -pipeline p3 {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/nameAndMembers.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/nameAndMembers.sdstest deleted file mode 100644 index a7c48b5e9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/packages/nameAndMembers.sdstest +++ /dev/null @@ -1,19 +0,0 @@ - package tests . formatting - - - pipeline p1 { } pipeline p2 {} -pipeline p3 { - - - -} - -// ----------------------------------------------------------------------------- - -package tests.formatting - -pipeline p1 {} - -pipeline p2 {} - -pipeline p3 {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/pipeline.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/pipeline.sdstest deleted file mode 100644 index 67fddd80e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/pipeline.sdstest +++ /dev/null @@ -1,17 +0,0 @@ - pipeline myPipeline1 {} - - - - @Annotation1 @Annotation2 pipeline myPipeline2 { - val a = 1; - } - -// ----------------------------------------------------------------------------- - -pipeline myPipeline1 {} - -@Annotation1 -@Annotation2 -pipeline myPipeline2 { - val a = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/predicates.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/predicates.sdstest deleted file mode 100644 index bb5be1fe9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/predicates.sdstest +++ /dev/null @@ -1,21 +0,0 @@ - predicate myPredicate1 ( a : Int , - vararg b - : Int = - 3) { } - - - @Annotation1 @Annotation2 - predicate myPredicate2 () { - goal1() , goal2() - } - -// ----------------------------------------------------------------------------- - -predicate myPredicate1(a: Int, vararg b: Int = 3) {} - -@Annotation1 -@Annotation2 -predicate myPredicate2() { - goal1(), - goal2() -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/alternative.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/alternative.sdstest deleted file mode 100644 index a68c91ad3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/alternative.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -class C { - protocol { - f|g -| - - ( h ) - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - f | g | (h) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/body.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/body.sdstest deleted file mode 100644 index ec1233ea5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/body.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -class C { - protocol { - subterm term1 = f; subterm term2 = g; -subterm term3 = h; - f g - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - subterm term1 = f; - subterm term2 = g; - subterm term3 = h; - - f g - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/complement.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/complement.sdstest deleted file mode 100644 index 940e97999..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/complement.sdstest +++ /dev/null @@ -1,22 +0,0 @@ -class C { - protocol { - [ ^ - ] [ ^ f g - -] [ . ^ f - h ] [ \a ^ - a b ] [ \f -^ - f - h -] - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - [^] [^ f g] [.^ f h] [\a^ a b] [\f^ f h] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/empty.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/empty.sdstest deleted file mode 100644 index c154c9804..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/empty.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class C { - protocol { - - - - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol {} -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/full.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/full.sdstest deleted file mode 100644 index 16cbdf4ab..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/full.sdstest +++ /dev/null @@ -1,30 +0,0 @@ -class C { - protocol { - subterm - - term1 - = f ; subterm term2 - = g - ; - f - ( - - ( - g h -) | ( - i j - ) ) ? [ . ^ - k -] -} } - -// ----------------------------------------------------------------------------- - -class C { - protocol { - subterm term1 = f; - subterm term2 = g; - - f ((g h) | (i j))? [.^ k] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/parenthesizedTerm.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/parenthesizedTerm.sdstest deleted file mode 100644 index 9b4fda027..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/parenthesizedTerm.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -class C { - protocol { - ( f - g - ) - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - (f g) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/protocols and members in one class.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/protocols and members in one class.sdstest deleted file mode 100644 index bcf984405..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/protocols and members in one class.sdstest +++ /dev/null @@ -1,24 +0,0 @@ -class C { - attr a: Int protocol - { - - } fun f() - - protocol - - { - -} -} - -// ----------------------------------------------------------------------------- - -class C { - attr a: Int - - protocol {} - - fun f() - - protocol {} -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/quantifiedTerm.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/quantifiedTerm.sdstest deleted file mode 100644 index 9142767f9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/quantifiedTerm.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -class C { - protocol { - . ? . * ( f ) + - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - .? .* (f)+ - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/sequence.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/sequence.sdstest deleted file mode 100644 index 5de7616ef..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/sequence.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -class C { - protocol { - f - g ( h ) - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - f g (h) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/subterm.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/subterm.sdstest deleted file mode 100644 index d0da82f42..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/subterm.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -class C { - protocol { - subterm - - term1 - = f; - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - subterm term1 = f; - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/subtermList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/subtermList.sdstest deleted file mode 100644 index 335553c53..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/protocols/subtermList.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -class C { - protocol { - subterm term1 = f; subterm term2 = g; - - - subterm term3 = h; - - } -} - -// ----------------------------------------------------------------------------- - -class C { - protocol { - subterm term1 = f; - subterm term2 = g; - subterm term3 = h; - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/step.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/step.sdstest deleted file mode 100644 index 828c556ce..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/declarations/step.sdstest +++ /dev/null @@ -1,29 +0,0 @@ -step myStep1 ( - -) { } - -internal step myStep2 ( ) { } - -@Annotation1 - @Annotation2 private step - myStep3 - ( a : Int , b : Int - - ) - -> ( - a: - Int , b : Int ) - { - val a = 1; } - -// ----------------------------------------------------------------------------- - -step myStep1() {} - -internal step myStep2() {} - -@Annotation1 -@Annotation2 -private step myStep3(a: Int, b: Int) -> (a: Int, b: Int) { - val a = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/blockLambda.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/blockLambda.sdstest deleted file mode 100644 index 806d47d65..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/blockLambda.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -pipeline myPipeline { - () { - - }; - ( a - , vararg b - = 1 ) - { - val a = 1; }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - () {}; - (a, vararg b = 1) { - val a = 1; - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/call.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/call.sdstest deleted file mode 100644 index ad9d5b629..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/call.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -pipeline myPipeline { - f ( ) ; - f < * , - in Number , out - Number , T = - Number > ( 1 - , b = 2 - ); -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - f(); - f<*, in Number, out Number, T = Number>(1, b = 2); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/expressionLambda.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/expressionLambda.sdstest deleted file mode 100644 index e6b1b2dbf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/expressionLambda.sdstest +++ /dev/null @@ -1,18 +0,0 @@ -pipeline myPipeline { - () -> - - 1; - ( a - , - vararg b = - 1 ) - -> - 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - () -> 1; - (a, vararg b = 1) -> 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/indexedAccess.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/indexedAccess.sdstest deleted file mode 100644 index c602713da..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/indexedAccess.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - a [ 1 ]; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - a[1]; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/infixOperations.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/infixOperations.sdstest deleted file mode 100644 index 095e26daf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/infixOperations.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -pipeline myPipeline { - true and false; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - true and false; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/memberAccess.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/memberAccess.sdstest deleted file mode 100644 index a631162d0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/memberAccess.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - a . member; - a ? . member; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - a.member; - a?.member; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/parenthesizedExpression.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/parenthesizedExpression.sdstest deleted file mode 100644 index e9b6d3f97..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/parenthesizedExpression.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -pipeline myPipeline { - ( 1 - ); - ( true ) or false; - not ( true ); - ( f - )(( 3 )); - ( c ).member; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - (1); - (true) or false; - not (true); - (f)((3)); - (c).member; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/prefixOperations.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/prefixOperations.sdstest deleted file mode 100644 index e42bc552b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/prefixOperations.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -pipeline myPipeline { - not true and not false; - - 1; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - not true and not false; - -1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/templateString.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/templateString.sdstest deleted file mode 100644 index b367f5f4f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/expressions/templateString.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -pipeline myPipeline { - "template {{ - - a - - }}"; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - "template {{ a }}"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/schema/schema.sdsschema b/DSL/com.larsreimann.safeds/src/test/resources/formatting/schema/schema.sdsschema deleted file mode 100644 index 49cc94233..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/schema/schema.sdsschema +++ /dev/null @@ -1,16 +0,0 @@ -schema - - MySchema - - { - - "column name1" : ColumnType1 , "column name2": ColumnType2? , - "column name3" :ColumnType3 } - -// ----------------------------------------------------------------------------- - -schema MySchema { - "column name1" : ColumnType1, - "column name2" : ColumnType2?, - "column name3" : ColumnType3 -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/assignment.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/assignment.sdstest deleted file mode 100644 index e9921f14a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/assignment.sdstest +++ /dev/null @@ -1,25 +0,0 @@ -pipeline myPipeline { - val - a = 0 ; - val a , _ , yield b = call() ; - () { - val a - = 0 ; - - - - val a, _ , yield b = - call() ; - }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - val a = 0; - val a, _, yield b = call(); - () { - val a = 0; - val a, _, yield b = call(); - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/blocks.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/blocks.sdstest deleted file mode 100644 index b06f88184..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/blocks.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -pipeline myPipeline { -val a = 1; val b = 2; - val c = 54; - } - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - val a = 1; - val b = 2; - val c = 54; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/expressionStatement.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/expressionStatement.sdstest deleted file mode 100644 index bb5e54049..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/expressionStatement.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -pipeline myPipeline { - call() - ; - () { - call() ; - }; -} - -// ----------------------------------------------------------------------------- - -pipeline myPipeline { - call(); - () { - call(); - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/goalAssignment.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/goalAssignment.sdstest deleted file mode 100644 index c85dba68a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/statements/goalAssignment.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -predicate myPredicate() -> ::Schema { - val - - intermediate1 = goal1(arg1 , arg2), - goal2(arg3 , arg4) -} -// ----------------------------------------------------------------------------- - -predicate myPredicate() -> ::Schema { - val intermediate1 = goal1(arg1, arg2), - goal2(arg3, arg4) -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/callableType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/callableType.sdstest deleted file mode 100644 index 0794a3c78..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/callableType.sdstest +++ /dev/null @@ -1,20 +0,0 @@ -step s1(f: ( ) - -> ( )) {} - -step s2(f: ( ) -> -result : Int ) {} - -step s3(f: - ( @AnnotationUse a - : Int , vararg b : - Int = 3 ) -> ( - @AnnotationUse a - : Int , b : Int )) {} - -// ----------------------------------------------------------------------------- - -step s1(f: () -> ()) {} - -step s2(f: () -> result: Int) {} - -step s3(f: (@AnnotationUse a: Int, vararg b: Int = 3) -> (@AnnotationUse a: Int, b: Int)) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/memberType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/memberType.sdstest deleted file mode 100644 index 3ad489e72..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/memberType.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -step s1(f: OuterClass . InnerClass) {} - -step s2(f: OuterClass ? -. MiddleClass < C , - D > ?) {} - -// ----------------------------------------------------------------------------- - -step s1(f: OuterClass.InnerClass) {} - -step s2(f: OuterClass?.MiddleClass?) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/namedType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/namedType.sdstest deleted file mode 100644 index 224d61798..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/namedType.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -step s1(f: Int) {} - -step s2(f: Int < * - , in Number - , out Number , T = - Number > ? ) {} - -// ----------------------------------------------------------------------------- - -step s1(f: Int) {} - -step s2(f: Int<*, in Number, out Number, T = Number>?) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/parenthesizedType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/parenthesizedType.sdstest deleted file mode 100644 index 99a2029b0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/parenthesizedType.sdstest +++ /dev/null @@ -1,23 +0,0 @@ -class C sub ( Int ) { - constraint - { T - sub ( - Int ) } - attr a: ( Int ) -} - -step s(p1: ( Int -), p2: union<( Int )>) -> r: ( - Int ) {} - -// ----------------------------------------------------------------------------- - -class C sub (Int) { - constraint { - T sub (Int) - } - - attr a: (Int) -} - -step s(p1: (Int), p2: union<(Int)>) -> r: (Int) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/unionType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/unionType.sdstest deleted file mode 100644 index a4553e121..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/formatting/types/unionType.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -step s1(f: union < >) {} - -step s2(f: union < - Int , - Float >) {} - -// ----------------------------------------------------------------------------- - -step s1(f: union<>) {} - -step s2(f: union) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/input.sdstest deleted file mode 100644 index bae28156d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/input.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.generator.emptyPipeline - -pipeline test {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/output/tests/generator/emptyPipeline/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/output/tests/generator/emptyPipeline/gen_input.py deleted file mode 100644 index a90185019..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/output/tests/generator/emptyPipeline/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - pass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/output/tests/generator/emptyPipeline/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/output/tests/generator/emptyPipeline/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty pipeline/output/tests/generator/emptyPipeline/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty step/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty step/input.sdstest deleted file mode 100644 index 08ac85c3e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty step/input.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.generator.emptyStep - -step test() {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty step/output/tests/generator/emptyStep/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty step/output/tests/generator/emptyStep/gen_input.py deleted file mode 100644 index 7a62d7d3c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/empty step/output/tests/generator/emptyStep/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def test(): - pass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/parameter with python name/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/parameter with python name/input.sdstest deleted file mode 100644 index 67311a1fe..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/parameter with python name/input.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -package tests.generator.parameterWithPythonName - -fun f1(param: (a: Int, b: Int, c: Int) -> r: Int) -fun f2(param: (a: Int, b: Int, c: Int) -> ()) - -step test1(param1: Int, @PythonName("param_2") param2: Int, @PythonName("param_3") param3: Int = 0) { - f1((param1: Int, @PythonName("param_2") param2: Int, @PythonName("param_3") param3: Int = 0) -> 1); - f2((param1: Int, @PythonName("param_2") param2: Int, @PythonName("param_3") param3: Int = 0) {}); -} - -step test2(param1: Int, @PythonName("param_2") param2: Int, @PythonName("param_4") vararg param4: Int) { - f1((param1: Int, @PythonName("param_2") param2: Int, @PythonName("param_4") vararg param4: Int) -> 1); - f2((param1: Int, @PythonName("param_2") param2: Int, @PythonName("param_4") vararg param4: Int) {}); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/parameter with python name/output/tests/generator/parameterWithPythonName/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/parameter with python name/output/tests/generator/parameterWithPythonName/gen_input.py deleted file mode 100644 index 5a04fef8f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/parameter with python name/output/tests/generator/parameterWithPythonName/gen_input.py +++ /dev/null @@ -1,13 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def test1(param1, param_2, param_3=0): - f1(lambda param1, param_2, param_3=0: 1) - def __block_lambda_0(param1, param_2, param_3=0): - pass - f2(__block_lambda_0) - -def test2(param1, param_2, *param_4): - f1(lambda param1, param_2, *param_4: 1) - def __block_lambda_0(param1, param_2, *param_4): - pass - f2(__block_lambda_0) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/input.sdstest deleted file mode 100644 index 785110a0e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/input.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.generator.pipelineWithPythonName - -fun f() - -@PythonName("test_pipeline") -pipeline testPipeline { - f(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/output/tests/generator/pipelineWithPythonName/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/output/tests/generator/pipelineWithPythonName/gen_input.py deleted file mode 100644 index 209629e85..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/output/tests/generator/pipelineWithPythonName/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test_pipeline(): - f() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/output/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/output/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py deleted file mode 100644 index dd260d08e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/pipeline with python name/output/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test_pipeline - -if __name__ == '__main__': - test_pipeline() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/step with python name/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/step with python name/input.sdstest deleted file mode 100644 index 52ec22bfb..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/step with python name/input.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.generator.stepWithPythonName - -fun f() - -@PythonName("test_step") -step testStep() { - f(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/step with python name/output/tests/generator/stepWithPythonName/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/step with python name/output/tests/generator/stepWithPythonName/gen_input.py deleted file mode 100644 index 26cbaeb4d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/step with python name/output/tests/generator/stepWithPythonName/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def test_step(): - f() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/input.sdstest deleted file mode 100644 index 1c275d268..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/input.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package tests.generator.twoPipelines - -fun f() - -pipeline test1 { - f(); -} - -pipeline test2 { - f(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input.py deleted file mode 100644 index a8efe6ddd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input.py +++ /dev/null @@ -1,7 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test1(): - f() - -def test2(): - f() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input_test1.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input_test1.py deleted file mode 100644 index d4cb15745..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input_test1.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test1 - -if __name__ == '__main__': - test1() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input_test2.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input_test2.py deleted file mode 100644 index 96daa0217..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two pipelines/output/tests/generator/twoPipelines/gen_input_test2.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test2 - -if __name__ == '__main__': - test2() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two steps/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two steps/input.sdstest deleted file mode 100644 index 024d67dbe..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two steps/input.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package tests.generator.twoSteps - -fun f() - -step test1(a: Int, b: Int = 0) { - f(); -} - -step test2(a: Int, vararg c: Int) { - f(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two steps/output/tests/generator/twoSteps/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two steps/output/tests/generator/twoSteps/gen_input.py deleted file mode 100644 index bb0c1f51b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/declarations/two steps/output/tests/generator/twoSteps/gen_input.py +++ /dev/null @@ -1,7 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def test1(a, b=0): - f() - -def test2(a, *c): - f() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/input.sdstest deleted file mode 100644 index 6105b6ad0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/input.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -package tests.generator.blockLambda - -fun f1(param: (a: Int, b: Int) -> r: Int) -fun f2(param: (a: Int, vararg b: Int) -> r: Int) -fun f3(param: () -> ()) - -fun g() -> a: Int - -pipeline test { - f1((a: Int, b: Int = 2) { - yield d = g(); - }); - f2((a: Int, vararg c: Int) { - yield d = g(); - }); - f3(() {}); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/output/tests/generator/blockLambda/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/output/tests/generator/blockLambda/gen_input.py deleted file mode 100644 index 57e2b1fcf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/output/tests/generator/blockLambda/gen_input.py +++ /dev/null @@ -1,14 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - def __block_lambda_0(a, b=2): - d = g() - return d - f1(__block_lambda_0) - def __block_lambda_1(a, *c): - d = g() - return d - f2(__block_lambda_1) - def __block_lambda_2(): - pass - f3(__block_lambda_2) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/output/tests/generator/blockLambda/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/output/tests/generator/blockLambda/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/block lambda/output/tests/generator/blockLambda/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/input.sdstest deleted file mode 100644 index 655b2e2a7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/input.sdstest +++ /dev/null @@ -1,32 +0,0 @@ -package tests.generator.call - -fun f(param: Any?) - -fun g1( - param1: Int, - param2: Int = 0 -) -> result: Boolean - -fun g2( - param1: Int, - vararg param3: Int -) -> result: Boolean - -fun h1( - @PythonName("param_1") param1: Int, - @PythonName("param_2") param2: Int = 0 -) -> result: Boolean - -fun h2( - @PythonName("param_1") param1: Int, - @PythonName("param_3") vararg param3: Int -) -> result: Boolean - -pipeline test { - f((g1(1, 2))); - f((g1(param2 = 1, param1 = 2))); - f((g2(2, 3, 4))); - f((h1(1, 2))); - f((h1(param2 = 1, param1 = 2))); - f((h2(2, 3, 4))); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/output/tests/generator/call/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/output/tests/generator/call/gen_input.py deleted file mode 100644 index 37634f44a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/output/tests/generator/call/gen_input.py +++ /dev/null @@ -1,9 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(g1(1, param2=2)) - f(g1(2, param2=1)) - f(g2(2, 3, 4)) - f(h1(1, param_2=2)) - f(h1(2, param_2=1)) - f(h2(2, 3, 4)) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/output/tests/generator/call/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/output/tests/generator/call/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/call/output/tests/generator/call/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/input.sdstest deleted file mode 100644 index 3b4e0e978..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/input.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package tests.generator.constant - -fun f(param: Any?) - -pipeline test { - f(1 < 2); - f(1.0 - 1.0); - f(1 + 1); - f(null); - f("person: {{ "me" }}"); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/output/tests/generator/constant/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/output/tests/generator/constant/gen_input.py deleted file mode 100644 index 6f2601b01..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/output/tests/generator/constant/gen_input.py +++ /dev/null @@ -1,8 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(True) - f(0.0) - f(2) - f(None) - f('person: me') diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/output/tests/generator/constant/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/output/tests/generator/constant/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/constant/output/tests/generator/constant/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/input.sdstest deleted file mode 100644 index d113a4972..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/input.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -// Related to https://github.com/lars-reimann/Safe-DS/issues/118 - -package tests.generator.enumVariantCall - -fun f(p: Any) - -enum MyEnum { - Variant1 - Variant2(counter: Int) -} - -pipeline test { - f(MyEnum.Variant1); - f(MyEnum.Variant1()); - f(MyEnum.Variant2(1)); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/output/tests/generator/enumVariantCall/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/output/tests/generator/enumVariantCall/gen_input.py deleted file mode 100644 index 1a9a4f9d8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/output/tests/generator/enumVariantCall/gen_input.py +++ /dev/null @@ -1,6 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(MyEnum.Variant1()) - f(MyEnum.Variant1()) - f(MyEnum.Variant2(1)) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/output/tests/generator/enumVariantCall/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/output/tests/generator/enumVariantCall/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/enum variant call/output/tests/generator/enumVariantCall/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/input.sdstest deleted file mode 100644 index 6d49a6ce7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/input.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package tests.generator.expressionLambda - -fun f1(param: (a: Int, b: Int) -> r: Int) -fun f2(param: (a: Int, vararg c: Int) -> r: Int) - -pipeline test { - f1((a, b = 2) -> 1); - f2((a, vararg c) -> 1); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/output/tests/generator/expressionLambda/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/output/tests/generator/expressionLambda/gen_input.py deleted file mode 100644 index 9399f7d79..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/output/tests/generator/expressionLambda/gen_input.py +++ /dev/null @@ -1,5 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f1(lambda a, b=2: 1) - f2(lambda a, *c: 1) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/output/tests/generator/expressionLambda/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/output/tests/generator/expressionLambda/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/expression lambda/output/tests/generator/expressionLambda/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/indexed access/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/indexed access/input.sdstest deleted file mode 100644 index 1c4b9fca0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/indexed access/input.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.generator.indexedAccess - -fun f(param: Any?) - -step test(vararg params: Int) { - f(params[0]); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/indexed access/output/tests/generator/indexedAccess/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/indexed access/output/tests/generator/indexedAccess/gen_input.py deleted file mode 100644 index 2673de5a6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/indexed access/output/tests/generator/indexedAccess/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def test(*params): - f(params[0]) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/input.sdstest deleted file mode 100644 index db73c3389..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/input.sdstest +++ /dev/null @@ -1,31 +0,0 @@ -package tests.generator.infixOperation - -fun f(param: Any?) - -fun g() -> result: Boolean - -fun h() -> result: Int - -fun i() -> result: Int? - -pipeline test { - f(g() or g()); - f(g() and g()); - - f(h() == h()); - f(h() != h()); - f(h() === h()); - f(h() !== h()); - - f(h() < h()); - f(h() <= h()); - f(h() >= h()); - f(h() > h()); - - f(h() + h()); - f(h() - h()); - f(h() * h()); - f(h() / h()); - - f(i() ?: i()); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/output/tests/generator/infixOperation/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/output/tests/generator/infixOperation/gen_input.py deleted file mode 100644 index b9d770db1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/output/tests/generator/infixOperation/gen_input.py +++ /dev/null @@ -1,22 +0,0 @@ -# Imports ---------------------------------------------------------------------- - -import safeds_runner.codegen - -# Pipelines -------------------------------------------------------------------- - -def test(): - f(safeds_runner.codegen.eager_or(g(), g())) - f(safeds_runner.codegen.eager_and(g(), g())) - f((h()) == (h())) - f((h()) != (h())) - f((h()) is (h())) - f((h()) is not (h())) - f((h()) < (h())) - f((h()) <= (h())) - f((h()) >= (h())) - f((h()) > (h())) - f((h()) + (h())) - f((h()) - (h())) - f((h()) * (h())) - f((h()) / (h())) - f(safeds_runner.codegen.eager_elvis(i(), i())) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/output/tests/generator/infixOperation/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/output/tests/generator/infixOperation/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/infix operation/output/tests/generator/infixOperation/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/input.sdstest deleted file mode 100644 index 175fcf838..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/input.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -package tests.generator.literals - -fun f(param: Any?) - -pipeline test { - f(true); - f(false); - f(1.0); - f(1); - f(null); - f(""); - f("multi -line"); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/output/tests/generator/literals/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/output/tests/generator/literals/gen_input.py deleted file mode 100644 index 71832fd6d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/output/tests/generator/literals/gen_input.py +++ /dev/null @@ -1,10 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(True) - f(False) - f(1.0) - f(1) - f(None) - f('') - f('multi\nline') diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/output/tests/generator/literals/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/output/tests/generator/literals/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/literals/output/tests/generator/literals/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/input.sdstest deleted file mode 100644 index 2c8f26592..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/input.sdstest +++ /dev/null @@ -1,24 +0,0 @@ -package tests.generator.memberAccess - -fun f(param: Any?) - -fun g() -> result: Boolean - -fun h() -> (result1: Boolean, result2: Boolean) - -class C() { - attr a: Int - @PythonName("c") attr b: Int -} - -fun factory() -> instance: C? - -pipeline test { - f(g().result); - f(h().result1); - f(h().result2); - f(C().a); - f(C().b); - f(factory()?.a); - f(factory()?.b); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/output/tests/generator/memberAccess/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/output/tests/generator/memberAccess/gen_input.py deleted file mode 100644 index 2d8cbe6ac..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/output/tests/generator/memberAccess/gen_input.py +++ /dev/null @@ -1,14 +0,0 @@ -# Imports ---------------------------------------------------------------------- - -import safeds_runner.codegen - -# Pipelines -------------------------------------------------------------------- - -def test(): - f(g()) - f(h()[0]) - f(h()[1]) - f(C().a) - f(C().c) - f(safeds_runner.codegen.safe_access(factory(), 'a')) - f(safeds_runner.codegen.safe_access(factory(), 'c')) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/output/tests/generator/memberAccess/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/output/tests/generator/memberAccess/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/member access/output/tests/generator/memberAccess/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/input.sdstest deleted file mode 100644 index 1b4b0ebad..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/input.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package tests.generator.parenthesizedExpression - -fun f(param: Any?) - -fun g() -> result: Boolean - -pipeline test { - f((g())); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/output/tests/generator/parenthesizedExpression/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/output/tests/generator/parenthesizedExpression/gen_input.py deleted file mode 100644 index 00162f3cf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/output/tests/generator/parenthesizedExpression/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(g()) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/output/tests/generator/parenthesizedExpression/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/output/tests/generator/parenthesizedExpression/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/parenthesized expression/output/tests/generator/parenthesizedExpression/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/input.sdstest deleted file mode 100644 index fa66e2cff..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/input.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.generator.prefixOperation - -fun f(param: Any?) - -fun g() -> result: Boolean - -fun h() -> result: Int - -pipeline test { - f(not g()); - f(-h()); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/output/tests/generator/prefixOperation/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/output/tests/generator/prefixOperation/gen_input.py deleted file mode 100644 index 138c6bf3f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/output/tests/generator/prefixOperation/gen_input.py +++ /dev/null @@ -1,5 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(not (g())) - f(-(h())) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/output/tests/generator/prefixOperation/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/output/tests/generator/prefixOperation/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/prefix operation/output/tests/generator/prefixOperation/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/input.sdstest deleted file mode 100644 index 78979c9ad..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/input.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.generator.reference - -fun f(param: Any?) - -@PythonName("explain_model") -fun explainModel() -> result: Int - -pipeline test { - f(explainModel()); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/output/tests/generator/reference/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/output/tests/generator/reference/gen_input.py deleted file mode 100644 index 149d8bb65..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/output/tests/generator/reference/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(explain_model()) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/output/tests/generator/reference/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/output/tests/generator/reference/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/reference/output/tests/generator/reference/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/input.sdstest deleted file mode 100644 index 2c4348f8c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/input.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.generator.templateString - -fun f(param: Any?) - -fun g() -> result: Int - -pipeline test { - f("start -{{ g() }} -inner {{ g() }} -end"); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/output/tests/generator/templateString/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/output/tests/generator/templateString/gen_input.py deleted file mode 100644 index 7756f36ad..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/output/tests/generator/templateString/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Pipelines -------------------------------------------------------------------- - -def test(): - f(f'start\n{ g() }\ninner { g() }\nend') diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/output/tests/generator/templateString/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/output/tests/generator/templateString/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/expressions/template string/output/tests/generator/templateString/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context different package.sdsstub b/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context different package.sdsstub deleted file mode 100644 index fd7d34dd4..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context different package.sdsstub +++ /dev/null @@ -1,4 +0,0 @@ -package tests.generator.differentPackage - -fun function1InDifferentPackage() -> result: Int -fun function2InDifferentPackage() -> result: Int diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context package with python module.sdsstub b/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context package with python module.sdsstub deleted file mode 100644 index adc1112f6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context package with python module.sdsstub +++ /dev/null @@ -1,6 +0,0 @@ -@PythonModule("special_location") - -package tests.generator.withPythonModule - -fun function1InCompilationUnitWithPythonModule() -> result: Int -fun function2InCompilationUnitWithPythonModule() -> result: Int diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context same package.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context same package.sdstest deleted file mode 100644 index de0186d0a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/_skip_ context same package.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package tests.generator.imports - -fun impureFunction() -> result: Int - -step step1InSamePackage() -> result: Int { - yield result = impureFunction(); -} - -step step2InSamePackage() -> result: Int { - yield result = impureFunction(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/input.sdstest deleted file mode 100644 index 71056de99..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/input.sdstest +++ /dev/null @@ -1,25 +0,0 @@ -package tests.generator.imports - -import tests.generator.differentPackage.function1InDifferentPackage -import tests.generator.differentPackage.function2InDifferentPackage as g -import tests.generator.withPythonModule.function1InCompilationUnitWithPythonModule -import tests.generator.withPythonModule.function2InCompilationUnitWithPythonModule as h - -fun f(param: Any?) - -pipeline test { - f(step1InSamePackage()); - f(step1InSamePackage()); - f(step2InSamePackage()); - f(step2InSamePackage()); - - f(function1InDifferentPackage()); - f(function1InDifferentPackage()); - f(g()); - f(g()); - - f(function1InCompilationUnitWithPythonModule()); - f(function1InCompilationUnitWithPythonModule()); - f(h()); - f(h()); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen__skip__context_same_package.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen__skip__context_same_package.py deleted file mode 100644 index 4f69c70b4..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen__skip__context_same_package.py +++ /dev/null @@ -1,9 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def step1InSamePackage(): - result = impureFunction() - return result - -def step2InSamePackage(): - result = impureFunction() - return result diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen_input.py deleted file mode 100644 index 1010e1898..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen_input.py +++ /dev/null @@ -1,21 +0,0 @@ -# Imports ---------------------------------------------------------------------- - -from special_location import function1InCompilationUnitWithPythonModule, function2InCompilationUnitWithPythonModule as h -from tests.generator.differentPackage import function1InDifferentPackage, function2InDifferentPackage as g -from tests.generator.imports.gen__skip__context_same_package import step1InSamePackage, step2InSamePackage - -# Pipelines -------------------------------------------------------------------- - -def test(): - f(step1InSamePackage()) - f(step1InSamePackage()) - f(step2InSamePackage()) - f(step2InSamePackage()) - f(function1InDifferentPackage()) - f(function1InDifferentPackage()) - f(g()) - f(g()) - f(function1InCompilationUnitWithPythonModule()) - f(function1InCompilationUnitWithPythonModule()) - f(h()) - f(h()) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen_input_test.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen_input_test.py deleted file mode 100644 index 30abe031d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/imports/output/tests/generator/imports/gen_input_test.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import test - -if __name__ == '__main__': - test() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/python module/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/python module/input.sdstest deleted file mode 100644 index 0901c1873..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/python module/input.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -@PythonModule("special_module") - -package tests.generator.pythonModule - -fun f() - -step test() { - f(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/python module/output/special_module/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/python module/output/special_module/gen_input.py deleted file mode 100644 index 5c10c6069..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/python module/output/special_module/gen_input.py +++ /dev/null @@ -1,4 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def test(): - f() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/input.sdstest deleted file mode 100644 index a5bce7be0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/input.sdstest +++ /dev/null @@ -1,30 +0,0 @@ -package tests.generator.assignment - -fun f1(param: Any?) -fun f2(param: () -> r: Int?) - -fun g() -> (a: Int, b: Int, c: Int) - -pipeline testPipeline { - _, _ ,_ = g(); - val a, _, _ = g(); - val x = g(); - f1(a); - f1(x); - - f2(() { - _, _ ,_ = g(); - val a, _, yield c = g(); - val x = g(); - f1(a); - f1(x); - }); -} - -step testStep() -> c: Int { - _, _ ,_ = g(); - val a, _, yield c = g(); - val x = g(); - f1(a); - f1(x); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/output/tests/generator/assignment/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/output/tests/generator/assignment/gen_input.py deleted file mode 100644 index 8c24c2309..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/output/tests/generator/assignment/gen_input.py +++ /dev/null @@ -1,32 +0,0 @@ -# Imports ---------------------------------------------------------------------- - -import runtimeBridge - -# Steps ------------------------------------------------------------------------ - -def testStep(): - g() - a, _, c = g() - x, _, _ = g() - f1(a) - f1(x) - return c - -# Pipelines -------------------------------------------------------------------- - -def testPipeline(): - g() - a, _, _ = g() - runtimeBridge.save_placeholder('a', a) - x, _, _ = g() - runtimeBridge.save_placeholder('x', x) - f1(a) - f1(x) - def __block_lambda_0(): - g() - a, _, c = g() - x, _, _ = g() - f1(a) - f1(x) - return c - f2(__block_lambda_0) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/output/tests/generator/assignment/gen_input_testPipeline.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/output/tests/generator/assignment/gen_input_testPipeline.py deleted file mode 100644 index 7a825d09d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/assignment/output/tests/generator/assignment/gen_input_testPipeline.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import testPipeline - -if __name__ == '__main__': - testPipeline() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/input.sdstest deleted file mode 100644 index f5112ba63..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/input.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -package tests.generator.expressionStatement - -fun f(param: () -> ()) - -fun g() -> result: Int - -pipeline testPipeline { - g(); - - f(() { - g(); - }); -} - -step testStep() { - g(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/output/tests/generator/expressionStatement/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/output/tests/generator/expressionStatement/gen_input.py deleted file mode 100644 index f77b73f00..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/output/tests/generator/expressionStatement/gen_input.py +++ /dev/null @@ -1,12 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def testStep(): - g() - -# Pipelines -------------------------------------------------------------------- - -def testPipeline(): - g() - def __block_lambda_0(): - g() - f(__block_lambda_0) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/output/tests/generator/expressionStatement/gen_input_testPipeline.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/output/tests/generator/expressionStatement/gen_input_testPipeline.py deleted file mode 100644 index 7a825d09d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/expression statement/output/tests/generator/expressionStatement/gen_input_testPipeline.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import testPipeline - -if __name__ == '__main__': - testPipeline() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/input.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/input.sdstest deleted file mode 100644 index d5da89d79..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/input.sdstest +++ /dev/null @@ -1,18 +0,0 @@ -package tests.generator.statementWithoutEffect - -fun f(param: () -> ()) - -pipeline testPipeline { - 1; - _ = 1; - - f(() { - 1; - _ = 1; - }); -} - -step testStep() { - 1; - _ = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/output/tests/generator/statementWithoutEffect/gen_input.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/output/tests/generator/statementWithoutEffect/gen_input.py deleted file mode 100644 index 85e9e98ee..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/output/tests/generator/statementWithoutEffect/gen_input.py +++ /dev/null @@ -1,11 +0,0 @@ -# Steps ------------------------------------------------------------------------ - -def testStep(): - pass - -# Pipelines -------------------------------------------------------------------- - -def testPipeline(): - def __block_lambda_0(): - pass - f(__block_lambda_0) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/output/tests/generator/statementWithoutEffect/gen_input_testPipeline.py b/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/output/tests/generator/statementWithoutEffect/gen_input_testPipeline.py deleted file mode 100644 index 7a825d09d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/generator/statements/statement without effect/output/tests/generator/statementWithoutEffect/gen_input_testPipeline.py +++ /dev/null @@ -1,4 +0,0 @@ -from gen_input import testPipeline - -if __name__ == '__main__': - testPipeline() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-annotation between package and import.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-annotation between package and import.sdstest deleted file mode 100644 index 088dbd456..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-annotation between package and import.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -package test - -@AnnotationCall - -import someDeclaration diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-duplicate package.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-duplicate package.sdstest deleted file mode 100644 index 19a1f0cae..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-duplicate package.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// syntax_error - -package test - -package test diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-import before package.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-import before package.sdstest deleted file mode 100644 index 9de5197b1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-import before package.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// syntax_error - -import someDeclaration - -package test diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-complex example.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-complex example.sdstest deleted file mode 100644 index af5ecded2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-complex example.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -@AnnotationCall - -package test - -import someDeclaration -import somePackage.* - -@AnnotationCall -class C diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-empty.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-empty.sdstest deleted file mode 100644 index bde20dd35..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-empty.sdstest +++ /dev/null @@ -1 +0,0 @@ -// no_syntax_error \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-lone annotation call.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-lone annotation call.sdstest deleted file mode 100644 index a852b5bda..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/good-lone annotation call.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// no_syntax_error - -@AnnotationCall diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/annotation.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/annotation.sdstest deleted file mode 100644 index c203e124d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/annotation.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -annotation MySimpleAnnotation - -@AnnotationUse annotation MyComplexAnnotation( - @AnnotationUse a: Int, - vararg b: Int = 3 -) constraint { - T2 super Number, - T3 sub Number -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/annotationUse.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/annotationUse.sdstest deleted file mode 100644 index 26f675f7d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/annotationUse.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// no_syntax_error - -@AnnotationUse(1, b = 2, A.B) class MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/class.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/class.sdstest deleted file mode 100644 index a7a3e9257..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/class.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -// no_syntax_error - -class MySimpleClass - -@AnnotationUse -class MyComplexClass - <@AnnotationUse T1, in T2, out T3, T4 :: $SchemaType, T5 :: $ExpressionType, T6 :: $IntType, T7 :: $FloatType, T8 :: $BooleanType, T9 :: $StringType, T10 :: $NamedType> - (@AnnotationUse a: Int, vararg b: Int = 3) - sub SuperClass1, SuperClass2 -{ - constraint { - T2 super Number, - T3 sub Number - } - @AnnotationUse static attr myAttribute: Int - @AnnotationUse class MyClass - @AnnotationUse enum MyEnum - @AnnotationUse static fun MyFunction() -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/enum.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/enum.sdstest deleted file mode 100644 index 000531c28..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/enum.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -// no_syntax_error -enum MySimpleEnum - -@AnnotationUse enum MyComplexEnum { - MySimpleVariant - @AnnotationUse MyComplexVariant - <@AnnotationUse T1, in T2, out T3> - (@AnnotationUse a: Int, vararg b: Int = 3) constraint { - T2 super Number, - T3 sub Number - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/function.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/function.sdstest deleted file mode 100644 index b741ef010..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/function.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -// no_syntax_error - -fun mySimpleFunction() - -fun myFunctionWithOneResult() -> a : Int - -@MyAnnotation -fun myComplexFunction - <@AnnotationUse T1, in T2, out T3> - (@AnnotationUse a: Int, vararg b: Int = 3) - -> (@AnnotationUse a: Int, b: Int) { - constraint { - T2 super Number, - T3 sub Number - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-annotationUsesWithImports.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-annotationUsesWithImports.sdstest deleted file mode 100644 index f84e37c9a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-annotationUsesWithImports.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -@AnnotationUse - -import myPackage.MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-annotationUsesWithName.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-annotationUsesWithName.sdstest deleted file mode 100644 index d6703a025..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-annotationUsesWithName.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -@AnnotationUse - -package myPackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-full.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-full.sdstest deleted file mode 100644 index 547fa1491..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-full.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -@AnnotationUse - -package myPackage - -import myPackage.MyClass -import myPackage.MyClass as Class -import myPackage.* - -pipeline p1 {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-importsOnly.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-importsOnly.sdstest deleted file mode 100644 index e33ca9bcf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-importsOnly.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -import myPackage.MyClass -import myPackage.MyClass as Class -import myPackage.* diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-nameOnly.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-nameOnly.sdstest deleted file mode 100644 index b2c704934..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/package/good-nameOnly.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// no_syntax_error - -package myPackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/pipeline.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/pipeline.sdstest deleted file mode 100644 index 74b20e45d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/pipeline.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// no_syntax_error - -pipeline mySimplePipeline {} - -@AnnotationUse pipeline myComplexPipeline { - val a = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/goals/goalsWithArguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/goals/goalsWithArguments.sdstest deleted file mode 100644 index 0649f15fc..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/goals/goalsWithArguments.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -predicate myPredicateWithgoalArgs(){ - goal(myRef, "String", 3, null, 4.4, false) -} - -predicate myPredicateWithgoalNesting(){ - goal( - goalInner("Str", 3) - ) -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicate.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicate.sdstest deleted file mode 100644 index dcb73ab24..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicate.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -// no_syntax_error - -predicate mySimplePredicate(){ -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateComplex.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateComplex.sdstest deleted file mode 100644 index 2110782ff..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateComplex.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -predicate myComplexPredicate(dataset: Dataset, columnName: String) -> :: Schema { - -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateWithGoals.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateWithGoals.sdstest deleted file mode 100644 index ae54fd486..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateWithGoals.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -// no_syntax_error - -predicate myPredicateWithGoals(){ - goal1(), - goal31(), - goal32(dataset, columnName), - val intermediate1 = goal2() -} - -predicate myPredicateWithGoalsComplex(){ - val intermediate2 = goal41(dataset, columnName), - goal42(dataset, columnName), - goal51(intermediate2), - goal52(dataset, columnName), - goal53(intermediate2, columnName) -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateWithSchemaEffects.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateWithSchemaEffects.sdstest deleted file mode 100644 index 5d8c92176..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/predicates/predicateWithSchemaEffects.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// no_syntax_error - -predicate predicateWithSchemaEffectGoals () { - $readSchema("datasetPathStr"), - $checkColumn(::ASchema, "columnNameStr1", "columnNameStr2") -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with alternative as reference list.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with alternative as reference list.sdstest deleted file mode 100644 index f3726d62d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with alternative as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [^ f | g] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with alternative as universe.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with alternative as universe.sdstest deleted file mode 100644 index 92dff8028..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with alternative as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [f | g^ f] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with complement as reference list.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with complement as reference list.sdstest deleted file mode 100644 index 073eb2be4..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with complement as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [^ [^ f]] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with complement as universe.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with complement as universe.sdstest deleted file mode 100644 index 68b59db9d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with complement as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [[^ f]^ f] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with parenthesized term as reference list.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with parenthesized term as reference list.sdstest deleted file mode 100644 index bd517810c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with parenthesized term as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [^ (f)] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with parenthesized term as universe.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with parenthesized term as universe.sdstest deleted file mode 100644 index f93924ad9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with parenthesized term as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [(f)^ f] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with sequence as universe.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with sequence as universe.sdstest deleted file mode 100644 index 3da9758ea..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with sequence as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [f g^ f] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with token as universe.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with token as universe.sdstest deleted file mode 100644 index eb8defb85..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with token as universe.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [f^ f] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with token class as reference list.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with token class as reference list.sdstest deleted file mode 100644 index e4003a7cd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-complement with token class as reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - [^ \a] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-subterm after term.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-subterm after term.sdstest deleted file mode 100644 index 7e88ae244..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-subterm after term.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// syntax_error - -class C { - protocol { - f - - subterm term = f; - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-subterm without semicolon.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-subterm without semicolon.sdstest deleted file mode 100644 index 16b628917..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/bad-subterm without semicolon.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// syntax_error - -class C { - protocol { - subterm term = f - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-alternative.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-alternative.sdstest deleted file mode 100644 index 78d5d8689..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-alternative.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -class C { - protocol { - f | g - } - - protocol { - f | g | h - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-complement without reference list.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-complement without reference list.sdstest deleted file mode 100644 index 6be305b3c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-complement without reference list.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// no_syntax_error - -class C { - protocol { - [^] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-complement.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-complement.sdstest deleted file mode 100644 index 8cc1c98f9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-complement.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -// no_syntax_error - -class C { - protocol { - [^ f] - [.^ f] - [\a^ a] - [\f^ f] - - [^ f g] - [.^ f h] - [\a^ a b] - [\f^ f h] - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-empty.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-empty.sdstest deleted file mode 100644 index d0e9d9a15..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-empty.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -class C { - protocol {} -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-parenthesizedTerm.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-parenthesizedTerm.sdstest deleted file mode 100644 index 42b2c4401..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-parenthesizedTerm.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// no_syntax_error - -class C { - protocol { - (f) - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-quantifiedTerm.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-quantifiedTerm.sdstest deleted file mode 100644 index 9dc3c5539..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-quantifiedTerm.sdstest +++ /dev/null @@ -1,29 +0,0 @@ -// no_syntax_error - -class C { - protocol { - [^ f]? - [^ f]* - [^ f]+ - - (f)? - (f)* - (f)+ - - f? - f* - f+ - - .? - .* - .+ - - \a? - \a* - \a+ - - \f? - \f* - \f+ - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-sequence.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-sequence.sdstest deleted file mode 100644 index afd3bbcf2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-sequence.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -class C { - protocol { - f g - } - - protocol { - f g h - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-subterms.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-subterms.sdstest deleted file mode 100644 index d3f8a7997..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-subterms.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -// no_syntax_error - -class C { - protocol { - subterm term1 = f; - subterm term2 = g; - - term1 | term2 - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-token.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-token.sdstest deleted file mode 100644 index 4885e63ed..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-token.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// no_syntax_error - -class C { - protocol { - f - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-tokenClasses.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-tokenClasses.sdstest deleted file mode 100644 index 376e6c9b6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/protocols/good-tokenClasses.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// no_syntax_error - -class C { - protocol { - . - \a - \f - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest deleted file mode 100644 index e41b812da..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -internal private step myStep() {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest deleted file mode 100644 index efd0f3f55..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -private internal step myStep() {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/good-step in compilation unit.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/good-step in compilation unit.sdstest deleted file mode 100644 index df7fe02b1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/good-step in compilation unit.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -// no_syntax_error - -step mySimpleStep() {} - -internal step myInternalStep() {} - -step myStepWithOneResult() -> a: Int {} - -@AnnotationUse -private step myComplexStep(@AnnotationUse a: Int, vararg b: Int = 3) -> (a: Int, b: Int) { - val a = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/good-step in package.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/good-step in package.sdstest deleted file mode 100644 index 2b94e0b8d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/declarations/steps/good-step in package.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -// no_syntax_error - -package myPackage - -step mySimpleStep() {} - -internal step myInternalStep() {} - -step myStepWithOneResult() -> a: Int {} - -@AnnotationUse -private step myComplexStep(@AnnotationUse a: Int, vararg b: Int = 3) -> (a: Int, b: Int) { - val a = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/arithmeticOperator.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/arithmeticOperator.sdstest deleted file mode 100644 index ee030e762..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/arithmeticOperator.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - 1 + 2; - 1 - 2; - 1 * 2; - 1 / 2; - -1; - - (1 + 2) * -3 / (1 - 4) + 5; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/blockLambda.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/blockLambda.sdstest deleted file mode 100644 index e90d2bfe6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/blockLambda.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - () {}; - - (a, vararg b = 1) { - val a = 1; - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/call.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/call.sdstest deleted file mode 100644 index e6a6a6889..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/call.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - f(); - f<*, in Number, out Number, T = Number>(1, b = 2); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/chainedExpression.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/chainedExpression.sdstest deleted file mode 100644 index 8d8b7c079..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/chainedExpression.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - a.member?.f()[1]; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/comparisonOperator.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/comparisonOperator.sdstest deleted file mode 100644 index 39a8b2c37..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/comparisonOperator.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - 1 < 2; - 1 <= 2; - 1 == 2; - 1 === 2; - 1 != 2; - 1 !== 2; - 1 >= 2; - 1 > 2; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/expressionLambda.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/expressionLambda.sdstest deleted file mode 100644 index 6769a020f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/expressionLambda.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - () -> 1; - - (a, vararg b = 1) -> 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/indexedAccess/bad-indexed access without index.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/indexedAccess/bad-indexed access without index.sdstest deleted file mode 100644 index 0a4ccae73..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/indexedAccess/bad-indexed access without index.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// syntax_error - -pipeline test { - a[]; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/indexedAccess/good-indexed access.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/indexedAccess/good-indexed access.sdstest deleted file mode 100644 index a13537e89..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/indexedAccess/good-indexed access.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// no_syntax_error - -pipeline test { - a[1]; - a[b]; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/booleanLiteral.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/booleanLiteral.sdstest deleted file mode 100644 index dd7ed52d2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/booleanLiteral.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - true; - false; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/nullLiteral.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/nullLiteral.sdstest deleted file mode 100644 index 04b920d4f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/nullLiteral.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - null; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/numberLiteral.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/numberLiteral.sdstest deleted file mode 100644 index becaf419f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/numberLiteral.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - 1; - 1.2; - - 1e10; - 1e+10; - 1e-10; - 1.2e2; - - 1E10; - 1E+10; - 1E-10; - 1.2E2; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/stringLiteral.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/stringLiteral.sdstest deleted file mode 100644 index e1c8aa064..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/literals/stringLiteral.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - ""; - "myString"; - "'"; - "\n"; - "\u000c"; - " - multi - line - string - "; - "{"; - "{\n"; - "{ {"; - "not a template { ??? }"; - "not a template either \{{ ??? }}"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/logicalOperator.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/logicalOperator.sdstest deleted file mode 100644 index 2716ee409..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/logicalOperator.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - false and true; - true or true; - not true; - - not true and false or true; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/memberAccess.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/memberAccess.sdstest deleted file mode 100644 index cfd6ddd18..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/memberAccess.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - a.member; - a?.member; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/parenthesizedExpression.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/parenthesizedExpression.sdstest deleted file mode 100644 index 1c163b7f5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/parenthesizedExpression.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - (1 + 2); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/reference.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/reference.sdstest deleted file mode 100644 index 7694691d5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/reference.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - a; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/templateString_bad.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/templateString_bad.sdstest deleted file mode 100644 index f9e03afa1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/templateString_bad.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// syntax_error - -pipeline myPipeline { - "}} template {{ ??? }}"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/templateString_good.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/templateString_good.sdstest deleted file mode 100644 index 123323de3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/expressions/templateString_good.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - "}} template {{ a }}"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAnd.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAnd.sdstest deleted file mode 100644 index a70b3af83..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAnd.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class and diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAnnotation.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAnnotation.sdstest deleted file mode 100644 index 6c540f85e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAnnotation.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class annotation diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAs.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAs.sdstest deleted file mode 100644 index cf1d648b3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAs.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class as diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAttr.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAttr.sdstest deleted file mode 100644 index 5554b7a21..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedAttr.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class attr diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedClass.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedClass.sdstest deleted file mode 100644 index 0290889ae..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedClass.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class class diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedConstraint.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedConstraint.sdstest deleted file mode 100644 index e578bd73e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedConstraint.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class constraint diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedEnum.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedEnum.sdstest deleted file mode 100644 index bce83b376..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedEnum.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class enum diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedFalse.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedFalse.sdstest deleted file mode 100644 index 3a1290779..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedFalse.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class false diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedFun.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedFun.sdstest deleted file mode 100644 index eb95af4a6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedFun.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class fun diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedImport.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedImport.sdstest deleted file mode 100644 index 0f8524db7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedImport.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class import diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedIn.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedIn.sdstest deleted file mode 100644 index 6cb827012..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedIn.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class in diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedNot.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedNot.sdstest deleted file mode 100644 index 8586672b0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedNot.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class not diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedNull.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedNull.sdstest deleted file mode 100644 index 188b1f197..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedNull.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class null diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedOr.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedOr.sdstest deleted file mode 100644 index b039f4573..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedOr.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class or diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedOut.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedOut.sdstest deleted file mode 100644 index 294065ff8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedOut.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class out diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedPackage.sdstest deleted file mode 100644 index 1459c2c9e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedPackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class package diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedStatic.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedStatic.sdstest deleted file mode 100644 index 4a6709bd1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedStatic.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class static diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedStep.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedStep.sdstest deleted file mode 100644 index a10945c6c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedStep.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class step diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedSub.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedSub.sdstest deleted file mode 100644 index 80200c946..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedSub.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class sub diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedSuper.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedSuper.sdstest deleted file mode 100644 index 8407db8b9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedSuper.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class super diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedTrue.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedTrue.sdstest deleted file mode 100644 index a950a00fb..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedTrue.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class true diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedUnion.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedUnion.sdstest deleted file mode 100644 index 1331679d0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedUnion.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class union diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedVal.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedVal.sdstest deleted file mode 100644 index 5d87514d7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedVal.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class val diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedVararg.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedVararg.sdstest deleted file mode 100644 index fa21df2ab..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedVararg.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class vararg diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedWorkflow.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedWorkflow.sdstest deleted file mode 100644 index bbd064595..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedWorkflow.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class pipeline diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedYield.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedYield.sdstest deleted file mode 100644 index 4cb45092a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescapedYield.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class yield diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescaped_.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescaped_.sdstest deleted file mode 100644 index 19e8906da..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/bad-unescaped_.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class _ diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/good-escapedKeywords.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/good-escapedKeywords.sdstest deleted file mode 100644 index c89a701ec..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/good-escapedKeywords.sdstest +++ /dev/null @@ -1,29 +0,0 @@ -// no_syntax_error - -class `_` -class `and` -class `annotation` -class `as` -class `attr` -class `class` -class `constraint` -class `enum` -class `false` -class `fun` -class `import` -class `in` -class `not` -class `null` -class `or` -class `out` -class `package` -class `pipeline` -class `static` -class `step` -class `sub` -class `super` -class `true` -class `union` -class `val` -class `vararg` -class `yield` diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/good-escapedNonKeyword.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/good-escapedNonKeyword.sdstest deleted file mode 100644 index 948a94e10..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/keywordsAsNames/good-escapedNonKeyword.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// no_syntax_error - -class `Bla` diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedEnum.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedEnum.sdstest deleted file mode 100644 index 8a9492adb..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedEnum.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -enum TestEnum { diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedParameterList.sdstest deleted file mode 100644 index 851ad5ba2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedParameterList.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -fun f( diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedResultList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedResultList.sdstest deleted file mode 100644 index 98ea819b8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedResultList.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -fun s() -> ( diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedTypeParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedTypeParameterList.sdstest deleted file mode 100644 index 1ff89a4f2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/parserShouldNotCrashOnSyntaxErrors/unclosedTypeParameterList.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// syntax_error - -class C< diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/schema/schema.sdsschema b/DSL/com.larsreimann.safeds/src/test/resources/grammar/schema/schema.sdsschema deleted file mode 100644 index 083002308..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/schema/schema.sdsschema +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -schema MySchema { - "column name" : ColumnType -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/statements/assignment.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/statements/assignment.sdstest deleted file mode 100644 index 9ce0a740d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/statements/assignment.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - val a = 0; - val a, _, yield b = call(); - - () { - val a = 0; - val a, _, yield b = call(); - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/statements/expressionStatement.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/statements/expressionStatement.sdstest deleted file mode 100644 index 493a73e67..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/statements/expressionStatement.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// no_syntax_error - -pipeline myPipeline { - call(); - - () { - call(); - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotationUse_ArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotationUse_ArgumentList.sdstest deleted file mode 100644 index 76633ecb2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotationUse_ArgumentList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inAnnotationUseArgumentList - -// no_syntax_error - -@A(1, 2, ) class C \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotation_ConstraintList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotation_ConstraintList.sdstest deleted file mode 100644 index 14cbe9a3d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotation_ConstraintList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inAnnotationConstraintList - -// no_syntax_error - -annotation A constraint { - T sub Any, - T super Int -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotation_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotation_ParameterList.sdstest deleted file mode 100644 index db246b81c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAnnotation_ParameterList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inAnnotationParameterList - -// no_syntax_error - -annotation A( - a: Int, - b: Int, -) \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAssignment_AssigneeList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAssignment_AssigneeList.sdstest deleted file mode 100644 index 5eac79414..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inAssignment_AssigneeList.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package tests.trailingComma.inDoStatementAssigneeList - -// no_syntax_error - -pipeline p { - val a, val b, = f(); - - () { - val a, val b, = f(); - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inBlockLambda_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inBlockLambda_ParameterList.sdstest deleted file mode 100644 index 61b009db9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inBlockLambda_ParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inBlockLambdaParameterList - -// no_syntax_error - -pipeline p { - (first, second, ) {}; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inCall_ArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inCall_ArgumentList.sdstest deleted file mode 100644 index 8b82e5629..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inCall_ArgumentList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inCallArgumentList - -// no_syntax_error - -pipeline p { - f(1, 2, ); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inCall_TypeArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inCall_TypeArgumentList.sdstest deleted file mode 100644 index 0ddef4c82..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inCall_TypeArgumentList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inCallTypeArgumentList - -// no_syntax_error - -pipeline p { - f(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_ConstraintList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_ConstraintList.sdstest deleted file mode 100644 index 5f29da0c0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_ConstraintList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inClassConstraintList - -// no_syntax_error - -class C { - constraint { - T sub Any, - T super Int - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_ParameterList.sdstest deleted file mode 100644 index d62eac695..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_ParameterList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inClassParameterList - -// no_syntax_error - -class C(a: Int, b: Int, ) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_SuperTypeList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_SuperTypeList.sdstest deleted file mode 100644 index bb5a2ff59..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_SuperTypeList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inClassSuperTypeList - -// no_syntax_error - -class C sub D, E, \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_TypeParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_TypeParameterList.sdstest deleted file mode 100644 index be15d9cfd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inClass_TypeParameterList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inClassTypeParameterList - -// no_syntax_error - -class C \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_ConstraintList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_ConstraintList.sdstest deleted file mode 100644 index 8b243c4df..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_ConstraintList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inEnumVariantConstraintList - -// no_syntax_error - -enum E { - A -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_ParameterList.sdstest deleted file mode 100644 index f9d56f56d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_ParameterList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inEnumVariantParameterList - -// no_syntax_error - -enum E { - A( - a: Int, - b: Int, - ) -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_TypeParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_TypeParameterList.sdstest deleted file mode 100644 index d7ab117ac..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inEnumVariant_TypeParameterList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inEnumVariantTypeParameterList - -// no_syntax_error - -enum E { - A constraint { - T sub Any, - T super Int - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inExpressionLambda_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inExpressionLambda_ParameterList.sdstest deleted file mode 100644 index 0cd2e7002..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inExpressionLambda_ParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inExpressionLambdaParameterList - -// no_syntax_error - -pipeline p { - (first, second, ) -> 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunctionType_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunctionType_ParameterList.sdstest deleted file mode 100644 index d82a8a409..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunctionType_ParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inFunctionTypeParameterList - -// no_syntax_error - -step s( - f: (x: Int, y: Int, ) -> () -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunctionType_ResultList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunctionType_ResultList.sdstest deleted file mode 100644 index b76427faf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunctionType_ResultList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inFunctionTypeResultList - -// no_syntax_error - -step s( - f: () -> (x: Int, y: Int, ) -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_ParameterList.sdstest deleted file mode 100644 index 118106648..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_ParameterList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inFunctionParameterList - -// no_syntax_error - -fun f( - a: Int, - b: Int, -) \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_ResultList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_ResultList.sdstest deleted file mode 100644 index cc028bb4c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_ResultList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.trailingComma.inFunctionResultList - -// no_syntax_error - -fun f() -> ( - first: Int, - second: Int, -) \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_TypeParameterConstraintList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_TypeParameterConstraintList.sdstest deleted file mode 100644 index 72164d06e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_TypeParameterConstraintList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.trailingComma.inFunctionTypeParameterConstraintList - -// no_syntax_error - -fun f() { - constraint { - T sub Any, - T super Int - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_TypeParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_TypeParameterList.sdstest deleted file mode 100644 index 9fc8de059..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inFunction_TypeParameterList.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.trailingComma.inFunctionTypeParameterList - -// no_syntax_error - -fun f() \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inNamedType_TypeArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inNamedType_TypeArgumentList.sdstest deleted file mode 100644 index 703df8112..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inNamedType_TypeArgumentList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.trailingComma.inNamedTypeTypeArgumentList - -// no_syntax_error - -step s( - f: Type -) {} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inSchema_ColumnList.sdsschema b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inSchema_ColumnList.sdsschema deleted file mode 100644 index 9a88c4e25..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inSchema_ColumnList.sdsschema +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -schema MySchemaWithTrailingComma { - "column name" : ColumnType, -} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inWorkflowStep_ParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inWorkflowStep_ParameterList.sdstest deleted file mode 100644 index 5038b6b90..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/trailingCommas/inWorkflowStep_ParameterList.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.trailingComma.inStepParameterList - -// no_syntax_error -step s(a: Int, b: Int, ) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/callableType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/callableType.sdstest deleted file mode 100644 index d534a7dce..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/callableType.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -// no_syntax_error - -step s1( - f: () -> () -) {} - -step s2( - f: () -> result: Int -) {} - -step s3( - f: (@AnnotationUse a: Int, vararg b: Int = 3) -> (@AnnotationUse a: Int, b: Int) -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/memberType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/memberType.sdstest deleted file mode 100644 index fc7b2d8da..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/memberType.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// no_syntax_error - -step s1( - f: OuterClass.InnerClass -) {} - -step s2( - f: (OuterClass?.MiddleClass?).InnerClass -) {} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/namedType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/namedType.sdstest deleted file mode 100644 index 77cf9efbd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/namedType.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// no_syntax_error - -step s1( - f: Int -) {} - -step s2( - f: Int<*, in Number, out Number, T = Number>? -) {} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/parenthesizedType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/parenthesizedType.sdstest deleted file mode 100644 index 8687eb6eb..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/parenthesizedType.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -// no_syntax_error - -step s( - f: (Int) -) {} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/unionType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/unionType.sdstest deleted file mode 100644 index a2cb44fff..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/grammar/types/unionType.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -// no_syntax_error - -step s1( - f: union<> -) {} - -step s2( - f: union -) {} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/junit-platform.properties b/DSL/com.larsreimann.safeds/src/test/resources/junit-platform.properties deleted file mode 100644 index e6d55f8bd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/junit-platform.properties +++ /dev/null @@ -1 +0,0 @@ -junit.jupiter.testinstance.lifecycle.default = per_class \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/callables.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/callables.sdstest deleted file mode 100644 index 1131ae960..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/callables.sdstest +++ /dev/null @@ -1,42 +0,0 @@ -package tests.partialEvaluation.callables - -// Preparation ----------------------------------------------------------------- - -fun impureFunction() -> result: Int - -@Pure -fun pureFunction() -> result: Int - -// Test data ------------------------------------------------------------------- - -pipeline pipelineWithImpureAndPureLambdas { - val impureBlockLambda = () { - impureFunction(); - }; - - val pureBlockLambda = () { - pureFunction(); - }; - - val recursiveBlockLambda = () { - recursiveStep(); - }; - - val impureExpressionLambda = () -> impureFunction(); - - val pureExpressionLambda = () -> pureFunction(); - - val recursiveExpressionLambda = () -> recursiveStep(); -} - -step impureStep() { - impureFunction(); -} - -step pureStep() { - pureFunction(); -} - -step recursiveStep() -> result: Int { - yield result = recursiveStep(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/calls.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/calls.sdstest deleted file mode 100644 index e9536e7ab..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/calls.sdstest +++ /dev/null @@ -1,56 +0,0 @@ -package tests.partialEvaluation.higherOrder - -pipeline callToBlockLambda { - val lambda = (a) { yield result = a; }; - lambda(1); -} - -pipeline callToExpressionLambda { - val lambda = (a) -> a; - lambda(1); -} - -step myStep1(a: Int) -> result: Int { - yield result = a; -} - -pipeline callToStep { - myStep1(1); -} - -step myStep2(vararg params: Int) -> result: Int { - yield result = params; -} - -pipeline callToStepWithVariadicParameter { - myStep2(1); -} - -step myStep3(vararg params: Int) -> result: Int { - yield result = params[0]; -} - -pipeline callToStepWithIndexedVariadicParameter { - myStep3(1); -} - -pipeline parameterAssignedDuringCall { - ((a, b) { - val d = b; - yield result = ((b, c) -> a + b + c + d)(1, 2); - })(3, 4); -} - -step myStep4(param: Int) -> f: () -> (result: Int) { - yield f = () -> param; -} - -pipeline parameterAssignedDuringCreationOfLambda { - myStep4(1)(); -} - -pipeline lambdaAsParameter { - val apply = (f) -> f(); - - apply(() -> 1); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/memberAccesses.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/memberAccesses.sdstest deleted file mode 100644 index 21ada836d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/memberAccesses.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -package tests.partialEvaluation.memberAccesses - -pipeline successfulResultAccess { - val lambda = () { - yield result = 1; - }; - - lambda().result; -} - -pipeline failedResultAccess { - val lambda = () { - yield result = 1; - }; - - lambda().result1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/references.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/references.sdstest deleted file mode 100644 index b90ce668d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/partialEvaluation/references.sdstest +++ /dev/null @@ -1,51 +0,0 @@ -package tests.partialEvaluation.references - -pipeline successfulRecordAssignment { - val lambda = () { - yield result = 1; - }; - val placeholder = lambda(); - - placeholder; -} - -pipeline failedRecordAssignment { - val lambda = () { - yield result = 1; - }; - _, val placeholder = lambda(); - - placeholder; -} - -step myStep1() -> (a: Int, b: Int) { - yield b = 1; - yield a = 2; -} - -pipeline recordAssignmentWithDifferentYieldOrder { - val placeholder1, val placeholder2 = myStep1(); - - placeholder1 - placeholder2; -} - -step myStep2() -> (a: Int, b: Int) { - yield b = 1; -} - -pipeline recordAssignmentWithMissingYield { - _, val placeholder = myStep2(); - - placeholder; -} - -step myStep3() -> (a: Int) { - yield b = 2; - yield a = 1; -} - -pipeline recordAssignmentWithAdditionalYield { - val placeholder = myStep3(); - - placeholder; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/schema/dummyData.csv b/DSL/com.larsreimann.safeds/src/test/resources/schema/dummyData.csv deleted file mode 100644 index 99a668f35..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/schema/dummyData.csv +++ /dev/null @@ -1,5 +0,0 @@ -Column0,Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10,Column11 -1,0,3,asdfsdf,male,22,1,0,rhtyy,7.25,,S -2,1,1,asdfgfdghhfg,male,38,1,0,ewrterwt,71.2833,C85,C -3,1,3,ertewrtwer,male,26,0,0,vcdfgre,7.925,,S -4,1,1,qwerwqerwe,male,35,1,0,sfewrtret,53.1,C123,S diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/externalsInOtherPackage.sdstest deleted file mode 100644 index 7a863ebd4..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.languageTests.scoping.annotationCall2 - -annotation AnnotationInOtherPackage1 -annotation AnnotationInOtherPackage2 diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/externalsInSamePackage.sdstest deleted file mode 100644 index 030e9c07f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/externalsInSamePackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.annotationCall1 - -annotation AnnotationInSamePackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/main.sdstest deleted file mode 100644 index 1a1ca0924..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/annotationCall/main.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -package tests.languageTests.scoping.annotationCall1 - -import tests.languageTests.scoping.annotationCall2.AnnotationInOtherPackage1 - -annotation AnnotationInSameFile - -class NotAnAnnotation - -@AnnotationInSameFile -@AnnotationInSamePackage -@AnnotationInOtherPackage1 -@AnnotationInOtherPackage2 -@UnresolvedAnnotation -@NotAnAnnotation -class MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/externalsInOtherPackage.sdstest deleted file mode 100644 index ed585b62d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.languageTests.scoping.argument2 - -fun functionInOtherPackage1(parameterInOtherPackage1: Int) -fun functionInOtherPackage2(parameterInOtherPackage2: Int) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/externalsInSamePackage.sdstest deleted file mode 100644 index 7339df028..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/externalsInSamePackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.argument1 - -fun functionInSamePackage(parameterInSamePackage: Int) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/main.sdstest deleted file mode 100644 index b16927fdf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/argument/main.sdstest +++ /dev/null @@ -1,40 +0,0 @@ -package tests.languageTests.scoping.argument1 - -import tests.languageTests.scoping.argument2.functionInOtherPackage1 - -annotation AnnotationInSameFile(parameterInAnnotationInSameFile: Int) - -class ClassInSameFile(parameterInClassInSameFile: Int) - -enum EnumInSameFile { - EnumVariantInSameFile(parameterInEnumVariantInSameFile: Int) -} - -@AnnotationInSameFile(parameterInAnnotationInSameFile = 1) -fun functionInSameFile(parameterInFunctionSameFile: Int) - -step stepInSameFile(parameterInStepInSameFile: Int) {} - -enum notAParameter - -step stepForArgument(callableInSameStep: (parameterInCallableInSameStep: Int) -> ()) { - val blockLambdaInSameStep = (parameterInBlockLambdaInSameStep) {}; - val expressionLambdaInSameStep = (parameterInExpressionLambdaInSameStep) -> 1; - - blockLambdaInSameStep(parameterInBlockLambdaInSameStep = 1); - callableInSameStep(parameterInCallableInSameStep = 1); - ClassInSameFile(parameterInClassInSameFile = 1); - EnumInSameFile.EnumVariantInSameFile(parameterInEnumVariantInSameFile = 1); - expressionLambdaInSameStep(parameterInExpressionLambdaInSameStep = 1); - functionInSameFile(parameterInFunctionSameFile = 1); - stepInSameFile(parameterInStepInSameFile = 1); - - functionInSamePackage(parameterInSamePackage = 1); - functionInOtherPackage1(parameterInOtherPackage1 = 1); - functionInOtherPackage2(parameterInOtherPackage2 = 1); - functionInSameFile(parameterInSamePackage = 1); - functionInSameFile(parameterInOtherPackage1 = 1); - functionInSameFile(parameterInOtherPackage2 = 1); - functionInSameFile(unresolvedParameter = 1); - functionInSameFile(notAParameter = 1); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/externalsInOtherPackage.sdstest deleted file mode 100644 index 77ecc8ff2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.languageTests.scoping.goalReference2 - -predicate predicateInOtherPackage1() -predicate predicateInOtherPackage2() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/externalsInSamePackage.sdstest deleted file mode 100644 index 3a89dc735..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/externalsInSamePackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.goalReference1 - -predicate predicateInSamePackage() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/main.sdstest deleted file mode 100644 index abe48a395..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/goalReference/main.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -package tests.languageTests.scoping.goalReference1 - -import tests.languageTests.scoping.goalReference2.predicateInOtherPackage1 - -predicate predicateInSameFile() { -} - -predicate directReferencesToPredicates() { - predicateInSameFile(), - predicateInSamePackage(), - predicateInOtherPackage1(), - predicateInOtherPackage2() -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/externalsInOtherPackage.sdstest deleted file mode 100644 index 67b1c36d0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.importWithAlias2 - -class ClassInOtherPackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/externalsInSamePackage.sdstest deleted file mode 100644 index f72f3ecb7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/externalsInSamePackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.importWithAlias1 - -class ClassInSamePackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/main.sdstest deleted file mode 100644 index 9da5c6bff..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/importWithAlias/main.sdstest +++ /dev/null @@ -1,18 +0,0 @@ -package tests.languageTests.scoping.importWithAlias1 - -import tests.languageTests.scoping.importWithAlias1.ClassInSameFile as Cls1 -import tests.languageTests.scoping.importWithAlias1.ClassInSamePackage as Cls2 -import tests.languageTests.scoping.importWithAlias2.ClassInOtherPackage as Cls3 - -class ClassInSameFile - -fun importWithAlias( - aliasNameInSameFile: Cls1, - originalNameInSameFile: ClassInSameFile, - - aliasNameInSamePackage: Cls2, - originalNameInSamePackage: ClassInSamePackage, - - aliasNameInOtherPackage: Cls3, - originalNameInOtherPackage: ClassInOtherPackage -) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/externalsInOtherPackage.sdstest deleted file mode 100644 index 1e988aef5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.languageTests.scoping.namedType2 - -class ClassInOtherPackage1 -class ClassInOtherPackage2 -enum EnumInOtherPackage1 -enum EnumInOtherPackage2 diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/externalsInSamePackage.sdstest deleted file mode 100644 index b08f69452..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/externalsInSamePackage.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.languageTests.scoping.namedType1 - -class ClassInSamePackage -enum EnumInSamePackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/main.sdstest deleted file mode 100644 index 3b135cc06..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/namedType/main.sdstest +++ /dev/null @@ -1,65 +0,0 @@ -package tests.languageTests.scoping.namedType1 - -import tests.languageTests.scoping.namedType2.ClassInOtherPackage1 -import tests.languageTests.scoping.namedType2.EnumInOtherPackage1 - -class SuperClass { - class ClassInSuperClass - enum EnumInSuperClass -} -class ClassInSameFile sub SuperClass { - class ClassInClassInSameFile - enum EnumInClassInSameFile -} - -enum EnumInSameFile { - EnumVariantInSameFile -} - -fun NotANamedTypeDeclaration() - -fun directNamedTypes( - paramClassInSameFile: ClassInSameFile<*>, - paramEnumInSameFile: EnumInSameFile, - - paramClassInSamePackage: ClassInSamePackage<*>, - paramEnumInSamePackage: EnumInSamePackage, - - paramClassInOtherPackage1: ClassInOtherPackage1<*>, - paramEnumInOtherPackage1: EnumInOtherPackage1, - - paramClassInOtherPackage2: ClassInOtherPackage2<*>, - paramEnumInOtherPackage2: EnumInOtherPackage2, - - paramTypeParameterInSameFunction: TYPE_PARAMETER_IN_SAME_FUNCTION, - paramTypeParameterInSameFile: TYPE_PARAMETER_IN_SAME_FILE, - paramTypeParameterInSamePackage: TYPE_PARAMETER_IN_SAME_PACKAGE, - paramTypeParameterInOtherPackage: TYPE_PARAMETER_IN_OTHER_PACKAGE, - - paramUnresolvedNamedTypeDeclaration: UnresolvedNamedTypeDeclaration, - paramNotANamedTypeDeclaration: NotANamedTypeDeclaration -) - -fun memberTypes( - paramClassInClassInSameFile: ClassInSameFile<*>.ClassInClassInSameFile, - paramEnumInClassInSameFile: ClassInSameFile<*>.EnumInClassInSameFile, - paramEnumVariantInSameFile: EnumInSameFile.EnumVariantInSameFile, - - paramUnqualifiedClassInClassInSameFile: ClassInClassInSameFile, - paramUnqualifiedEnumInClassInSameFile: EnumInClassInSameFile, - paramUnqualifiedEnumVariantInSameFile: EnumVariantInSameFile, -) - -fun inheritedMemberTypes( - paramClassInSuperClass: ClassInSameFile<*>.ClassInSuperClass, - paramEnumInSuperClass: ClassInSameFile<*>.EnumInSuperClass, -) - -class ClassWithTypeParameter { - attr attributeInClassWithTypeParameter: TYPE_PARAMETER_IN_OUTER_CLASS - class NestedClass(paramClassInClassWithTypeParameter: TYPE_PARAMETER_IN_OUTER_CLASS) - enum NestedEnum { - Variant(paramEnumInClassWithTypeParameter: TYPE_PARAMETER_IN_OUTER_CLASS) - } - fun method(paramMethodInClassWithTypeParameter: TYPE_PARAMETER_IN_OUTER_CLASS) -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/protocolReference/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/protocolReference/main.sdstest deleted file mode 100644 index e7258f804..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/protocolReference/main.sdstest +++ /dev/null @@ -1,55 +0,0 @@ -class SuperClass { - static attr superClassStaticAttribute: Int - attr superClassInstanceAttribute: Int - - static fun superClassStaticMethod() - fun superClassInstanceMethod() - - fun overridden() -} - -class ContainerClass { - static attr containerClassStaticAttribute: Int - attr containerClassInstanceAttribute: Int - - static fun containerClassStaticMethod() - fun containerClassInstanceMethod() - - class SubClass sub SuperClass { - static attr subClassStaticAttribute: Int - attr subClassInstanceAttribute: Int - - static fun subClassStaticMethod() - fun subClassInstanceMethod() - - fun overridden() - attr shadowed: Int - - enum NotAProtocolToken - - protocol { - subterm superClassStaticAttributeReference = superClassStaticAttribute; - subterm superClassInstanceAttributeReference = superClassInstanceAttribute; - subterm superClassStaticMethodReference = superClassStaticMethod; - subterm superClassInstanceMethodReference = superClassInstanceMethod; - subterm containerClassStaticAttributeReference = containerClassStaticAttribute; - subterm containerClassInstanceAttributeReference = containerClassInstanceAttribute; - subterm containerClassStaticMethodReference = containerClassStaticMethod; - subterm containerClassInstanceMethodReference = containerClassInstanceMethod; - subterm subClassStaticAttributeReference = subClassStaticAttribute; - subterm subClassInstanceAttributeReference = subClassInstanceAttribute; - subterm subClassStaticMethodReference = subClassStaticMethod; - subterm subClassInstanceMethodReference = subClassInstanceMethod; - subterm notAProtocolTokenReference = NotAProtocolToken; - subterm unresolvedReference = unresolved; - - subterm forwardReference = subtermReference; - subterm subtermReference = forwardReference; - - subterm overriddenReference = overridden; - - subterm shadowed = shadowed; - subterm shadowedReference = shadowed; - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/externalsInOtherPackage.sdstest deleted file mode 100644 index 755b5d598..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,21 +0,0 @@ -package tests.languageTests.scoping.reference2 - -annotation AnnotationInOtherPackage1 -annotation AnnotationInOtherPackage2 - -class ClassInOtherPackage1 -class ClassInOtherPackage2 - -enum EnumInOtherPackage1 -enum EnumInOtherPackage2 - -fun globalFunctionInOtherPackage1() -fun globalFunctionInOtherPackage2() - -step stepInOtherPackage1() {} -step stepInOtherPackage2() {} -internal step internalStepInOtherPackage() {} -private step privateStepInOtherPackage() {} - -pipeline pipelineInOtherPackage1 {} -pipeline pipelineInOtherPackage2 {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/externalsInSamePackage.sdstest deleted file mode 100644 index 728229ef3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/externalsInSamePackage.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.languageTests.scoping.reference1 - -annotation AnnotationInSamePackage -class ClassInSamePackage -enum EnumInSamePackage -fun globalFunctionInSamePackage() - -step stepInSamePackage() {} -internal step internalStepInSamePackage() {} -private step privateStepInSamePackage() {} - -pipeline pipelineInSamePackage {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/main.sdstest deleted file mode 100644 index f98c7b3de..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/reference/main.sdstest +++ /dev/null @@ -1,384 +0,0 @@ -package tests.languageTests.scoping.reference1 - -import tests.languageTests.scoping.reference2.AnnotationInOtherPackage1 -import tests.languageTests.scoping.reference2.ClassInOtherPackage1 -import tests.languageTests.scoping.reference2.EnumInOtherPackage1 -import tests.languageTests.scoping.reference2.globalFunctionInOtherPackage1 -import tests.languageTests.scoping.reference2.internalStepInOtherPackage -import tests.languageTests.scoping.reference2.privateStepInOtherPackage -import tests.languageTests.scoping.reference2.stepInOtherPackage1 -import tests.languageTests.scoping.reference2.pipelineInOtherPackage1 - -annotation AnnotationInSameFile - -class SuperClass { - static attr superClassStaticAttribute: Int - attr superClassInstanceAttribute: Int - - class ClassInSuperClass - - enum EnumInSuperClass - - static fun superClassStaticMethod() - fun superClassInstanceMethod() -} -class ClassInSameFile() sub SuperClass { - static attr classStaticAttributeInSameFile: Int - attr classInstanceAttributeInSameFile: Int - - class ClassInClassInSameFile - - enum EnumInClassInSameFile - - static fun classStaticMethodInSameFile() -> classStaticMethodResultInSameFile: Int - fun classInstanceMethodInSameFile() -> classInstanceMethodResultInSameFile: Int -} - -enum EnumInSameFile { - EnumVariantInSameFile(enumVariantParameterInSameFile: Int) -} - -fun globalFunctionInSameFile(globalFunctionParameterInSameFile: Int) -> globalFunctionResultInSameFile: Int -fun globalFunctionWithOneResultWithIdenticalMember() -> result: ClassForResultMemberAccess -fun globalFunctionWithTwoResults() -> (result1: Int, result2: Int) - - -step stepInSameFile(stepParameterInSameFile: Int) -> stepResultInSameFile: Int { - val placeholderInSameFile = 1; -} -step stepWithOneResultWithIdenticalMember() -> result: ClassForResultMemberAccess {} -step stepWithTwoResults() -> (result1: Int, result2: Int) {} - -step internalStepInSameFile() {} -step privateStepInSameFile() {} - -pipeline pipelineInSameFile {} - -class SuperClassForOverriding() { - attr instanceAttributeForOverriding: Int - fun instanceMethodForOverriding() -} -class SubClassForOverriding() -sub SuperClassForOverriding { - attr instanceAttributeForOverriding: Int - fun instanceMethodForOverriding() -} - -class SuperClassForHiding { - static attr staticAttributeForHiding: Int - class NestedClassForHiding - enum NestedEnumForHiding - static fun staticMethodForHiding() -} -class SubClassForHiding sub SuperClassForHiding { - static attr staticAttributeForHiding: Int - class NestedClassForHiding - enum NestedEnumForHiding - static fun staticMethodForHiding() -} - -class ClassForResultMemberAccess() { - attr result: Int -} -enum EnumForResultMemberAccess { - result -} - -// Direct references ----------------------------------------------------------- - -step directReferencesToAnnotations() { - AnnotationInSameFile; - AnnotationInSamePackage; - AnnotationInOtherPackage1; - AnnotationInOtherPackage2; -} - -step directReferencesToClasses() { - ClassInSameFile; - ClassInSamePackage; - ClassInOtherPackage1; - ClassInOtherPackage2; -} - -step directReferencesToEnums() { - EnumInSameFile; - EnumInSamePackage; - EnumInOtherPackage1; - EnumInOtherPackage2; -} - -step directReferencesToGlobalFunctions() { - globalFunctionInSameFile; - globalFunctionInSamePackage; - globalFunctionInOtherPackage1; - globalFunctionInOtherPackage2; -} - -step directReferencesToLambdaResults() { - val f = () { - yield lambdaResult = 1; - lambdaResult; - }; -} - -step directReferencesToParameters(parameterInStep: Int) { - parameterInStep; - - val f = (parameterInBlockLambda) { - parameterInStep; - parameterInBlockLambda; - - val f = () { - parameterInStep; - parameterInBlockLambda; - }; - }; - - val g = (parameterInExpressionLambda) -> parameterInExpressionLambda; -} - -step directReferencesToPlaceholders() { - val placeholderInStep = 1; - placeholderInStep; - - val f = () { - val placeholderInLambda = 1; - placeholderInStep; - placeholderInLambda; - - val f = () { - placeholderInStep; - placeholderInLambda; - }; - }; -} - -step directReferencesToTypeParameters() { - TYPE_PARAMETER_IN_SAME_FILE; -} - -step directReferencesToSteps() { - stepInSameFile; - stepInSamePackage; - stepInOtherPackage1; - stepInOtherPackage2; - - internalStepInSameFile; - privateStepInSameFile; - internalStepInSamePackage; - privateStepInSamePackage; - internalStepInOtherPackage; - privateStepInOtherPackage; -} - -step directReferencesToPipelines() { - pipelineInSameFile; - pipelineInSamePackage; - pipelineInOtherPackage1; - pipelineInOtherPackage2; -} - -step forwardReferences() { - a; - val f = () { - a; - f; - }; - - val a = 1; -} - -step shadowedReferences(ClassInSameFile: Int) { - ClassInSameFile; - - val ClassInSameFile = 1; - ClassInSameFile; - - val f = (ClassInSameFile) { - ClassInSameFile; - - val ClassInSameFile = 1; - ClassInSameFile; - }; -} - -// Access to own members ------------------------------------------------------- - -step referencesToClassMembers() { - ClassInSameFile.classStaticAttributeInSameFile; - ClassInSameFile<*>().classInstanceAttributeInSameFile; - ClassInSameFile.ClassInClassInSameFile; - ClassInSameFile.EnumInClassInSameFile; - ClassInSameFile.classStaticMethodInSameFile; - ClassInSameFile<*>().classInstanceMethodInSameFile(); -} - -@Target(EnumInSameFile.EnumVariantInSameFile) -step referencesToEnumVariants(@Target(EnumInSameFile.EnumVariantInSameFile) referenceToEnumVariantFromParameterAnnotation: Int) { - EnumInSameFile.EnumVariantInSameFile; -} - -class ReferencesToEnumVariants { - @Target(EnumInSameClass.EnumVariantInSameClass) - @Target(EnumInSameFile.EnumVariantInSameFile) - class ReferencesToEnumVariantsInnerClass - - enum EnumInSameClass { - EnumVariantInSameClass - } -} - -step referencesToEnumVariantParameters() { - EnumInSameFile.EnumVariantInSameFile.enumVariantParameterInSameFile; -} - - -// Access to inherited members ------------------------------------------------- - -step referencesToInheritedClassMembers() { - ClassInSameFile.superClassStaticAttribute; - ClassInSameFile<*>().superClassInstanceAttribute; - ClassInSameFile.ClassInSuperClass; - ClassInSameFile.EnumInSuperClass; - ClassInSameFile.superClassStaticMethod; - ClassInSameFile<*>().superClassInstanceMethod(); -} - - -// Overriding ------------------------------------------------------------------ -step referencesToOverriddenMembers() { - SuperClassForOverriding().instanceAttributeForOverriding; - SuperClassForOverriding().instanceMethodForOverriding(); - - SubClassForOverriding().instanceAttributeForOverriding; - SubClassForOverriding().instanceMethodForOverriding(); -} - -// Hiding ---------------------------------------------------------------------- -step referencesToHiddenMembers() { - SubClassForHiding.staticAttributeForHiding; - SubClassForHiding.NestedClassForHiding; - SubClassForHiding.NestedEnumForHiding; - SubClassForHiding.staticMethodForHiding; -} - -// Access to static members from instance -------------------------------------- - -step referencesToStaticClassMembersFromInstance() { - ClassInSameFile<*>().classStaticAttributeInSameFile; - ClassInSameFile<*>().ClassInClassInSameFile; - ClassInSameFile<*>().EnumInClassInSameFile; - ClassInSameFile<*>().classStaticMethodInSameFile; - - ClassInSameFile<*>().superClassStaticAttribute; - ClassInSameFile<*>().ClassInSuperClass; - ClassInSameFile<*>().EnumInSuperClass; - ClassInSameFile<*>().superClassStaticMethod; -} - - -// Access to instance members from class --------------------------------------- - -step referencesToInstanceClassMembersFromClass() { - ClassInSameFile.classInstanceAttributeInSameFile; - ClassInSameFile.classInstanceMethodInSameFile(); - - ClassInSameFile.superClassInstanceAttribute; - ClassInSameFile.superClassInstanceMethod(); -} - - -// Access to results of callable ----------------------------------------------- - -step referencesToCallableTypeResults( - callableWithOneResult: () -> (singleResult: Int), - callableWithOneResultWithIdenticalClassAttribute: () -> (result: ClassForResultMemberAccess), - callableWithOneResultWithIdenticalEnumVariant: () -> (result: EnumForResultMemberAccess), - callableWithTwoResults: () -> (result1: Int, result2: Int) -) { - callableWithOneResult().singleResult; - callableWithOneResultWithIdenticalClassAttribute().result; - callableWithOneResultWithIdenticalEnumVariant().result; - callableWithTwoResults().result1; -} - -step referencesToFunctionResults() { - globalFunctionInSameFile(1).globalFunctionResultInSameFile; - globalFunctionWithOneResultWithIdenticalMember().result; - globalFunctionWithTwoResults().result1; -} - -step referencesToLambdaResults() { - val lambdaWithOneResult = () { - yield singleResult = 1; - }; - val lambdaWithOneResultWithIdenticalMember = () { - yield result = ClassForResultMemberAccess(); - }; - val lambdaWithTwoResults = () { - yield result1 = 1; - yield result2 = 1; - }; - - lambdaWithOneResult().singleResult; - lambdaWithOneResultWithIdenticalMember().result; - lambdaWithTwoResults().result1; -} - -step referencesToStepResults() { - stepInSameFile(1).stepResultInSameFile; - stepWithOneResultWithIdenticalMember().result; - stepWithTwoResults().result1; -} - -// Access to locals from outside ----------------------------------------------- - -step referencesToFunctionLocals() { - globalFunctionParameterInSameFile; - globalFunctionResultInSameFile; -} - -step referencesToLambdaLocals() { - val f = (lambdaParameter) { - val lambdaPlaceholder = 1; - yield lambdaYield = 1; - }; - - lambdaParameter; - lambdaPlaceholder; - lambdaYield; -} - -step referencesToStepLocals() { - stepParameterInSameFile; - stepResultInSameFile; - placeholderInSameFile; -} - -// Unqualified access to members ----------------------------------------------- - -step unqualifiedReferencesToClassMembers() { - classStaticAttributeInSameFile; - classInstanceAttributeInSameFile; - - ClassInClassInSameFile; - EnumInClassInSameFile; - - classStaticMethodInSameFile; - classInstanceMethodInSameFile; -} - -step unqualifiedReferencesToEnumVariants() { - EnumVariantInSameFile; -} - -step unqualifiedReferencesToEnumVariantParameters() { - enumVariantParameterInSameFile; -} - - -// Other unresolved references ------------------------------------------------- - -step unresolvedReferences() { - unresolvedReference; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/externalsInOtherPackage.sdstest deleted file mode 100644 index 13caa0468..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.languageTests.scoping.typeArgument2 - -fun functionInOtherPackage1() -fun functionInOtherPackage2() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/externalsInSamePackage.sdstest deleted file mode 100644 index 1d3965577..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/externalsInSamePackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.typeArgument1 - -fun functionInSamePackage() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/main.sdstest deleted file mode 100644 index 91ad63bd5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeArgument/main.sdstest +++ /dev/null @@ -1,28 +0,0 @@ -package tests.languageTests.scoping.typeArgument1 - -import tests.languageTests.scoping.typeArgument2.functionInOtherPackage1 - -class ClassInSameFile - -enum EnumInSameFile{ - EnumVariantInSameFile() -} - -fun functionInSameFile() - -step NOT_A_TYPE_PARAMETER1() {} - -pipeline pipelineForTypeArgument { - ClassInSameFile(); - EnumInSameFile.EnumVariantInSameFile(); - functionInSameFile(); - functionInSamePackage(); - functionInOtherPackage1(); - functionInOtherPackage2(); - - functionInSameFile(); - functionInSameFile(); - functionInSameFile(); - functionInSameFile(); - functionInSameFile(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/externalsInOtherPackage.sdstest deleted file mode 100644 index 5bb030086..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.languageTests.scoping.typeParameterConstraint2 - -fun functionInOtherPackage1() -fun functionInOtherPackage2() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/externalsInSamePackage.sdstest deleted file mode 100644 index 8f9dd51ac..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/externalsInSamePackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.typeParameterConstraint1 - -fun functionInSamePackage() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/main.sdstest deleted file mode 100644 index e6acd9e46..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/typeParameterConstraint/main.sdstest +++ /dev/null @@ -1,30 +0,0 @@ -package tests.languageTests.scoping.typeParameterConstraint1 - -import tests.languageTests.scoping.typeParameterConstraint2.functionInOtherPackage1 - -fun functionInSameFile() - -annotation NOT_A_TYPE_PARAMETER - -class TestClass { - constraint { - TYPE_PARAMETER_IN_SAME_CLASS sub Int - } -} -enum TestEnum { - TestEnumVariant constraint { - TYPE_PARAMETER_IN_SAME_ENUM_VARIANT sub Int - } -} - -fun testFunction() { - constraint { - TYPE_PARAMETER_IN_SAME_FUNCTION sub Int, - TYPE_PARAMETER_IN_SAME_FILE sub Int, - TYPE_PARAMETER_IN_SAME_PACKAGE sub Int, - TYPE_PARAMETER_IN_OTHER_PACKAGE1 sub Int, - TYPE_PARAMETER_IN_OTHER_PACKAGE2 sub Int, - NOT_A_TYPE_PARAMETER sub Int, - UNRESOLVED_TYPE_PARAMETER sub Int - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/externalsInOtherPackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/externalsInOtherPackage.sdstest deleted file mode 100644 index bce63bb75..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/externalsInOtherPackage.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.languageTests.scoping.yield2 - -step stepInOtherPackage1() -> resultInOtherPackage1: Int {} -step stepInOtherPackage2() -> resultInOtherPackage2: Int {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/externalsInSamePackage.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/externalsInSamePackage.sdstest deleted file mode 100644 index d56c8f4c7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/externalsInSamePackage.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.languageTests.scoping.yield1 - -step stepInSamePackage() -> resultInSamePackage: Int {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/main.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/main.sdstest deleted file mode 100644 index a61386a25..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/scoping/yield/main.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -package tests.languageTests.scoping.yield1 - -import tests.languageTests.scoping.yield2.stepInOtherPackage1 - -step stepInSameFile() -> resultInSameFile: Int {} - -class notAResult - -step stepInSameStep() -> resultInSameStep: Int { - yield resultInSameStep = 1; - yield resultInSameFile = 1; - yield resultInSamePackage = 1; - yield resultInOtherPackage1 = 1; - yield resultInOtherPackage2 = 1; - yield unresolvedResult = 1; - yield notAResult = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/serialization/extensionsTest.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/serialization/extensionsTest.sdstest deleted file mode 100644 index 3f234796b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/serialization/extensionsTest.sdstest +++ /dev/null @@ -1 +0,0 @@ -package tests class MyClass { attr myAttribute: Int } diff --git a/DSL/com.larsreimann.safeds/src/test/resources/staticAnalysis/recursion.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/staticAnalysis/recursion.sdstest deleted file mode 100644 index 19e9248d8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/staticAnalysis/recursion.sdstest +++ /dev/null @@ -1,90 +0,0 @@ -package tests.staticAnalysis.recursion - -// Positive examples ----------------------------------------------------------- - -annotation CallsShouldBeRecursive - -// Direct recursion - -@CallsShouldBeRecursive -step directRecursion(a: Any or directRecursion()) { - directRecursion(); - 1 + directRecursion(); - val a = directRecursion(); -} - -// Transitive recursion - -@CallsShouldBeRecursive -step transitiveRecursion1() { - transitiveRecursion2(); - val a = transitiveRecursion2(); -} - -@CallsShouldBeRecursive -step transitiveRecursion2() { - transitiveRecursion3(); - val a = transitiveRecursion3(); -} - -@CallsShouldBeRecursive -step transitiveRecursion3() { - transitiveRecursion2(); - val a = transitiveRecursion2(); -} - -// Deferred recursion in lambda - -@CallsShouldBeRecursive -step deferredRecursionInLambda() { - (() { directRecursion(); })(); - (() -> directRecursion())(); -} - -// Negative examples ----------------------------------------------------------- - -annotation CallsShouldNotBeRecursive - -// Normal calls - -@CallsShouldNotBeRecursive -step normalCall(f: () -> ()) { - f(); - (() {})(); - (() -> null)(); - - MyClass(); - MyEnum.Variant(); - myFun(); - myStep(); -} - -class MyClass() -enum MyEnum { - Variant() -} -fun myFun() -step myStep() {} - -// Uncalled lambda - -@CallsShouldNotBeRecursive -step uncalledLambda() { - () { uncalledLambda(); }; - () -> uncalledLambda(); -} - -// Lambda recursion (already handled by scoping) - -@CallsShouldNotBeRecursive -step lambdaRecursion() { - val a = () { a(); }; - val b = () -> b(); -} - -// Unresolved callable - -@CallsShouldNotBeRecursive -step unresolvedCallable() { - unresolved(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/staticAnalysis/sideEffects.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/staticAnalysis/sideEffects.sdstest deleted file mode 100644 index 38ea9255a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/staticAnalysis/sideEffects.sdstest +++ /dev/null @@ -1,147 +0,0 @@ -package tests.staticAnalysis.sideEffects - -// Positive examples ----------------------------------------------------------- - -annotation ShouldHaveNoSideEffects - -// Call to class constructor - -class C() - -@ShouldHaveNoSideEffects -step callOfClassConstructor() { - C(); -} - -// Call to enum variant constructor - -enum MyEnum { - Variant -} - -@ShouldHaveNoSideEffects -step callOfEnumVariantConstructor() { - MyEnum.Variant(); -} - -// Function without side effects - -@Pure -fun pureFunction() - -@NoSideEffects -fun functionWithoutSideEffects() - -@ShouldHaveNoSideEffects -step callToPureFunction() { - pureFunction(); - functionWithoutSideEffects(); -} - -// Lambdas without side effects - -@ShouldHaveNoSideEffects -step callToPureLambdas() { - (() {})(); - (() -> null)(); - - () { - (() {})(); - }; - - () -> (() -> null)(); -} - -// Steps without side effects - -step pureStep() {} - -@ShouldHaveNoSideEffects -step callToPureSteps() { - pureStep(); -} - -// Uncalled lambdas - -step pureStepWithUncalledLambdas() { - () -> impureFunction(); -} - -@ShouldHaveNoSideEffects -step uncalledLambdas() { - pureStepWithUncalledLambdas(); -} - -// Function as result - -@ShouldHaveNoSideEffects -step pureFunctionAsResult() { - (() -> pureFunction)()(); -} - -// Negative examples ----------------------------------------------------------- - -annotation ShouldHaveSideEffects - -// Callable type - -@ShouldHaveSideEffects -step callToCallableType(f: () -> ()) { - f(); -} - -// Function with side effects - -fun impureFunction() - -@ShouldHaveSideEffects -step callToImpureFunction() { - impureFunction(); -} - -// Lambdas with side effects - -@ShouldHaveSideEffects -step callToImpureLambdas() { - (() { impureFunction(); })(); - (() -> impureFunction())(); - - () { - (() { impureFunction(); })(); - }; - - () -> (() -> impureFunction())(); -} - -// Steps with side effects - -step impureStep() { - impureFunction(); -} - -@ShouldHaveSideEffects -step callToImpureSteps() { - impureStep(); -} - -// Recursion - -@ShouldHaveSideEffects -step recursion() { - recursion(); -} - -// Unresolved callable - -@ShouldHaveSideEffects -step unresolvedCallable() { - unresolved(); -} - -// Function as parameter - -@ShouldHaveSideEffects -step impureFunctionAsParameter() { - ((f) -> f())(pureFunction); // This is actually pure, but we match in a conservative manner. Can be improved later. - ((f) -> f())(impureFunction); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/deprecated.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/deprecated.sdstest deleted file mode 100644 index c0ddd0e16..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/deprecated.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -fun nonDeprecatedFunction() - -@Deprecated -fun deprecatedFunction() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/description.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/description.sdstest deleted file mode 100644 index ce4e0cac2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/description.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -fun functionWithoutDescription() - -@Description("Lorem ipsum") -fun functionWithUniqueDescription() - -@Description("Lorem ipsum 1") -@Description("Lorem ipsum 2") -fun functionWithMultipleDescriptions() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pure.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pure.sdstest deleted file mode 100644 index 1abd4abea..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pure.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -fun impureFunction() - -@Pure -fun pureFunction() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModule.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModule.sdstest deleted file mode 100644 index 3851d3f7e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModule.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -@PythonModule("python_module") -package compilationUnitWithUniquePythonModule diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModuleMissing.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModuleMissing.sdstest deleted file mode 100644 index da8f8932b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModuleMissing.sdstest +++ /dev/null @@ -1 +0,0 @@ -package compilationUnitWithoutPythonModule diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModuleMultipleAnnotations.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModuleMultipleAnnotations.sdstest deleted file mode 100644 index 22e3b3228..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonModuleMultipleAnnotations.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -@PythonModule("python_module_1") -@PythonModule("python_module_2") -package compilationUnitWithMultiplePythonModules diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonName.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonName.sdstest deleted file mode 100644 index 8a76a5ae9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/pythonName.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -fun functionWithoutPythonName() - -@PythonName("function_with_python_name") -fun functionWithUniquePythonName() - -@PythonName("function_with_python_name_1") -@PythonName("function_with_python_name_2") -fun functionWithMultiplePythonNames() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/repeatable.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/repeatable.sdstest deleted file mode 100644 index e8dabdbee..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/repeatable.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -annotation UnrepeatableAnnotation - -@Repeatable -annotation RepeatableAnnotation diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/since.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/since.sdstest deleted file mode 100644 index 5320833f0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/since.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -fun functionWithoutSince() - -@Since("1.0.0") -fun functionWithUniqueSince() - -@Since("1.0.0") -@Since("2.0.0") -fun functionWithMultipleSinces() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/target.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/target.sdstest deleted file mode 100644 index 50d198aa8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/stdlibAccess/annotations/target.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -annotation AnnotationWithoutTarget - -@Target(AnnotationTarget.Class) -annotation AnnotationWithUniqueTarget - -@Target(AnnotationTarget.Class) -@Target(AnnotationTarget.Enum) -annotation AnnotationWithMultipleTargets diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/blockLambdaResults.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/blockLambdaResults.sdstest deleted file mode 100644 index 60043cf6f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/blockLambdaResults.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.typeComputer.assignees.blockLambdaResults - -fun f(p: Any) - -pipeline myPipeline { - f(() { - yield r = 1; - yield s = ""; - }); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/placeholders.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/placeholders.sdstest deleted file mode 100644 index 61ce0f2c9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/placeholders.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.typeComputer.assignees.placeholders - -fun f(p: Any) - -pipeline myPipeline { - val a = 1; - val b = ""; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/yields.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/yields.sdstest deleted file mode 100644 index 508e01368..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/assignees/yields.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.typeComputer.assignees.yields - -fun f(p: Any) - -step myStep() -> (r: Int, s: String) { - yield r = 1; - yield s = ""; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/attributes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/attributes.sdstest deleted file mode 100644 index 10372f386..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/attributes.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.typeComputer.declarations.attributes - -class C { - attr a: Int -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/classes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/classes.sdstest deleted file mode 100644 index 829a20168..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/classes.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.typeComputer.declarations.classes - -class C diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/enumVariants.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/enumVariants.sdstest deleted file mode 100644 index 40fe94ee2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/enumVariants.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.typeComputer.declarations.enumVariants - -enum E { - V -} - -step myStep(v: E.V) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/enums.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/enums.sdstest deleted file mode 100644 index 1a333a1e6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/enums.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.typeComputer.declarations.enums - -enum E - -step myStep(e: E) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/functions.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/functions.sdstest deleted file mode 100644 index f58211dc9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/functions.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.typeComputer.declarations.functions - -fun f(a: Int, b: String) -> (r: String, s: Int) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/parameters.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/parameters.sdstest deleted file mode 100644 index 24cc01658..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/parameters.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -package tests.typeComputer.declarations.parameters - -fun f(parameter: (a: String) -> r: String) - -step myStepWithNormalParameter(a: Int, b: String) {} -step myStepWithVariadicParameter(vararg param: Int) {} - -step myStepWithLambdas() -> ( - r: (a: String) -> r: String, - s: (a: String) -> r: String -) { - f((a) -> ""); - f((b) { yield r = ""; }); - - yield r = (c) -> ""; - yield s = (d) { yield r = ""; }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/results.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/results.sdstest deleted file mode 100644 index bfbd2f177..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/results.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.typeComputer.declarations.results - -step myStep() -> (r: Int, s: String) { - yield r = 1; - yield s = ""; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/steps.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/steps.sdstest deleted file mode 100644 index 15f1d444e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/declarations/steps.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.typeComputer.declarations.steps - -step s(a: Int, b: String) -> (r: String, s: Int) { - yield r = ""; - yield s = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/arguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/arguments.sdstest deleted file mode 100644 index 37153ee8a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/arguments.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.typeComputer.expressions.parenthesizedExpressions - -fun f(x: Any?) - -pipeline myPipeline { - f(1); - f(x = ""); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/blockLambdas.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/blockLambdas.sdstest deleted file mode 100644 index 787c84a5e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/blockLambdas.sdstest +++ /dev/null @@ -1,49 +0,0 @@ -package tests.typeComputer.expressions.blockLambdas - -fun f( - parameter: (a: String, b: Int) -> (r: String, s: Int) -) - -step lambdasWithExplicitParameterTypes() -> ( - result: (a: String, b: Int) -> (r: String, s: Int) -) { - val myLambda = (a: Int, b: String) { - yield r = 1; - yield s = ""; - }; - yield result = (a: Int, b: String) { - yield r = 1; - yield s = ""; - }; - f( - (a: Int, b: String) { - yield r = 1; - yield s = ""; - } - ); -} - -step lambdasWithExplicitVariadicType() { - val myLambda = (a: Int, vararg b: String) { - yield r = 1; - yield s = ""; - }; -} - -step yieldedLambda() -> ( - result: (a: String, b: Int) -> (r: String, s: Int) -) { - yield result = (a, b) { - yield r = 1; - yield s = ""; - }; -} - -step argumentLambda() { - f( - (a, b) { - yield r = 1; - yield s = ""; - } - ); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/calls.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/calls.sdstest deleted file mode 100644 index 1ff1b8a70..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/calls.sdstest +++ /dev/null @@ -1,37 +0,0 @@ -package tests.typeComputer.expressions.calls - -class C() -enum E { - V(a: Int) -} -fun f1() -> r: String -fun f2() -> (r: String, s: Int) -step s1() -> r: String{ - yield r = ""; -} -step s2() -> (r: String, s: Int) { - yield r = ""; - yield s = 1; -} - -step mySteps( - p1: () -> r: String, - p2: () -> (r: String, s: Int) -) { - val classCall = C(); - val callableTypeCall1 = p1(); - val callableTypeCall2 = p2(); - val enumVariantCall = E.V(1); - val functionCall1 = f1(); - val functionCall2 = f2(); - val blockLambdaCall1 = (() { - yield r = ""; - })(); - val blockLambdaCall2 = (() { - yield r = ""; - yield s = 1; - })(); - val expressionLambdaCall = (() -> 1)(); - val stepCall1 = s1(); - val stepCall2 = s2(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/expressionLambdas.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/expressionLambdas.sdstest deleted file mode 100644 index 0de86f5b0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/expressionLambdas.sdstest +++ /dev/null @@ -1,27 +0,0 @@ -package tests.typeComputer.expressions.expressionLambdas - -fun f( - parameter: (a: String, b: Int) -> r: String -) - -step lambdasWithExplicitParameterTypes() -> ( - result: (a: String, b: Int) -> r: String -) { - val myLambda = (a: Int, b: String) -> 1; - yield result = (a: Int, b: String) -> 1; - f((a: Int, b: String) -> 1); -} - -step lambdasWithExplicitVariadicType() { - val myLambda = (a: Int, vararg b: String) -> 1; -} - -step yieldedLambda() -> ( - result: (a: String, b: Int) -> r: String -) { - yield result = (a, b) -> 1; -} - -step argumentLambda() { - f((a, b) -> 1); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/indexedAccesses.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/indexedAccesses.sdstest deleted file mode 100644 index 05c3fdcc9..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/indexedAccesses.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -package tests.typeComputer.expressions.indexedAccesses - -step myStep1(vararg params: Int) { - params[0]; -} - -step myStep2(vararg params: String) { - params[0]; -} - -step myStep3(params: String) { - params[0]; -} - -step myStep4() { - unresolved[0]; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/literals.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/literals.sdstest deleted file mode 100644 index d079ea96d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/literals.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package tests.typeComputer.expressions.literals - -pipeline myPipeline { - val booleanLiteral = true; - val floatLiteral = 1.0; - val intLiteral = 1; - val nullLiteral = null; - val stringLiteral = "myString"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/memberAccesses.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/memberAccesses.sdstest deleted file mode 100644 index 6380011ee..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/memberAccesses.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -package tests.typeComputer.expressions.memberAccesses - -class C { - static attr a: Int - static attr b: String - static attr c: Any? -} - -pipeline myPipeline { - C.a; - C.b; - C.c; - C.unresolved; - - C?.a; - C?.b; - C?.c; - C?.unresolved; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/arithmetic.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/arithmetic.sdstest deleted file mode 100644 index 6e5599ebd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/arithmetic.sdstest +++ /dev/null @@ -1,21 +0,0 @@ -package tests.typeComputer.operations.arithmetic - -pipeline myPipeline { - val additionIntInt = (1 + 1); - val subtractionIntInt = (1 - 1); - val multiplicationIntInt = (1 * 1); - val divisionIntInt = (1 / 1); - val negationInt = (-1); - - val additionIntFloat = (1 + 1.0); - val subtractionIntFloat = (1 - 1.0); - val multiplicationIntFloat = (1 * 1.0); - val divisionIntFloat = (1 / 1.0); - val negationFloat = (-1.0); - - val additionInvalid = (true + true); - val subtractionInvalid = (true - true); - val multiplicationInvalid = (true * true); - val divisionInvalid = (true / true); - val negationInvalid = (-true); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/comparison.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/comparison.sdstest deleted file mode 100644 index 4852f13d1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/comparison.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.typeComputer.operations.comparison - -pipeline myPipeline { - val lessThan = (1 < 1); - val lessThanOrEquals = (1 <= 1); - val greaterThanOrEquals = (1 >= 1); - val greaterThan = (1 > 1); - val lessThanInvalid = (true < true); - val lessThanOrEqualsInvalid = (true <= true); - val greaterThanOrEqualsInvalid = (true >= true); - val greaterThanInvalid = (true > true); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/elvis.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/elvis.sdstest deleted file mode 100644 index cbec0d26e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/elvis.sdstest +++ /dev/null @@ -1,21 +0,0 @@ -package tests.typeComputer.operations.elvis - -fun intOrNull() -> a: Int? -fun stringOrNull() -> s: String? - -pipeline elvisWithNonNullableLeftOperand { - 1 ?: intOrNull(); - 1 ?: 1; - 1 ?: 1.0; - 1 ?: ""; - 1 ?: null; -} - -pipeline elvisWithNullableLeftOperand { - val intOrNullElseIntOrNull = intOrNull() ?: intOrNull(); - val intOrNullElseNull = intOrNull() ?: null; - val intOrNullElseInt = intOrNull() ?: 1; - val intOrNullElseFloat = intOrNull() ?: 1.0; - val intOrNullElseString = intOrNull() ?: ""; - val intOrNullElseStringOrNull = intOrNull() ?: stringOrNull(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/equality.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/equality.sdstest deleted file mode 100644 index f2fdf402d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/equality.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.typeComputer.operations.equality - -pipeline myPipeline { - val equals = (1 == 1); - val notEquals = (1 != 1); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/logical.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/logical.sdstest deleted file mode 100644 index 5842ea0fd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/logical.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.typeComputer.operations.logical - -pipeline myPipeline { - val conjunction = (true and true); - val disjunction = (true or true); - val negation = (not true); - val conjunctionInvalid = (1 and 1); - val disjunctionInvalid = (1.0 or 1.0); - val negationInvalid = (not "true"); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/strictEquality.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/strictEquality.sdstest deleted file mode 100644 index 3e963776d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/operations/strictEquality.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.typeComputer.operations.strictEquality - -pipeline myPipeline { - val strictlyEquals = (1 === 1); - val notStrictlyEquals = (1 !== 1); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/parenthesizedExpressions.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/parenthesizedExpressions.sdstest deleted file mode 100644 index f13f0d73e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/parenthesizedExpressions.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.typeComputer.expressions.parenthesizedExpressions - -pipeline myPipeline { - (1); - (""); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/references.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/references.sdstest deleted file mode 100644 index 8070e72f7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/references.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.typeComputer.expressions.references - -pipeline myPipeline { - val a = 1; - val b = ""; - - a; - b; - unresolved; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/templateStrings.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/templateStrings.sdstest deleted file mode 100644 index 6caa64716..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/expressions/templateStrings.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.typeComputer.expressions.templateStrings - -pipeline myPipeline { - val templateString = "1 + 2 = {{ 1 + 2 }}"; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/callableTypes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/callableTypes.sdstest deleted file mode 100644 index 68976fc82..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/callableTypes.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.typeComputer.types.callableTypes - -fun myFun(f: (p1: Int, p2: String) -> (r1: Int, r2: String)) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/memberTypes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/memberTypes.sdstest deleted file mode 100644 index 764c55458..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/memberTypes.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package tests.typeComputer.types.memberTypes - -enum MyEnum { - MyVariant1 - MyVariant2 -} - -fun nonNullableMemberTypes(a: MyEnum.MyVariant1, b: MyEnum.MyVariant2) -fun nullableMemberTypes(a: MyEnum.MyVariant1?, b: MyEnum.MyVariant2?) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/namedTypes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/namedTypes.sdstest deleted file mode 100644 index cc749e651..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/namedTypes.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.typeComputer.types.namedTypes - -fun nonNullableNamedTypes(a: Int, b: String) -fun nullableNamedTypes(a: Int?, b: String?) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/parenthesizedTypes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/parenthesizedTypes.sdstest deleted file mode 100644 index 071a5dabf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/parenthesizedTypes.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.typeComputer.types.parenthesizedTypes - -fun myFun(a: (Int), b: (String)) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/unionTypes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/unionTypes.sdstest deleted file mode 100644 index dad2e1510..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/typeComputer/types/unionTypes.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -package tests.typeComputer.types.unionTypes - -fun myFun(a: union) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (only annotations).sdspipe b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (only annotations).sdspipe deleted file mode 100644 index d9d87a870..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (only annotations).sdspipe +++ /dev/null @@ -1,3 +0,0 @@ -// no_semantic_error "A file with declarations must declare its package." - -@AnnotationCall diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (only imports).sdspipe b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (only imports).sdspipe deleted file mode 100644 index bb7804749..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (only imports).sdspipe +++ /dev/null @@ -1,3 +0,0 @@ -// no_semantic_error "A file with declarations must declare its package." - -import myPackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (with declarations).sdspipe b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (with declarations).sdspipe deleted file mode 100644 index 22f368690..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/pipeline file (with declarations).sdspipe +++ /dev/null @@ -1,5 +0,0 @@ -// semantic_error "A file with declarations must declare its package." -step »s«() {} - -// no_semantic_error "A file with declarations must declare its package." -step »t«() {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (only annotations).sdsstub b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (only annotations).sdsstub deleted file mode 100644 index d9d87a870..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (only annotations).sdsstub +++ /dev/null @@ -1,3 +0,0 @@ -// no_semantic_error "A file with declarations must declare its package." - -@AnnotationCall diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (only imports).sdsstub b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (only imports).sdsstub deleted file mode 100644 index bb7804749..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (only imports).sdsstub +++ /dev/null @@ -1,3 +0,0 @@ -// no_semantic_error "A file with declarations must declare its package." - -import myPackage diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (with declarations).sdsstub b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (with declarations).sdsstub deleted file mode 100644 index 8825b18b1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/must declare package/stub file (with declarations).sdsstub +++ /dev/null @@ -1,5 +0,0 @@ -// semantic_error "A file with declarations must declare its package." -class »C« - -// no_semantic_error "A file with declarations must declare its package." -class »D« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/pipelineFileMustOnlyDeclarePipelinesAndSteps.sdspipe b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/pipelineFileMustOnlyDeclarePipelinesAndSteps.sdspipe deleted file mode 100644 index 21a74041f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/pipelineFileMustOnlyDeclarePipelinesAndSteps.sdspipe +++ /dev/null @@ -1,15 +0,0 @@ -package tests.pipelineFileMustOnlyDeclarePipelinesAndSteps - -// semantic_error "A pipeline file must only declare pipelines and steps." -annotation »MyAnnotation« -// semantic_error "A pipeline file must only declare pipelines and steps." -class »MyClass« -// semantic_error "A pipeline file must only declare pipelines and steps." -enum »MyEnum« -// semantic_error "A pipeline file must only declare pipelines and steps." -schema »MySchema« {} - -// no_semantic_error "A pipeline file must only declare pipelines and steps." -pipeline »myPipeline« {} -// no_semantic_error "A pipeline file must only declare pipelines and steps." -step »myStep«() {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/schemaFileMustOnlyDeclareSchemas.sdsschema b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/schemaFileMustOnlyDeclareSchemas.sdsschema deleted file mode 100644 index 5e53c20ab..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/schemaFileMustOnlyDeclareSchemas.sdsschema +++ /dev/null @@ -1,15 +0,0 @@ -package tests.schemaFileMustOnlyDeclareSchemas - -// semantic_error "A schema file must only declare schemas." -annotation »MyAnnotation« -// semantic_error "A schema file must only declare schemas." -class »MyClass« -// semantic_error "A schema file must only declare schemas." -enum »MyEnum« -// semantic_error "A schema file must only declare schemas." -pipeline »myPipeline« {} -// semantic_error "A schema file must only declare schemas." -step »myStep«() {} - -// no_semantic_error "A schema file must only declare schemas." -schema »myschema« {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/stubFileMustNotDeclarePipelinesSchemasOrSteps.sdsstub b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/stubFileMustNotDeclarePipelinesSchemasOrSteps.sdsstub deleted file mode 100644 index ac447721f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/stubFileMustNotDeclarePipelinesSchemasOrSteps.sdsstub +++ /dev/null @@ -1,15 +0,0 @@ -package tests.validation.declarations.compilationUnits.stubFileMustNotDeclarePipelinesSchemasOrSteps - -// semantic_error "A stub file must not declare pipelines, schemas or steps." -pipeline »myPipeline« {} -// semantic_error "A stub file must not declare pipelines, schemas or steps." -step »myStep«() {} -// semantic_error "A stub file must not declare pipelines, schemas or steps." -schema »MySchema« {} - -// no_semantic_error "A stub file must not declare pipelines, schemas or steps." -annotation »MyAnnotation« -// no_semantic_error "A stub file must not declare pipelines, schemas or steps." -class »MyClass« -// no_semantic_error "A stub file must not declare pipelines, schemas or steps." -enum »MyEnum« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesAcrossFiles.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesAcrossFiles.sdstest deleted file mode 100644 index 5116c4521..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesAcrossFiles.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -package safeds.lang - -// semantic_error "A declaration with qualified name 'safeds.lang.Any' exists already." -annotation »Any« - -// semantic_error "A declaration with qualified name 'safeds.lang.Any' exists already." -class »Any« - -// semantic_error "A declaration with qualified name 'safeds.lang.Any' exists already." -enum »Any« - -// semantic_error "A declaration with qualified name 'safeds.lang.Any' exists already." -fun »Any«() - -// semantic_error "A declaration with qualified name 'safeds.lang.Any' exists already." -step »Any«() {} - -// semantic_error "A declaration with qualified name 'safeds.lang.Any' exists already." -pipeline »Any« {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesInPipelineFile.sdspipe b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesInPipelineFile.sdspipe deleted file mode 100644 index ffb4f96cd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesInPipelineFile.sdspipe +++ /dev/null @@ -1,33 +0,0 @@ -package tests.uniqueNamesInPipelineFile - -// semantic_error "A declaration with name 'MyImport' exists already in this file." -import »somePackage.MyImport« -// semantic_error "A declaration with name 'MyImport' exists already in this file." -import »somePackage.MyImport« - -// semantic_error "A declaration with name 'MyAliasedImport' exists already in this file." -import somePackage.MyImport as »MyAliasedImport« -// semantic_error "A declaration with name 'MyAliasedImport' exists already in this file." -import somePackage.MyImport as »MyAliasedImport« - -// semantic_error "A declaration with name 'Bla' exists already in this file." -import »somePackage.Bla« -// semantic_error "A declaration with name 'Bla' exists already in this file." -import somePackage.Blup as »Bla« - - -// semantic_error "A declaration with name 's' exists already in this file." -step »s«() {} -// semantic_error "A declaration with name 's' exists already in this file." -step »s«() {} - -// semantic_error "A declaration with name 'p' exists already in this file." -pipeline »p« {} -// semantic_error "A declaration with name 'p' exists already in this file." -pipeline »p« {} - - -// semantic_error "A declaration with name 'Bla' exists already in this file." -step »Bla«() {} -// semantic_error "A declaration with name 'Bla' exists already in this file." -pipeline »Bla« {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesInStubFile.sdsstub b/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesInStubFile.sdsstub deleted file mode 100644 index 57e424c74..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/compilationUnits/uniqueNamesInStubFile.sdsstub +++ /dev/null @@ -1,47 +0,0 @@ -package tests.uniqueNamesInStubFile - -// semantic_error "A declaration with name 'MyImport' exists already in this file." -import »somePackage.MyImport« -// semantic_error "A declaration with name 'MyImport' exists already in this file." -import »somePackage.MyImport« - -// semantic_error "A declaration with name 'MyAliasedImport' exists already in this file." -import somePackage.MyImport as »MyAliasedImport« -// semantic_error "A declaration with name 'MyAliasedImport' exists already in this file." -import somePackage.MyImport as »MyAliasedImport« - -// semantic_error "A declaration with name 'Bla' exists already in this file." -import »somePackage.Bla« -// semantic_error "A declaration with name 'Bla' exists already in this file." -import somePackage.Blup as »Bla« - - -// semantic_error "A declaration with name 'MyAnnotation' exists already in this file." -annotation »MyAnnotation« -// semantic_error "A declaration with name 'MyAnnotation' exists already in this file." -annotation »MyAnnotation« - -// semantic_error "A declaration with name 'MyClass' exists already in this file." -class »MyClass« -// semantic_error "A declaration with name 'MyClass' exists already in this file." -class »MyClass« - -// semantic_error "A declaration with name 'MyEnum' exists already in this file." -enum »MyEnum« -// semantic_error "A declaration with name 'MyEnum' exists already in this file." -enum »MyEnum« - -// semantic_error "A declaration with name 'myFun' exists already in this file." -fun »myFun«() -// semantic_error "A declaration with name 'myFun' exists already in this file." -fun »myFun«() - - -// semantic_error "A declaration with name 'Bla' exists already in this file." -annotation »Bla« -// semantic_error "A declaration with name 'Bla' exists already in this file." -class »Bla« -// semantic_error "A declaration with name 'Bla' exists already in this file." -enum »Bla« -// semantic_error "A declaration with name 'Bla' exists already in this file." -fun »Bla«() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/parameter types.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/parameter types.sdstest deleted file mode 100644 index 2d8fc1062..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/parameter types.sdstest +++ /dev/null @@ -1,52 +0,0 @@ -package tests.validation.declarations.annotations.parameterTypes - -class MyClass - -enum ConstantEnum { - Variant1 - Variant2 -} - -enum NonConstantEnum { - Variant1(param: Int) - Variant2 -} - -annotation MyAnnotation( - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - booleanParam: »Boolean«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableBooleanParam: »Boolean?«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - floatParam: »Float«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableFloatParam: »Float?«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - intParam: »Int«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableIntParam: »Int?«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - stringParam: »String«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableStringParam: »String?«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - constantEnumParam: »ConstantEnum«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableConstantEnumParam: »ConstantEnum?«, - // semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nonConstantEnumParam: »NonConstantEnum«, - // semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableNonConstantEnumParam: »NonConstantEnum?«, - // semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - classParam: »MyClass«, - // semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableClassParam: »MyClass?«, - // semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - unresolvedParam: »Unresolved«, - // semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - nullableUnresolvedParam: »Unresolved?«, - // semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - callableParam: »() -> ()«, - // no_semantic_error "Parameters of annotations must have type Boolean, Float, Int, String, or a constant enum." - vararg variadicParameter: »Int«, -) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/uniqueNames.sdstest deleted file mode 100644 index 63d76cbbc..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/uniqueNames.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.uniqueNames - -annotation A( - // semantic_error "A parameter with name 'duplicateParameter' exists already in this annotation." - »duplicateParameter«: Int, - // semantic_error "A parameter with name 'duplicateParameter' exists already in this annotation." - »duplicateParameter«: Int, - // no_semantic_error "A parameter with name 'uniqueParameter' exists already in this annotation." - »uniqueParameter«: Int -) \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/unnecessaryParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/unnecessaryParameterList.sdstest deleted file mode 100644 index c61548141..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/annotations/unnecessaryParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.validation.declarations.annotations.unnecessaryParameterList - -// semantic_info "Unnecessary parameter list." -annotation MyAnnotation1»()« - -// no_semantic_info "Unnecessary parameter list." -annotation MyAnnotation2»(a: Int)« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/attributes/mustHaveType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/attributes/mustHaveType.sdstest deleted file mode 100644 index a5fc9c8de..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/attributes/mustHaveType.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.mustHaveType - -class MyClass { - // semantic_error "An attribute must have a type." - attr »myAttribute1« - // no_semantic_error "An attribute must have a type." - attr »myAttribute2«: Int -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/acyclicSuperTypes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/acyclicSuperTypes.sdstest deleted file mode 100644 index 97ef2fb19..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/acyclicSuperTypes.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.validation.declarations.classes.acyclicSuperTypes - -// semantic_error "A class must not directly or indirectly be a subtype of itself." -class MyClass1 sub »MyClass3« -// semantic_error "A class must not directly or indirectly be a subtype of itself." -class MyClass2 sub »MyClass1« -// semantic_error "A class must not directly or indirectly be a subtype of itself." -class MyClass3 sub »MyClass2« - -class MyClass4 -// no_semantic_error "A class must not directly or indirectly be a subtype of itself." -class MyClass5 sub »MyClass4« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/inheritedMembersMustHaveUniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/inheritedMembersMustHaveUniqueNames.sdstest deleted file mode 100644 index 789f73ed8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/inheritedMembersMustHaveUniqueNames.sdstest +++ /dev/null @@ -1,42 +0,0 @@ -package tests.validation.declarations.classes.mustInheritOnlyOneClass - -class MyClass1 { - attr attribute1: Int - attr attribute2: Int - - fun method1() - fun method2() -} -class MyClass2 { - attr attribute1: Int - attr method2: Int - - fun method1() - fun attribute2() -} -class MyClass3 sub MyClass1 - - -// semantic_error "Inherits multiple members called 'attribute1'." -class »MyClass4« sub MyClass1, MyClass2 - -// semantic_error "Inherits multiple members called 'attribute2'." -class »MyClass5« sub MyClass1, MyClass2 - -// semantic_error "Inherits multiple members called 'method1'." -class »MyClass6« sub MyClass1, MyClass2 - -// semantic_error "Inherits multiple members called 'method2'." -class »MyClass7« sub MyClass1, MyClass2 - -// no_semantic_error "Inherits multiple members called 'attribute1'." -class »MyClass8« sub MyClass1, MyClass3 - -// no_semantic_error "Inherits multiple members called 'method1'." -class »MyClass9« sub MyClass1, MyClass3 - -// no_semantic_error "Inherits multiple members called 'attribute1'." -class »MyClass10« sub MyClass1 - -// no_semantic_error "Inherits multiple members called 'method1'." -class »MyClass11« sub MyClass1 diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/mustInheritOnlyClasses.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/mustInheritOnlyClasses.sdstest deleted file mode 100644 index 50e26a84b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/mustInheritOnlyClasses.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.validation.declarations.classes.mustInheritOnlyClasses - -class MyClass -enum MyEnum - - -// no_semantic_error "A class must only inherit classes." -// semantic_error "A class must only inherit classes." -// no_semantic_error "A class must only inherit classes." -class TestClass sub »MyClass«, - »MyEnum«, - »UnresolvedClass«, diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/only one protocol per class.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/only one protocol per class.sdstest deleted file mode 100644 index 88ecf550c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/only one protocol per class.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -package tests.validation.declarations.classes.onlyOneProtocolPerClass - -class MyClass1 { - - // semantic_error "A class must have only one protocol." - »protocol {}« - // semantic_error "A class must have only one protocol." - »protocol {}« -} - -class MyClass2 { - - // no_semantic_error "A class must have only one protocol." - »protocol {}« -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/protocol reference must point to instance member.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/protocol reference must point to instance member.sdstest deleted file mode 100644 index 1f2580982..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/protocol reference must point to instance member.sdstest +++ /dev/null @@ -1,20 +0,0 @@ -package tests.validation.declarations.classes.protocolReferenceMustPointToInstanceMember - -class MyClass { - static attr staticAttribute: Int - attr instanceAttribute: Int - - static fun staticMethod() - fun instanceMethod() - - protocol { - // semantic_error "Must only reference instance members." - subterm staticAttributeReference = »staticAttribute«; - // semantic_error "Must only reference instance members." - subterm staticMethodReference = »staticMethod«; - // no_semantic_error "Must only reference instance members." - subterm instanceAttributeReference = »instanceAttribute«; - // no_semantic_error "Must only reference instance members." - subterm instanceMethodReference = »instanceMethod«; - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unique names for protocol subterms.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unique names for protocol subterms.sdstest deleted file mode 100644 index b131fc6f4..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unique names for protocol subterms.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -package tests.validation.declarations.classes.uniqueNamesForProtocolSubterms - -class MyClass { - - protocol { - // semantic_error "A subterm with name 'duplicateName' exists already in this protocol." - subterm »duplicateName« = .; - // semantic_error "A subterm with name 'duplicateName' exists already in this protocol." - subterm »duplicateName« = .; - // no_semantic_error "A subterm with name 'uniqueName' exists already in this protocol." - subterm »uniqueName« = .; - } -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/uniqueNames.sdstest deleted file mode 100644 index e75ef047d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/uniqueNames.sdstest +++ /dev/null @@ -1,41 +0,0 @@ -package tests.uniqueNames - -class MyClass( - // semantic_error "A parameter with name 'duplicateParameter' exists already in this class." - »duplicateParameter«: Int, - // semantic_error "A parameter with name 'duplicateParameter' exists already in this class." - »duplicateParameter«: Int, - // no_semantic_error "A parameter with name 'uniqueParameter' exists already in this class." - »uniqueParameter«: Int, -) { - - // semantic_error "A declaration with name 'myAttribute' exists already in this class." - attr »myAttribute«: Int - // semantic_error "A declaration with name 'myAttribute' exists already in this class." - attr »myAttribute«: Int - - // semantic_error "A declaration with name 'MyClass' exists already in this class." - class »MyClass« - // semantic_error "A declaration with name 'MyClass' exists already in this class." - class »MyClass« - - // semantic_error "A declaration with name 'myFun' exists already in this class." - fun »myFun«() - // semantic_error "A declaration with name 'myFun' exists already in this class." - fun »myFun«() - - // semantic_error "A declaration with name 'MyEnum' exists already in this class." - enum »MyEnum« - // semantic_error "A declaration with name 'MyEnum' exists already in this class." - enum »MyEnum« - - - // semantic_error "A declaration with name 'Bla' exists already in this class." - attr »Bla«: Int - // semantic_error "A declaration with name 'Bla' exists already in this class." - class »Bla« - // semantic_error "A declaration with name 'Bla' exists already in this class." - fun »Bla«() - // semantic_error "A declaration with name 'Bla' exists already in this class." - enum »Bla« -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/uniqueParentTypes.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/uniqueParentTypes.sdstest deleted file mode 100644 index 88833efae..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/uniqueParentTypes.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -package tests.uniqueParentTypes - -class MyClass1 -class MyClass2 - -class MyOpenClass1 -class MyOpenClass2 - -// semantic_error "Parent types must be unique." -// semantic_error "Parent types must be unique." -// no_semantic_error "Parent types must be unique." -// semantic_error "Parent types must be unique." -// semantic_error "Parent types must be unique." -// no_semantic_error "Parent types must be unique." -class MyClass4 sub »MyClass1«, »MyClass1«, »MyClass2«, - »MyOpenClass1«, »MyOpenClass1«, »MyOpenClass2« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unnecessaryBody.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unnecessaryBody.sdstest deleted file mode 100644 index 42f194034..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unnecessaryBody.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -package tests.validation.declarations.classes.unnecessaryBody - - -// semantic_info "Unnecessary class body." -class MyClass1 »{}« - -// no_semantic_info "Unnecessary class body." -class MyClass2 »{ - fun f() -}« - -// no_semantic_info "Unnecessary class body." -class MyClass3 »{ - protocol {} -}« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unnecessaryTypeParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unnecessaryTypeParameterList.sdstest deleted file mode 100644 index 4255cd0e1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/classes/unnecessaryTypeParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.validation.declarations.classes.unnecessaryTypeParameterList - -// semantic_info "Unnecessary type parameter list." -class MyClass1»<>« - -// no_semantic_info "Unnecessary type parameter list." -class MyClass2»« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/deprecation.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/deprecation.sdstest deleted file mode 100644 index 24c1256a2..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/deprecation.sdstest +++ /dev/null @@ -1,178 +0,0 @@ -package tests.validation.declarations.deprecation - -@Deprecated -annotation DeprecatedAnnotation -annotation ValidAnnotation - -@Deprecated -class DeprecatedClass -class ValidClass { - - @Deprecated - attr deprecatedAttribute: Int - attr validAttribute: Int -} - -@Deprecated -enum DeprecatedEnum -enum ValidEnum { - @Deprecated DeprecatedEnumVariant - ValidEnumVariant -} - -@Deprecated -fun deprecatedFunction() -fun validFunction( - @Deprecated deprecatedParameter: Int = 1, - validParameter: Int = 1 -) -> ( - @Deprecated deprecatedResult: Int, - validResult: Int -) - -fun functionWithTypeParameters<@Deprecated DeprecatedTypeParameter, ValidTypeParameter>() { - - /* - * Showing an error for yields is pointless, since constraints must stay. - * Deprecation is only relevant for callers. - */ - constraint { - // no_semantic_warning "The referenced declaration is deprecated." - »DeprecatedTypeParameter« sub Int, - // no_semantic_warning "The referenced declaration is deprecated." - »ValidTypeParameter« sub Int - } -} - -@Deprecated step deprecatedStep() {} -step validStep() {} - -// semantic_warning "The used annotation is deprecated." -@»DeprecatedAnnotation« -// no_semantic_warning "The used annotation is deprecated." -@»ValidAnnotation« -// no_semantic_warning "The used annotation is deprecated." -@»Unresolved« -step testStep1( - - // semantic_warning "The referenced declaration is deprecated." - @Deprecated deprecatedParameter: »DeprecatedClass« = 1, - // no_semantic_warning "The referenced declaration is deprecated." - validParameter: »ValidClass« = 1, - - // semantic_warning "The referenced declaration is deprecated." - param3: »DeprecatedEnum« = 1, - // no_semantic_warning "The referenced declaration is deprecated." - param4: »ValidEnum« = 1, - // no_semantic_warning "The referenced declaration is deprecated." - param5: »Unresolved« = 1 -) --> ( - @Deprecated deprecatedResult: Int, - validResult: Int -) { - - // no_semantic_warning "The referenced declaration is deprecated." - »deprecatedParameter«; - // no_semantic_warning "The referenced declaration is deprecated." - »validParameter«; - - // semantic_warning "The referenced declaration is deprecated." - validParameter.»deprecatedAttribute«; - // no_semantic_warning "The referenced declaration is deprecated." - validParameter.»validAttribute«; - - // semantic_warning "The referenced declaration is deprecated." - ValidEnum.»DeprecatedEnumVariant«; - // no_semantic_warning "The referenced declaration is deprecated." - ValidEnum.»ValidEnumVariant«; - - // semantic_warning "The referenced declaration is deprecated." - »deprecatedFunction«(); - // no_semantic_warning "The referenced declaration is deprecated." - »validFunction«(); - - validFunction( - // semantic_warning "The corresponding parameter is deprecated." - »deprecatedParameter = 1«, - // no_semantic_warning "The corresponding parameter is deprecated." - »validParameter = 1«, - // no_semantic_warning "The corresponding parameter is deprecated." - »unresolved = 1«, - ); - - validFunction( - // semantic_warning "The corresponding parameter is deprecated." - »1«, - // no_semantic_warning "The corresponding parameter is deprecated." - »1«, - // no_semantic_warning "The corresponding parameter is deprecated." - »1«, - ); - - // semantic_warning "The referenced declaration is deprecated." - validFunction().»deprecatedResult«; - - // no_semantic_warning "The referenced declaration is deprecated." - validFunction().»validResult«; - - functionWithTypeParameters< - // semantic_warning "The corresponding type parameter is deprecated." - »DeprecatedTypeParameter = Int«, - // no_semantic_warning "The corresponding type parameter is deprecated." - »ValidTypeParameter = Int«, - // no_semantic_warning "The corresponding type parameter is deprecated." - »Unresolved = Int« - >(); - - functionWithTypeParameters< - // semantic_warning "The corresponding type parameter is deprecated." - »Int«, - // no_semantic_warning "The corresponding type parameter is deprecated." - »Int«, - // no_semantic_warning "The corresponding type parameter is deprecated." - »Int« - >(); - - // semantic_warning "The referenced declaration is deprecated." - »deprecatedStep«(); - // no_semantic_warning "The referenced declaration is deprecated." - »validStep«(); - - // no_semantic_warning "The referenced declaration is deprecated." - »unresolved«; - - /* - * Showing an error for yields is pointless, since we must yield something. - * Deprecation is only relevant for callers. - */ - - // no_semantic_warning "The referenced declaration is deprecated." - yield »deprecatedResult« = 1; - // no_semantic_warning "The referenced declaration is deprecated." - yield »validResult« = 1; -} - -step testStep2() -> (result1: Int, result2: Int, result3: Int) { - // semantic_warning "The assigned declaration is deprecated." - // no_semantic_warning "The assigned declaration is deprecated." - // no_semantic_warning "The assigned declaration is deprecated." - »val a«, »val b«, »val c« = validFunction(); - - // semantic_warning "The assigned declaration is deprecated." - // no_semantic_warning "The assigned declaration is deprecated." - // no_semantic_warning "The assigned declaration is deprecated." - »yield result1«, »yield result2«, »yield result3« = validFunction(); - - // no_semantic_warning "The assigned declaration is deprecated." - // no_semantic_warning "The assigned declaration is deprecated." - // no_semantic_warning "The assigned declaration is deprecated." - »_«, »_«, »_« = validFunction(); - - // no_semantic_warning "The assigned declaration is deprecated." - »val d« = a; - // no_semantic_warning "The assigned declaration is deprecated." - »val e« = b; - // no_semantic_warning "The assigned declaration is deprecated." - »val f« = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/uniqueNames.sdstest deleted file mode 100644 index 1de8ad7cd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/uniqueNames.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.validation.declarations.enumVariants.uniqueNames - -enum MyEnum { - MyEnumVariant( - // semantic_error "A parameter with name 'duplicateParameter' exists already in this enum variant." - »duplicateParameter«: Int, - // semantic_error "A parameter with name 'duplicateParameter' exists already in this enum variant." - »duplicateParameter«: Int, - // no_semantic_error "A parameter with name 'uniqueParameter' exists already in this enum variant." - »uniqueParameter«: Int - ) -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/unnecessaryParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/unnecessaryParameterList.sdstest deleted file mode 100644 index 931bc68c7..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/unnecessaryParameterList.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.validation.declarations.enumVariants.unnecessaryParameterList - -enum MyEnum { - // semantic_info "Unnecessary parameter list." - MyVariant1»()« - // semantic_info "Unnecessary parameter list." - MyVariant1»()« - // no_semantic_info "Unnecessary parameter list." - MyVariant2»(a: Int)« -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/unnecessaryTypeParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/unnecessaryTypeParameterList.sdstest deleted file mode 100644 index 59085fdea..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enumVariants/unnecessaryTypeParameterList.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.validation.declarations.enumVariants.unnecessaryTypeParameterList - -enum MyEnum { - // semantic_info "Unnecessary type parameter list." - MyVariant1»<>« - // no_semantic_info "Unnecessary type parameter list." - MyVariant2»« -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enums/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enums/uniqueNames.sdstest deleted file mode 100644 index 9d3e07963..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enums/uniqueNames.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.uniqueNames - -enum MyEnum { - // semantic_error "A declaration with name 'INSTANCE1' exists already in this enum." - »INSTANCE1« - // semantic_error "A declaration with name 'INSTANCE1' exists already in this enum." - »INSTANCE1« - // no_semantic_error "A declaration with name 'INSTANCE2' exists already in this enum." - »INSTANCE2« -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enums/unnecessaryBody.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enums/unnecessaryBody.sdstest deleted file mode 100644 index 717c38328..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/enums/unnecessaryBody.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package tests.validation.declarations.enums.unnecessaryBody - -// semantic_info "Unnecessary enum body." -enum MyEnum1 »{}« - -// no_semantic_info "Unnecessary enum body." -enum MyEnum2 »{ - INSTANCE -}« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/experimental.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/experimental.sdstest deleted file mode 100644 index 71634726e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/experimental.sdstest +++ /dev/null @@ -1,178 +0,0 @@ -package tests.validation.declarations.experimental - -@Experimental -annotation ExperimentalAnnotation -annotation ValidAnnotation - -@Experimental -class ExperimentalClass -class ValidClass { - - @Experimental - attr experimentalAttribute: Int - attr validAttribute: Int -} - -@Experimental -enum ExperimentalEnum -enum ValidEnum { - @Experimental ExperimentalEnumVariant - ValidEnumVariant -} - -@Experimental -fun experimentalFunction() -fun validFunction( - @Experimental experimentalParameter: Int = 1, - validParameter: Int = 1 -) -> ( - @Experimental experimentalResult: Int, - validResult: Int -) - -fun functionWithTypeParameters<@Experimental ExperimentalTypeParameter, ValidTypeParameter>() { - - /* - * Showing an error for yields is pointless, since constraints must stay. - * Deprecation is only relevant for callers. - */ - constraint { - // no_semantic_warning "The referenced declaration is experimental." - »ExperimentalTypeParameter« sub Int, - // no_semantic_warning "The referenced declaration is experimental." - »ValidTypeParameter« sub Int - } -} - -@Experimental step experimentalStep() {} -step validStep() {} - -// semantic_warning "The used annotation is experimental." -@»ExperimentalAnnotation« -// no_semantic_warning "The used annotation is experimental." -@»ValidAnnotation« -// no_semantic_warning "The used annotation is experimental." -@»Unresolved« -step testStep1( - - // semantic_warning "The referenced declaration is experimental." - @Experimental experimentalParameter: »ExperimentalClass« = 1, - // no_semantic_warning "The referenced declaration is experimental." - validParameter: »ValidClass« = 1, - - // semantic_warning "The referenced declaration is experimental." - param3: »ExperimentalEnum« = 1, - // no_semantic_warning "The referenced declaration is experimental." - param4: »ValidEnum« = 1, - // no_semantic_warning "The referenced declaration is experimental." - param5: »Unresolved« = 1 -) --> ( - @Experimental experimentalResult: Int, - validResult: Int -) { - - // no_semantic_warning "The referenced declaration is experimental." - »experimentalParameter«; - // no_semantic_warning "The referenced declaration is experimental." - »validParameter«; - - // semantic_warning "The referenced declaration is experimental." - validParameter.»experimentalAttribute«; - // no_semantic_warning "The referenced declaration is experimental." - validParameter.»validAttribute«; - - // semantic_warning "The referenced declaration is experimental." - ValidEnum.»ExperimentalEnumVariant«; - // no_semantic_warning "The referenced declaration is experimental." - ValidEnum.»ValidEnumVariant«; - - // semantic_warning "The referenced declaration is experimental." - »experimentalFunction«(); - // no_semantic_warning "The referenced declaration is experimental." - »validFunction«(); - - validFunction( - // semantic_warning "The corresponding parameter is experimental." - »experimentalParameter = 1«, - // no_semantic_warning "The corresponding parameter is experimental." - »validParameter = 1«, - // no_semantic_warning "The corresponding parameter is experimental." - »unresolved = 1«, - ); - - validFunction( - // semantic_warning "The corresponding parameter is experimental." - »1«, - // no_semantic_warning "The corresponding parameter is experimental." - »1«, - // no_semantic_warning "The corresponding parameter is experimental." - »1«, - ); - - // semantic_warning "The referenced declaration is experimental." - validFunction().»experimentalResult«; - - // no_semantic_warning "The referenced declaration is experimental." - validFunction().»validResult«; - - functionWithTypeParameters< - // semantic_warning "The corresponding type parameter is experimental." - »ExperimentalTypeParameter = Int«, - // no_semantic_warning "The corresponding type parameter is experimental." - »ValidTypeParameter = Int«, - // no_semantic_warning "The corresponding type parameter is experimental." - »Unresolved = Int« - >(); - - functionWithTypeParameters< - // semantic_warning "The corresponding type parameter is experimental." - »Int«, - // no_semantic_warning "The corresponding type parameter is experimental." - »Int«, - // no_semantic_warning "The corresponding type parameter is experimental." - »Int« - >(); - - // semantic_warning "The referenced declaration is experimental." - »experimentalStep«(); - // no_semantic_warning "The referenced declaration is experimental." - »validStep«(); - - // no_semantic_warning "The referenced declaration is experimental." - »unresolved«; - - /* - * Showing an error for yields is pointless, since we must yield something. - * Deprecation is only relevant for callers. - */ - - // no_semantic_warning "The referenced declaration is experimental." - yield »experimentalResult« = 1; - // no_semantic_warning "The referenced declaration is experimental." - yield »validResult« = 1; -} - -step testStep2() -> (result1: Int, result2: Int, result3: Int) { - // semantic_warning "The assigned declaration is experimental." - // no_semantic_warning "The assigned declaration is experimental." - // no_semantic_warning "The assigned declaration is experimental." - »val a«, »val b«, »val c« = validFunction(); - - // semantic_warning "The assigned declaration is experimental." - // no_semantic_warning "The assigned declaration is experimental." - // no_semantic_warning "The assigned declaration is experimental." - »yield result1«, »yield result2«, »yield result3« = validFunction(); - - // no_semantic_warning "The assigned declaration is experimental." - // no_semantic_warning "The assigned declaration is experimental." - // no_semantic_warning "The assigned declaration is experimental." - »_«, »_«, »_« = validFunction(); - - // no_semantic_warning "The assigned declaration is experimental." - »val d« = a; - // no_semantic_warning "The assigned declaration is experimental." - »val e« = b; - // no_semantic_warning "The assigned declaration is experimental." - »val f« = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/nonStaticPropagates.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/nonStaticPropagates.sdstest deleted file mode 100644 index e7fd4d980..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/nonStaticPropagates.sdstest +++ /dev/null @@ -1,18 +0,0 @@ -package tests.staticPropagates - -class MyOpenClass { - static fun staticFunction1() - fun nonStaticFunction1() -} - -class MyClass sub MyOpenClass { - // no_semantic_error "One of the supertypes of this class declares a non-static function with this name, so this must be non-static as well." - static fun »ownStaticFunction«() - // no_semantic_error "One of the supertypes of this class declares a non-static function with this name, so this must be non-static as well." - fun »ownNonStaticFunction«() - - // no_semantic_error "One of the supertypes of this class declares a non-static function with this name, so this must be non-static as well." - static fun »staticFunction1«() - // semantic_error "One of the supertypes of this class declares a non-static function with this name, so this must be non-static as well." - static fun »nonStaticFunction1«() -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/purePropagates.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/purePropagates.sdstest deleted file mode 100644 index cd2fdb22b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/purePropagates.sdstest +++ /dev/null @@ -1,21 +0,0 @@ -package tests.validation.declarations.functions.purePropagates - -class MyOpenClass { - @Pure fun pureFunction1() - @Pure fun pureFunction2() - fun impureFunction1() -} - -class MyClass sub MyOpenClass { - // no_semantic_error "One of the supertypes of this class declares a pure function with this name, so this must be pure as well." - @Pure fun »ownPureFunction«() - // no_semantic_error "One of the supertypes of this class declares a pure function with this name, so this must be pure as well." - fun »ownImpureFunction«() - - // semantic_error "One of the supertypes of this class declares a pure function with this name, so this must be pure as well." - fun »pureFunction1«() - // no_semantic_error "One of the supertypes of this class declares a pure function with this name, so this must be pure as well." - @Pure fun »pureFunction2«() - // no_semantic_error "One of the supertypes of this class declares a pure function with this name, so this must be pure as well." - @Pure fun »impureFunction1«() -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/staticPropagates.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/staticPropagates.sdstest deleted file mode 100644 index 549f0c7de..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/staticPropagates.sdstest +++ /dev/null @@ -1,21 +0,0 @@ -package tests.validation.declarations.functions.staticPropagates - -class MyOpenClass { - static fun staticFunction1() - static fun staticFunction2() - fun nonStaticFunction1() -} - -class MyClass sub MyOpenClass { - // no_semantic_error "One of the supertypes of this class declares a static function with this name, so this must be static as well." - static fun »ownStaticFunction«() - // no_semantic_error "One of the supertypes of this class declares a static function with this name, so this must be static as well." - fun »ownNonStaticFunction«() - - // semantic_error "One of the supertypes of this class declares a static function with this name, so this must be static as well." - fun »staticFunction1«() - // no_semantic_error "One of the supertypes of this class declares a static function with this name, so this must be static as well." - static fun »staticFunction2«() - // no_semantic_error "One of the supertypes of this class declares a static function with this name, so this must be static as well." - static fun »nonStaticFunction1«() -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/uniqueNames.sdstest deleted file mode 100644 index 6043c7865..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/uniqueNames.sdstest +++ /dev/null @@ -1,21 +0,0 @@ -package tests.uniqueNames - -fun f( - // semantic_error "A parameter or result with name 'duplicateParameter' exists already in this function." - »duplicateParameter«: Int, - // semantic_error "A parameter or result with name 'duplicateParameter' exists already in this function." - »duplicateParameter«: Int, - // no_semantic_error "A parameter or result with name 'uniqueParameter' exists already in this function." - »uniqueParameter«: Int, - // semantic_error "A parameter or result with name 'parameterAndResult' exists already in this function." - »parameterAndResult«: Int -) -> ( - // semantic_error "A parameter or result with name 'duplicateResult' exists already in this function." - »duplicateResult«: Int, - // semantic_error "A parameter or result with name 'duplicateResult' exists already in this function." - »duplicateResult«: Int, - // no_semantic_error "A parameter or result with name 'uniqueResult' exists already in this function." - »uniqueResult«: Int, - // semantic_error "A parameter or result with name 'parameterAndResult' exists already in this function." - »parameterAndResult«: Int -) \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/unnecessaryResultList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/unnecessaryResultList.sdstest deleted file mode 100644 index da681d41d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/unnecessaryResultList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.validation.declarations.functions.unnecessaryResultList - -// semantic_info "Unnecessary result list." -fun myFun1() »-> ()« - -// no_semantic_info "Unnecessary result list." -fun myFun2() »-> (r: Int)« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/unnecessaryTypeParameterList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/unnecessaryTypeParameterList.sdstest deleted file mode 100644 index d403e7e68..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/functions/unnecessaryTypeParameterList.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.validation.declarations.functions.unnecessaryTypeParameterList - -// semantic_info "Unnecessary type parameter list." -fun myFun1»<>«() - -// no_semantic_info "Unnecessary type parameter list." -fun myFun2»«() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/imports/noWildcardImportWithAlias.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/imports/noWildcardImportWithAlias.sdstest deleted file mode 100644 index b97e9de89..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/imports/noWildcardImportWithAlias.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.languageTests.validation.declarations.imports.noWildcardImportWithAlias - -// semantic_error "A wildcard import must not have an alias." -import stuff.* »as Stuff« -// no_semantic_error "A wildcard import must not have an alias." -import stuff »as Stuff« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/imports/unresolvedNamespace.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/imports/unresolvedNamespace.sdstest deleted file mode 100644 index eabeed314..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/imports/unresolvedNamespace.sdstest +++ /dev/null @@ -1,15 +0,0 @@ -package tests.unresolvedNamespace - -// semantic_error "No declaration with qualified name 'safeds.langs.Any' exists." -import »safeds.langs.Any« -// no_semantic_error "No declaration with qualified name 'safeds.lang.Any' exists." -import »safeds.lang.Any« -// no_semantic_error "No declaration with qualified name 'tests.unresolvedNamespace.C' exists." -import »tests.unresolvedNamespace.C« - -// semantic_error "No package with qualified name 'safeds.langs' exists." -import »safeds.langs.*« -// no_semantic_error "No package with qualified name 'safeds.model' exists." -import »safeds.lang.*« - -class C diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/block lambda prefix.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/block lambda prefix.sdstest deleted file mode 100644 index c48a010bf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/block lambda prefix.sdstest +++ /dev/null @@ -1,7 +0,0 @@ -package tests.validation.declarations.blockLambdaPrefix - -// semantic_error "Names of declarations must not start with '__block_lambda_'. This is reserved for code generation of block lambdas." -class »__block_lambda_0« - -// no_semantic_error "Names of declarations must not start with '__block_lambda_'. This is reserved for code generation of block lambdas." -class »_block_lambda_1« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/name convention.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/name convention.sdstest deleted file mode 100644 index 8b5362ede..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/name convention.sdstest +++ /dev/null @@ -1,132 +0,0 @@ - -package tests.validation.declarations.nameCasing - -// no_semantic_warning "Names of annotations should be UpperCamelCase." -annotation »AnnotationUppercase1« -// semantic_warning "Names of annotations should be UpperCamelCase." -annotation »annotationLowercase« -// semantic_warning "Names of annotations should be UpperCamelCase." -annotation »_annotationUnderscore« -// semantic_warning "Names of annotations should be UpperCamelCase." -annotation »Annotation_Snake_Case« - -// no_semantic_warning "Names of classes should be UpperCamelCase." -class »ClassUppercase1« -// semantic_warning "Names of classes should be UpperCamelCase." -class »classLowercase« -// semantic_warning "Names of classes should be UpperCamelCase." -class »_classUnderscore« -// semantic_warning "Names of classes should be UpperCamelCase." -class »Class_Snake_Case« { - // semantic_warning "Names of attributes should be lowerCamelCase." - attr »AttributeUppercase«: Int - // no_semantic_warning "Names of attributes should be lowerCamelCase." - attr »attributeLowercase1«: Int - // semantic_warning "Names of attributes should be lowerCamelCase." - attr »_attributeUnderscore«: Int - // semantic_warning "Names of attributes should be lowerCamelCase." - attr »attribute_snake_case«: Int - - protocol { - // semantic_warning "Names of protocol subterms should be lowerCamelCase." - subterm »SubtermUppercase« = .; - // no_semantic_warning "Names of protocol subterms should be lowerCamelCase." - subterm »subtermLowercase1« = .; - // semantic_warning "Names of protocol subterms should be lowerCamelCase." - subterm »_subtermUnderscore« = .; - // semantic_warning "Names of protocol subterms should be lowerCamelCase." - subterm »subterm_snake_case« = .; - } -} - -// no_semantic_warning "Names of enums should be UpperCamelCase." -enum »EnumUppercase1« -// semantic_warning "Names of enums should be UpperCamelCase." -enum »enumLowercase« -// semantic_warning "Names of enums should be UpperCamelCase." -enum »_enumUnderscore« -// semantic_warning "Names of enums should be UpperCamelCase." -enum »Enum_Snake_Case« { - // no_semantic_warning "Names of enum variants should be UpperCamelCase." - »EnumVariantUppercase1« - // semantic_warning "Names of enum variants should be UpperCamelCase." - »enumVariantLowercase« - // semantic_warning "Names of enum variants should be UpperCamelCase." - »_enumVariantUnderscore« - // semantic_warning "Names of enum variants should be UpperCamelCase." - »Enum_Variant_Snake_Case«< - // no_semantic_warning "Names of type parameters should be UpperCamelCase." - »TypeParameterUppercase«, - // semantic_warning "Names of type parameters should be UpperCamelCase." - »typeParameterLowercase1«, - // semantic_warning "Names of type parameters should be UpperCamelCase." - »_typeParameterUnderscore«, - // semantic_warning "Names of type parameters should be UpperCamelCase." - »typeParameter_snake_case« - > -} - -// semantic_warning "Names of functions should be lowerCamelCase." -fun »FunctionUppercase«() -// no_semantic_warning "Names of functions should be lowerCamelCase." -fun »functionLowercase1«() -// semantic_warning "Names of functions should be lowerCamelCase." -fun »_functionUnderscore«() -// semantic_warning "Names of functions should be lowerCamelCase." -fun »function_snake_case«( - // semantic_warning "Names of parameters should be lowerCamelCase." - »ParameterUppercase«: Int, - // no_semantic_warning "Names of parameters should be lowerCamelCase." - »parameterLowercase1«: Int, - // semantic_warning "Names of parameters should be lowerCamelCase." - »_parameterUnderscore«: Int, - // semantic_warning "Names of parameters should be lowerCamelCase." - »parameter_snake_case«: Int -) -> ( - // semantic_warning "Names of results should be lowerCamelCase." - »ResultUppercase«: Int, - // no_semantic_warning "Names of results should be lowerCamelCase." - »resultLowercase1«: Int, - // semantic_warning "Names of results should be lowerCamelCase." - »_resultUnderscore«: Int, - // semantic_warning "Names of results should be lowerCamelCase." - »result_snake_case«: Int -) - -// semantic_warning "Names of steps should be lowerCamelCase." -step »StepUppercase«() {} -// no_semantic_warning "Names of steps should be lowerCamelCase." -step »stepLowercase1«() {} -// semantic_warning "Names of steps should be lowerCamelCase." -step »_stepUnderscore«() {} -// semantic_warning "Names of steps should be lowerCamelCase." -step »step_snake_case«() {} - -// semantic_warning "Names of pipelines should be lowerCamelCase." -pipeline »PipelineUppercase« {} -// no_semantic_warning "Names of pipelines should be lowerCamelCase." -pipeline »pipelineLowercase1« {} -// semantic_warning "Names of pipelines should be lowerCamelCase." -pipeline »_pipelineUnderscore« {} -// semantic_warning "Names of pipelines should be lowerCamelCase." -pipeline »pipeline_snake_case« { - () { - // semantic_warning "Names of lambda results should be lowerCamelCase." - yield »LambdaResultUppercase« = 1; - // no_semantic_warning "Names of lambda results should be lowerCamelCase." - yield »lambdaResultLowercase1« = 1; - // semantic_warning "Names of lambda results should be lowerCamelCase." - yield »_lambdaResultUnderscore« = 1; - // semantic_warning "Names of lambda results should be lowerCamelCase." - yield »lambdaResult_snake_case« = 1; - }; - - // semantic_warning "Names of placeholders should be lowerCamelCase." - val »PlaceholderUppercase« = 1; - // no_semantic_warning "Names of placeholders should be lowerCamelCase." - val »placeholderLowercase1« = 1; - // semantic_warning "Names of placeholders should be lowerCamelCase." - val »_placeholderUnderscore« = 1; - // semantic_warning "Names of placeholders should be lowerCamelCase." - val »placeholder_snake_case« = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package lowercase.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package lowercase.sdstest deleted file mode 100644 index 5d3822d63..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package lowercase.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// no_semantic_warning "All segments of the qualified name of a package should be lowerCamelCase." -package »tests.validation.declarations.lowercase1« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package snake case.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package snake case.sdstest deleted file mode 100644 index 4dba6179e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package snake case.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// semantic_warning "All segments of the qualified name of a package should be lowerCamelCase." -package »tests.validation.declarations.snake_case« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package underscore.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package underscore.sdstest deleted file mode 100644 index 5ed2b98df..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package underscore.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// semantic_warning "All segments of the qualified name of a package should be lowerCamelCase." -package »tests.validation.declarations._underscore« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package uppercase.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package uppercase.sdstest deleted file mode 100644 index 3bc9f949a..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/nameConvention/package uppercase.sdstest +++ /dev/null @@ -1,2 +0,0 @@ -// semantic_warning "All segments of the qualified name of a package should be lowerCamelCase." -package »tests.validation.declarations.Uppercase« diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/no optional and variadic parameters.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/no optional and variadic parameters.sdstest deleted file mode 100644 index 99385e745..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/no optional and variadic parameters.sdstest +++ /dev/null @@ -1,40 +0,0 @@ -package tests.validation.declarations.parameterLists.noOptionalAndVariadicParameters - -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// semantic_error "A callable with optional parameters must not have a variadic parameter." -annotation MyAnnotation1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -annotation MyAnnotation2(»a«: Int) - - -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// semantic_error "A callable with optional parameters must not have a variadic parameter." -class MyClass1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -class MyClass2(»a«: Int) - - -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -// semantic_error "A callable with optional parameters must not have a variadic parameter." -fun myFunction1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// no_semantic_error "A callable with optional parameters must not have a variadic parameter." -fun myFunction2(»a«: Int) - - -pipeline myPipeline { - - // no_semantic_error "A callable with optional parameters must not have a variadic parameter." - (»a«) {}; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/noRequiredParametersAfterFirstOptionalParameter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/noRequiredParametersAfterFirstOptionalParameter.sdstest deleted file mode 100644 index f4b857cea..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/noRequiredParametersAfterFirstOptionalParameter.sdstest +++ /dev/null @@ -1,40 +0,0 @@ -package tests.validation.declarations.parameterLists.noRequiredParameterAfterFirstOptionalParameter - -// no_semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -// semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -annotation MyAnnotation1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// no_semantic_error "After the first optional parameter all parameters must be optional." -annotation MyAnnotation2(»a«: Int) - - -// no_semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -// semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -class MyClass1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// no_semantic_error "After the first optional parameter all parameters must be optional." -class MyClass2(»a«: Int) - - -// no_semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -// semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -// no_semantic_error "After the first optional parameter all parameters must be optional." -fun myFunction1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) - -// no_semantic_error "After the first optional parameter all parameters must be optional." -fun myFunction2(»a«: Int) - - -pipeline myPipeline { - - // no_semantic_error "After the first optional parameter all parameters must be optional." - (»a«) {}; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/vararg must be last parameter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/vararg must be last parameter.sdstest deleted file mode 100644 index 559abecad..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameterLists/vararg must be last parameter.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.validation.declarations.parameterLists.varargMustBeLastParameter - -// no_semantic_error "After a variadic parameter no more parameters must be specified." -// no_semantic_error "After a variadic parameter no more parameters must be specified." -// no_semantic_error "After a variadic parameter no more parameters must be specified." -fun validFunction(»a«: Int, »b«: Int = 1, vararg »c«: Int) - -// no_semantic_error "After a variadic parameter no more parameters must be specified." -// semantic_error "After a variadic parameter no more parameters must be specified." -// semantic_error "After a variadic parameter no more parameters must be specified." -// semantic_error "After a variadic parameter no more parameters must be specified." -fun invalidFunction(vararg »a«: Int, »b«: Int, »c«: Int = 1, vararg »d«: Int) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/default value must be constant.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/default value must be constant.sdstest deleted file mode 100644 index af43b7169..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/default value must be constant.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.validation.parameters.defaultValueMustBeConstant - -fun f() -> value: Int - -fun myFunction( - // no_semantic_error "Default values of parameters must be constant." - param1: Int = »1«, - // no_semantic_error "Default values of parameters must be constant." - param2: Int = »1 + 2«, - // semantic_error "Default values of parameters must be constant." - param3: Int = »f()« -) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/expert must be optional.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/expert must be optional.sdstest deleted file mode 100644 index 6f990aa50..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/expert must be optional.sdstest +++ /dev/null @@ -1,32 +0,0 @@ -package tests.validation.declarations.parameters.expertMustBeOptional - -// semantic_error "An expert parameter must be optional." -// no_semantic_error "An expert parameter must be optional." -annotation MyAnnotation(»@Expert« a: Int, »@Expert« b: Int = 3) - -// semantic_error "An expert parameter must be optional." -// no_semantic_error "An expert parameter must be optional." -class MyClass(»@Expert« a: Int, »@Expert« b: Int = 3) { - - // semantic_error "An expert parameter must be optional." - // no_semantic_error "An expert parameter must be optional." - class MyClass(»@Expert« a: Int, »@Expert« b: Int = 3) - - // semantic_error "An expert parameter must be optional." - // no_semantic_error "An expert parameter must be optional." - fun myFunction(»@Expert« a: Int, »@Expert« b: Int = 3) -} - -// semantic_error "An expert parameter must be optional." -// no_semantic_error "An expert parameter must be optional." -fun myFunction(»@Expert« a: Int, »@Expert« b: Int = 3) - -// semantic_error "An expert parameter must be optional." -// no_semantic_error "An expert parameter must be optional." -step myStep1(»@Expert« a: Int, »@Expert« b: Int = 3) {} - -// semantic_error "An expert parameter must be optional." -// no_semantic_error "An expert parameter must be optional." -step myStep2( - f: (»@Expert« a: Int, »@Expert« b: Int = 3) -> () -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/mustHaveType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/mustHaveType.sdstest deleted file mode 100644 index dedc2473e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/mustHaveType.sdstest +++ /dev/null @@ -1,36 +0,0 @@ -package tests.validation.declarations.parameters.mustHaveType - -// semantic_error "A parameter must have a type." -// no_semantic_error "A parameter must have a type." -annotation MyAnnotation(»a«, »b«: Int) - -// semantic_error "A parameter must have a type." -// no_semantic_error "A parameter must have a type." -class MyClass(»a«, »b«: Int) { - // semantic_error "A parameter must have a type." - // no_semantic_error "A parameter must have a type." - class MyClass(»a«, »b«: Int) {} - - // semantic_error "A parameter must have a type." - // no_semantic_error "A parameter must have a type." - fun myFunction(»a«, »b«: Int) -} - -// semantic_error "A parameter must have a type." -// no_semantic_error "A parameter must have a type." -fun myFunction(»a«, »b«: Int) - -pipeline myPipeline { - // no_semantic_error "A parameter must have a type." - (»a«) {}; -} - -// semantic_error "A parameter must have a type." -// no_semantic_error "A parameter must have a type." -step myStep1(»a«, »b«: Int) {} - -// semantic_error "A parameter must have a type." -// no_semantic_error "A parameter must have a type." -step myStep2( - f: (»a«, »b«: Int) -> () -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/mustNotDeprecateRequiredParameter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/mustNotDeprecateRequiredParameter.sdstest deleted file mode 100644 index 20439564c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/mustNotDeprecateRequiredParameter.sdstest +++ /dev/null @@ -1,32 +0,0 @@ -package tests.validation.declarations.parameters.mustNotDeprecateRequiredParameter - -// semantic_error "A required parameter cannot be deprecated." -// no_semantic_error "A required parameter cannot be deprecated." -annotation MyAnnotation(»@Deprecated("")« a: Int, »@Deprecated("")« b: Int = 3) - -// semantic_error "A required parameter cannot be deprecated." -// no_semantic_error "A required parameter cannot be deprecated." -class MyClass(»@Deprecated("")« a: Int, »@Deprecated("")« b: Int = 3) { - - // semantic_error "A required parameter cannot be deprecated." - // no_semantic_error "A required parameter cannot be deprecated." - class MyClass(»@Deprecated("")« a: Int, »@Deprecated("")« b: Int = 3) - - // semantic_error "A required parameter cannot be deprecated." - // no_semantic_error "A required parameter cannot be deprecated." - fun myFunction(»@Deprecated("")« a: Int, »@Deprecated("")« b: Int = 3) -} - -// semantic_error "A required parameter cannot be deprecated." -// no_semantic_error "A required parameter cannot be deprecated." -fun myFunction(»@Deprecated("")« a: Int, »@Deprecated("")« b: Int = 3) - -// semantic_error "A required parameter cannot be deprecated." -// no_semantic_error "A required parameter cannot be deprecated." -step myStep1(»@Deprecated("")« a: Int, »@Deprecated("")« b: Int = 3) {} - -// semantic_error "A required parameter cannot be deprecated." -// no_semantic_error "A required parameter cannot be deprecated." -step myStep2( - f: (»@Deprecated("")« a: Int, »@Deprecated("")« b: Int = 3) -> () -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/variadic parameters must not have default value.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/variadic parameters must not have default value.sdstest deleted file mode 100644 index 44caf9142..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/parameters/variadic parameters must not have default value.sdstest +++ /dev/null @@ -1,5 +0,0 @@ -package tests.validation.declarations.parameters.variadicParametersMustNotHaveDefaultValue - -// no_semantic_error "Variadic parameters must not have default values." -// semantic_error "Variadic parameters must not have default values." -fun f(»a«: Int = 1, vararg »b«: Int = 2) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/pipelines/noYield.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/pipelines/noYield.sdstest deleted file mode 100644 index 5123d3a1c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/pipelines/noYield.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -package tests.validation.declarations.pipelines.noYield - -step s() { - // no_semantic_error "Yield must not be used in a pipeline." - »yield a« = 1; -} - -pipeline p { - // semantic_error "Yield must not be used in a pipeline." - »yield a« = 1; - - () { - // no_semantic_error "Yield must not be used in a pipeline." - »yield a« = 1; - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/pipelines/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/pipelines/uniqueNames.sdstest deleted file mode 100644 index ba876e976..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/pipelines/uniqueNames.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.validation.declarations.pipelines.uniqueNames - -pipeline p { - // semantic_error "A declaration with name 'myPlaceholder' exists already in this pipeline." - val »myPlaceholder« = 1; - // semantic_error "A declaration with name 'myPlaceholder' exists already in this pipeline." - val »myPlaceholder« = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/placeholders/renamingOfDeclaration.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/placeholders/renamingOfDeclaration.sdstest deleted file mode 100644 index efd7598d5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/placeholders/renamingOfDeclaration.sdstest +++ /dev/null @@ -1,38 +0,0 @@ -package tests.validation.declarations.placeholders.renamingOfDeclaration - -annotation MyAnnotation - -class MyClass { - attr myAttribute: Int -} - -enum MyEnum { - MY_INSTANCE -} - -fun myFunction() - -pipeline myPipeline {} - -step test(myParameter: Int) { - // no_semantic_warning "This placeholder only provides another name for a declaration." - val »a« = 1; - // no_semantic_warning "This placeholder only provides another name for a declaration." - val »b« = MyAnnotation; - // semantic_warning "This placeholder only provides another name for a declaration." - val »c« = MyClass; - // no_semantic_warning "This placeholder only provides another name for a declaration." - val »d« = MyClass.myAttribute; - // semantic_warning "This placeholder only provides another name for a declaration." - val »e« = MyEnum; - // no_semantic_warning "This placeholder only provides another name for a declaration." - val »f« = MyEnum.MY_INSTANCE; - // semantic_warning "This placeholder only provides another name for a declaration." - val »g« = myFunction; - // no_semantic_warning "This placeholder only provides another name for a declaration." - val »h« = myPipeline; - // semantic_warning "This placeholder only provides another name for a declaration." - val »i« = myParameter; - // semantic_warning "This placeholder only provides another name for a declaration." - val »j« = a; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/placeholders/unused.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/placeholders/unused.sdstest deleted file mode 100644 index c861cbe8e..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/placeholders/unused.sdstest +++ /dev/null @@ -1,45 +0,0 @@ -package tests.validation.declarations.placeholders.unused - -step myFunction() { - call(unused); - - // semantic_warning "This placeholder is unused." - val »unused« = 1; - - // no_semantic_warning "This placeholder is unused." - val »used« = 1; - call(used); - - // no_semantic_warning "This placeholder is unused." - val »last« = 1; -} - -pipeline myPipeline1 { - call(unused); - - // semantic_warning "This placeholder is unused." - val »unused« = 1; - - // no_semantic_warning "This placeholder is unused." - val »used« = 1; - call(used); - - // no_semantic_warning "This placeholder is unused." - val »last« = 1; -} - -pipeline myPipeline2 { - () { - call(unused); - - // semantic_warning "This placeholder is unused." - val »unused« = 1; - - // no_semantic_warning "This placeholder is unused." - val »used« = 1; - call(used); - - // no_semantic_warning "This placeholder is unused." - val »last« = 1; - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/results/mustHaveType.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/results/mustHaveType.sdstest deleted file mode 100644 index e181db236..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/results/mustHaveType.sdstest +++ /dev/null @@ -1,18 +0,0 @@ -package tests.mustHaveType - -class MyClass { - - // semantic_error "A result must have a type." - // no_semantic_error "A result must have a type." - fun myFunction() -> (»a«, »b«: Int) -} - -// semantic_error "A result must have a type." -// no_semantic_error "A result must have a type." -fun myFunction() -> (»a«, »b«: Int) - -// semantic_error "A result must have a type." -// no_semantic_error "A result must have a type." -step myStep( - f: () -> (»a«, »b«: Int) -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/duplicateYield.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/duplicateYield.sdstest deleted file mode 100644 index f642ab696..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/duplicateYield.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -package tests.validation.declarations.steps.duplicateYield - -step testStep() -> (a: Int, b: Int) { - // no_semantic_error "This result is assigned multiple times." - yield »a« = 1; - // semantic_error "This result is assigned multiple times." - yield »b« = 1; - // semantic_error "This result is assigned multiple times." - yield »b« = 1; - // no_semantic_error "This result is assigned multiple times." - yield »c« = 1; - // no_semantic_error "This result is assigned multiple times." - yield »c« = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unassignedResult.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unassignedResult.sdstest deleted file mode 100644 index 47857ddca..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unassignedResult.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.validation.declarations.steps.unassignedResult - -// no_semantic_error "No value is assigned to this result." -// no_semantic_error "No value is assigned to this result." -// no_semantic_error "No value is assigned to this result." -// semantic_error "No value is assigned to this result." -step testStep() -> (»a«: Int, »b«: Int, »c«: Int, »d«: Int) { - yield b = 1; - yield a = 1; - yield c = 1; - yield c = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/uniqueNames.sdstest deleted file mode 100644 index 190876068..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/uniqueNames.sdstest +++ /dev/null @@ -1,36 +0,0 @@ -package tests.uniqueNames - -step s( - // semantic_error "A parameter, result or placeholder with name 'duplicateParameter' exists already in this step." - »duplicateParameter«: Int, - // semantic_error "A parameter, result or placeholder with name 'duplicateParameter' exists already in this step." - »duplicateParameter«: Int, - // no_semantic_error "A parameter, result or placeholder with name 'uniqueParameter' exists already in this step." - »uniqueParameter«: Int, - // semantic_error "A parameter, result or placeholder with name 'parameterAndResult' exists already in this step." - »parameterAndResult«: Int, - // semantic_error "A parameter, result or placeholder with name 'parameterAndPlaceholder' exists already in this step." - »parameterAndPlaceholder«: Int -) -> ( - // semantic_error "A parameter, result or placeholder with name 'duplicateResult' exists already in this step." - »duplicateResult«: Int, - // semantic_error "A parameter, result or placeholder with name 'duplicateResult' exists already in this step." - »duplicateResult«: Int, - // no_semantic_error "A parameter, result or placeholder with name 'uniqueResult' exists already in this step." - »uniqueResult«: Int, - // semantic_error "A parameter, result or placeholder with name 'parameterAndResult' exists already in this step." - »parameterAndResult«: Int, - // semantic_error "A parameter, result or placeholder with name 'resultAndPlaceholder' exists already in this step." - »resultAndPlaceholder«: Int -) { - // semantic_error "A parameter, result or placeholder with name 'duplicatePlaceholder' exists already in this step." - val »duplicatePlaceholder« = 1; - // semantic_error "A parameter, result or placeholder with name 'duplicatePlaceholder' exists already in this step." - val »duplicatePlaceholder« = 1; - // no_semantic_error "A parameter, result or placeholder with name 'uniquePlaceholder' exists already in this step." - val »uniquePlaceholder« = 1; - // semantic_error "A parameter, result or placeholder with name 'parameterAndPlaceholder' exists already in this step." - val »parameterAndPlaceholder« = 1; - // semantic_error "A parameter, result or placeholder with name 'resultAndPlaceholder' exists already in this step." - val »resultAndPlaceholder« = 1; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unnecessaryResultList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unnecessaryResultList.sdstest deleted file mode 100644 index 3c7e0b582..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unnecessaryResultList.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.validation.declarations.steps.unnecessaryResultList - -// semantic_info "Unnecessary result list." -step myStep1() »-> ()« {} -// no_semantic_info "Unnecessary result list." -step myStep2() »-> (r: Int)« {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unusedParameter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unusedParameter.sdstest deleted file mode 100644 index 5719607a5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/steps/unusedParameter.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -step myStep1( - // semantic_warning "This parameter is unused." - »unused«: Int, - // no_semantic_warning "This parameter is unused." - »used«: Int -) { - call(used); -} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/typeParameters/varienceTogetherWithKind.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/typeParameters/varienceTogetherWithKind.sdstest deleted file mode 100644 index eb30dba11..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/declarations/typeParameters/varienceTogetherWithKind.sdstest +++ /dev/null @@ -1,6 +0,0 @@ -package tests.validation.declarations.typeparameter.varienceTogether - -// semantic_error "Can not use variance and kind together" -// no_semantic_error "Can not use variance and kind together" -// no_semantic_error "Can not use variance and kind together" -class Myclass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/arguments/must be constant.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/arguments/must be constant.sdstest deleted file mode 100644 index b2b378f26..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/arguments/must be constant.sdstest +++ /dev/null @@ -1,33 +0,0 @@ -package tests.validation.expressions.arguments.argumentsMustBeConstant - -fun myFunction() -> res: Int - -fun myFunctionWithConstantParameter( - @Constant constantParam: Int -) - -fun myFunctionWithNormalParameter( - param: Int -) - - -pipeline testPipeline { - // no_semantic_error "Arguments assigned to constant parameters must be constant." - myFunctionWithConstantParameter(»1«); - // no_semantic_error "Arguments assigned to constant parameters must be constant." - myFunctionWithConstantParameter(»1 + 2«); - // semantic_error "Arguments assigned to constant parameters must be constant." - myFunctionWithConstantParameter(»myFunction()«); - // semantic_error "Arguments assigned to constant parameters must be constant." - myFunctionWithConstantParameter(constantParam = »myFunction()«); - - // no_semantic_error "Arguments assigned to constant parameters must be constant." - myFunctionWithNormalParameter(»myFunction()«); - // no_semantic_error "Arguments assigned to constant parameters must be constant." - myFunctionWithNormalParameter(param = »myFunction()«); - - // no_semantic_error "Arguments assigned to constant parameters must be constant." - unresolved(»myFunction()«); - // no_semantic_error "Arguments assigned to constant parameters must be constant." - myFunctionWithConstantParameter(unresolved = »myFunction()«); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/arguments/variadic parameter assigned by name.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/arguments/variadic parameter assigned by name.sdstest deleted file mode 100644 index f63cb3555..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/arguments/variadic parameter assigned by name.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.validation.arguments.variadicParameterAssignedByName - -fun f(a: Int, b: Int = 0, vararg c: Int) - -pipeline test { - // no_semantic_error "A variadic parameter must not be assigned by name." - // no_semantic_error "A variadic parameter must not be assigned by name." - // semantic_error "A variadic parameter must not be assigned by name." - f(»a« = 1, »b« = 2, »c« = 3); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/calledClassMustHaveConstructor.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/calledClassMustHaveConstructor.sdstest deleted file mode 100644 index 68cacec28..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/calledClassMustHaveConstructor.sdstest +++ /dev/null @@ -1,14 +0,0 @@ -package tests.validation.expressions.calls.calledClassMustHaveConstructor - -class A - -class B() - -pipeline test { - - // semantic_error "Cannot create an instance of a class that has no constructor." - val a = »A«(); - - // no_semantic_error "Cannot create an instance of a class that has no constructor." - val b = »B«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/context.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/context.sdstest deleted file mode 100644 index 45f805388..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/context.sdstest +++ /dev/null @@ -1,116 +0,0 @@ -package tests.validation.expressions.calls.context - -class MyClass() { - fun noResults() - fun oneResult() -> first: Int - fun twoResults() -> (first: Int, second: Int) -} -class MyClassWithoutConstructor - -enum MyEnum { - MyVariant() - MyVariantWithoutConstructor -} - -fun functionNoResults() -fun functionOneResult() -> first: Int -fun functionTwoResults() -> (first: Int, second: Int) - -step stepNoResults() {} -step stepOneResult() -> first: Int {} -step stepTwoResults() -> (first: Int, second: Int) {} - -step test( - paramNoResults: () -> (), - paramOneResult: () -> first: Int, - paramTwoResults: () -> (first: Int, second: Int) -) { - val lambdaNoResults = () {}; - val lambdaOneResult = () { - yield first = 1; - }; - val lambdaTwoResults = () { - yield first = 1; - yield second = 2; - }; - - // no_semantic_error "A call that produces no results is not allowed in this context." - val a = »MyClass«(); - // no_semantic_error "A call that produces multiple results is not allowed in this context." - val b = »MyClass«(); - - // no_semantic_error "A call that produces no results is not allowed in this context." - val c = »MyClassWithoutConstructor«(); - // no_semantic_error "A call that produces multiple results is not allowed in this context." - val d = »MyClassWithoutConstructor«(); - - // no_semantic_error "A call that produces no results is not allowed in this context." - val e = »MyEnum.MyVariant«(); - // no_semantic_error "A call that produces multiple results is not allowed in this context." - val f = »MyEnum.MyVariant«(); - - // no_semantic_error "A call that produces no results is not allowed in this context." - val g = »MyEnum.MyVariantWithoutConstructor«(); - // no_semantic_error "A call that produces multiple results is not allowed in this context." - val h = »MyEnum.MyVariantWithoutConstructor«(); - - // semantic_error "A call that produces no results is not allowed in this context." - MyClass().»noResults«() + 1; - // no_semantic_error "A call that produces no results is not allowed in this context." - MyClass().»oneResult«() - 1; - // no_semantic_error "A call that produces multiple results is not allowed in this context." - MyClass().»oneResult«() * 1; - // semantic_error "A call that produces multiple results is not allowed in this context." - MyClass().»twoResults«() / 1; - - // semantic_error "A call that produces no results is not allowed in this context." - »functionNoResults«() + 1; - // no_semantic_error "A call that produces no results is not allowed in this context." - »functionOneResult«() - 1; - // no_semantic_error "A call that produces multiple results is not allowed in this context." - »functionOneResult«() * 1; - // semantic_error "A call that produces multiple results is not allowed in this context." - »functionTwoResults«() / 1; - - // semantic_error "A call that produces no results is not allowed in this context." - »stepNoResults«() + 1; - // no_semantic_error "A call that produces no results is not allowed in this context." - »stepOneResult«() - 1; - // no_semantic_error "A call that produces multiple results is not allowed in this context." - »stepOneResult«() * 1; - // semantic_error "A call that produces multiple results is not allowed in this context." - »stepTwoResults«() / 1; - - // semantic_error "A call that produces no results is not allowed in this context." - »paramNoResults«() + 1; - // no_semantic_error "A call that produces no results is not allowed in this context." - »paramOneResult«() - 1; - // no_semantic_error "A call that produces multiple results is not allowed in this context." - »paramOneResult«() * 1; - // semantic_error "A call that produces multiple results is not allowed in this context." - »paramTwoResults«() / 1; - - // semantic_error "A call that produces no results is not allowed in this context." - »lambdaNoResults«() + 1; - // no_semantic_error "A call that produces no results is not allowed in this context." - »lambdaOneResult«() - 1; - // no_semantic_error "A call that produces multiple results is not allowed in this context." - »lambdaOneResult«() * 1; - // semantic_error "A call that produces multiple results is not allowed in this context." - »lambdaTwoResults«() / 1; - - // no_semantic_error "A call that produces no results is not allowed in this context." - »functionNoResults«(); - // no_semantic_error "A call that produces multiple results is not allowed in this context." - »functionTwoResults«(); - - // semantic_error "A call that produces no results is not allowed in this context." - »functionNoResults«().first; - // no_semantic_error "A call that produces multiple results is not allowed in this context." - »functionTwoResults«().first; - - // semantic_error "A call that produces no results is not allowed in this context." - val x = »functionNoResults«(); - // no_semantic_error "A call that produces multiple results is not allowed in this context." - val y, val z = »functionTwoResults«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/missingTypeArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/missingTypeArgumentList.sdstest deleted file mode 100644 index 3bab96222..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/missingTypeArgumentList.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -package tests.validation.expressions.calls.missingTypeArgumentList - -fun functionWithoutTypeParameters() -fun functionWithTypeParameters() - -pipeline myPipeline { - // no_semantic_error "Missing type argument list." - »functionWithoutTypeParameters«(); - // no_semantic_error "Missing type argument list." - »functionWithoutTypeParameters«(); - // semantic_error "Missing type argument list." - »functionWithTypeParameters«(); - // semantic_error "Missing type argument list." - »functionWithTypeParameters«(); - // no_semantic_error "Missing type argument list." - »unresolvedFunction«(); - // no_semantic_error "Missing type argument list." - »unresolvedFunction«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/receiverMustBeCallable.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/receiverMustBeCallable.sdstest deleted file mode 100644 index e41e7d149..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/receiverMustBeCallable.sdstest +++ /dev/null @@ -1,74 +0,0 @@ -package tests.validation.expressions.calls.receiverMustBeCallable - -annotation MyAnnotation - -class MyClass { - attr myAttribute: Int - class MyClass - enum MyEnum - fun myFunction() -} - -enum MyEnum { - MySimpleEnumInstance - MyComplexEnumInstance() -} - -fun myFunction() - -pipeline myPipeline {} - -step test(a: Int, b: () -> ()) { - val c = 1; - val d = () {}; - val e = () -> 1; - - /* References cannot point to annotations in the first place. */ - // no_semantic_error "This expression must not be called." - »MyAnnotation«(); - // no_semantic_error "This expression must not be called." - »MyClass«(); - // semantic_error "This expression must not be called." - »MyClass().myAttribute«(); - // no_semantic_error "This expression must not be called." - »MyClass.MyClass«(); - // semantic_error "This expression must not be called." - »MyClass.MyEnum«(); - // no_semantic_error "This expression must not be called." - »MyClass().myFunction«(); - // semantic_error "This expression must not be called." - »MyEnum«(); - // no_semantic_error "This expression must not be called." - »MyEnum.MySimpleEnumInstance«(); - // no_semantic_error "This expression must not be called." - »MyEnum.MyComplexEnumInstance«(); - // no_semantic_error "This expression must not be called." - »myFunction«(); - /* References cannot point to pipelines in the first place. */ - // no_semantic_error "This expression must not be called." - »myPipeline«(); - // semantic_error "This expression must not be called." - »a«(); - // no_semantic_error "This expression must not be called." - »b«(); - // semantic_error "This expression must not be called." - »c«(); - // no_semantic_error "This expression must not be called." - »d«(); - // no_semantic_error "This expression must not be called." - »e«(); - // no_semantic_error "This expression must not be called." - »(d)«(); - // no_semantic_error "This expression must not be called." - »(e)«(); - - - /****************************************************************************************************************** - * If a declaration is not in scope we already show a different error. - ******************************************************************************************************************/ - - // no_semantic_error "This expression must not be called." - »unknownGlobal«(); - // no_semantic_error "This expression must not be called." - »MyClass().unknownMember«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/recursion.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/recursion.sdstest deleted file mode 100644 index 3ad5b522c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/recursion.sdstest +++ /dev/null @@ -1,68 +0,0 @@ -package tests.validation.expressions.calls.recursion - - -pipeline p { - // semantic_error "Recursive calls are not allowed." - »a«(); - // semantic_error "Recursive calls are not allowed." - »b«(); - // semantic_error "Recursive calls are not allowed." - »c«(); - // no_semantic_error "Recursive calls are not allowed." - »d«(); - // no_semantic_error "Recursive calls are not allowed." - »f«(); -} - -step a() { - // semantic_error "Recursive calls are not allowed." - »a«(); - // semantic_error "Recursive calls are not allowed." - »b«(); - // semantic_error "Recursive calls are not allowed." - »c«(); - // no_semantic_error "Recursive calls are not allowed." - »d«(); - // no_semantic_error "Recursive calls are not allowed." - »f«(); - - () { - // semantic_error "Recursive calls are not allowed." - »a«(); - // semantic_error "Recursive calls are not allowed." - »b«(); - // semantic_error "Recursive calls are not allowed." - »c«(); - // no_semantic_error "Recursive calls are not allowed." - »d«(); - // no_semantic_error "Recursive calls are not allowed." - »f«(); - }; - - val lambda1 = () { - // no_semantic_error "Recursive calls are not allowed." - »lambda1«(); - }; - - val lambda2 = () { - // no_semantic_error "Recursive calls are not allowed." - »lambda3«(); - }; - - val lambda3 = () { - // no_semantic_error "Recursive calls are not allowed." - »lambda2«(); - }; -} - -step b() { - // semantic_error "Recursive calls are not allowed." - »c«(); -} - -step c() { - // semantic_error "Recursive calls are not allowed." - »b«(); -} - -step d() {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/unnecessaryArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/unnecessaryArgumentList.sdstest deleted file mode 100644 index db143b2b1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/calls/unnecessaryArgumentList.sdstest +++ /dev/null @@ -1,40 +0,0 @@ -package tests.validation.expressions.calls.unnecessaryArgumentList - -enum MyEnum { - A - B() - C(c: Int = 0) - D(d: Int) - E -} - -pipeline test { - // semantic_info "Unnecessary argument list." - MyEnum.A»()«; - // no_semantic_info "Unnecessary argument list." - MyEnum.A»(1)«; - // semantic_info "Unnecessary argument list." - MyEnum.B»()«; - // no_semantic_info "Unnecessary argument list." - MyEnum.B»(1)«; - // no_semantic_info "Unnecessary argument list." - MyEnum.C»()«; - // no_semantic_info "Unnecessary argument list." - MyEnum.C»(1)«; - // no_semantic_info "Unnecessary argument list." - MyEnum.D»()«; - // no_semantic_info "Unnecessary argument list." - MyEnum.D»(1)«; - // no_semantic_info "Unnecessary argument list." - MyEnum.E»()«; - // no_semantic_info "Unnecessary argument list." - MyEnum.E»(1)«; - // no_semantic_info "Unnecessary argument list." - MyEnum.E»()«; - // no_semantic_info "Unnecessary argument list." - MyEnum.E»(1)«; - // no_semantic_info "Unnecessary argument list." - MyEnum.Unresolved»()«; - // no_semantic_info "Unnecessary argument list." - MyEnum.Unresolved»(1)«; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/infixOperation/division by zero.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/infixOperation/division by zero.sdstest deleted file mode 100644 index a9b501a45..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/infixOperation/division by zero.sdstest +++ /dev/null @@ -1,38 +0,0 @@ -package tests.validation.expressions.infixOperation.divisionByZero - -pipeline test { - // semantic_error "Division by zero." - »1.0 / 0.0«; - // semantic_error "Division by zero." - »1.0 / -0.0«; - // no_semantic_error "Division by zero." - »1.0 / 1.0«; - - // semantic_error "Division by zero." - »1.0 / 0«; - // no_semantic_error "Division by zero." - »1.0 / 1«; - - // semantic_error "Division by zero." - »1 / 0.0«; - // semantic_error "Division by zero." - »1 / -0.0«; - // no_semantic_error "Division by zero." - »1 / 1.0«; - - // semantic_error "Division by zero." - »1 / 0«; - // no_semantic_error "Division by zero." - »1 / 1«; - - // no_semantic_error "Division by zero." - »null / 0.0«; - // no_semantic_error "Division by zero." - »null / -0.0«; - // no_semantic_error "Division by zero." - »null / 1.0«; - // no_semantic_error "Division by zero." - »null / 0«; - // no_semantic_error "Division by zero." - »null / 1«; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/infixOperation/unnecessaryElvisOperator.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/infixOperation/unnecessaryElvisOperator.sdstest deleted file mode 100644 index d7ac81695..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/infixOperation/unnecessaryElvisOperator.sdstest +++ /dev/null @@ -1,42 +0,0 @@ -package validation.expressions.elvis.unnecessaryElvisOperator - -fun f() -> result: Any? - -pipeline test { - - // semantic_info "The left operand is never null so the elvis operator is unnecessary (keep left operand)." - »1 ?: 2«; - // semantic_info "The left operand is never null so the elvis operator is unnecessary (keep left operand)." - »1 ?: null«; - // no_semantic_info "The left operand is never null so the elvis operator is unnecessary (keep left operand)." - »null ?: 2«; - // no_semantic_info "The left operand is never null so the elvis operator is unnecessary (keep left operand)." - »null ?: null«; - - // no_semantic_info "The left operand is always null so the elvis operator is unnecessary (keep right operand)." - »1 ?: 2«; - // no_semantic_info "The left operand is always null so the elvis operator is unnecessary (keep right operand)." - »1 ?: null«; - // semantic_info "The left operand is always null so the elvis operator is unnecessary (keep right operand)." - »null ?: 2«; - // no_semantic_info "The left operand is always null so the elvis operator is unnecessary (keep right operand)." - »null ?: null«; - - // no_semantic_info "The right operand is always null so the elvis operator is unnecessary (keep left operand)." - »1 ?: 2«; - // semantic_info "The right operand is always null so the elvis operator is unnecessary (keep left operand)." - »f() ?: null«; - // no_semantic_info "The right operand is always null so the elvis operator is unnecessary (keep left operand)." - »null ?: 2«; - // no_semantic_info "The right operand is always null so the elvis operator is unnecessary (keep left operand)." - »null ?: null«; - - // no_semantic_info "Both operands are always null so the elvis operator is unnecessary (replace with null)." - »1 ?: 2«; - // no_semantic_info "Both operands are always null so the elvis operator is unnecessary (replace with null)." - »1 ?: null«; - // no_semantic_info "Both operands are always null so the elvis operator is unnecessary (replace with null)." - »null ?: 2«; - // semantic_info "Both operands are always null so the elvis operator is unnecessary (replace with null)." - »null ?: null«; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/lambdas/context.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/lambdas/context.sdstest deleted file mode 100644 index ce13b077f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/lambdas/context.sdstest +++ /dev/null @@ -1,86 +0,0 @@ -package tests.validation.expressions.lambdas.context - -pipeline invalidCases { - // semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - »() {}«; - // semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - »() -> 1«; - // semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - (»() {}«)(); - // semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - (»() -> 1«)(); - // semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - val a = »() {}«; - // semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - val b = »() -> 1«; -} - -step yieldBlockLambdaInStep() -> f: () -> res: Int { - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - yield f = »() { - yield res = 1; - }«; -} - -step yieldExpressionLambdaInStep() -> f: () -> res: Int { - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - yield f = »() -> 1«; -} - -step passLambdasAsArgumentToCallableType(f: (g: () -> res: Int) -> ()) { - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - f(»() { yield res = 1; }«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - f(»() -> 1«); -} - -class TestClass(f: () -> res: Int) -enum TestEnum { - Variant(f: () -> res: Int) -} -fun testFunction(f: () -> res: Int) -step testStep1(f: () -> res: Int) {} - -pipeline passLambdasAsArguments { - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - TestClass(»() { yield res = 1; }«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - TestClass(»() -> 1«); - - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - TestEnum.Variant(»() { yield res = 1; }«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - TestEnum.Variant(»() -> 1«); - - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testFunction(»() { yield res = 1; }«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testFunction(»() -> 1«); - - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testStep1(»() { yield res = 1; }«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testStep1(»() -> 1«); -} - -/* Special cases */ - -pipeline wrappedInParentheses { - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testFunction((»() -> 1«)); -} - -step testStep2(param) {} - -step testStep3() {} - -pipeline parameterHasNoType { - // semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testStep2(»() -> 1«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testStep2(param2 = »() -> 1«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - testStep3(»() -> 1«); - // no_semantic_error "A lambda must either be yielded in a step or assigned to a typed parameter." - unresolved(»() -> 1«); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/lambdas/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/lambdas/uniqueNames.sdstest deleted file mode 100644 index 8a5e6f917..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/lambdas/uniqueNames.sdstest +++ /dev/null @@ -1,38 +0,0 @@ -package tests.uniqueNames - -pipeline p { - ( - // semantic_error "A parameter, result or placeholder with name 'duplicateParameter' exists already in this lambda." - »duplicateParameter«, - // semantic_error "A parameter, result or placeholder with name 'duplicateParameter' exists already in this lambda." - »duplicateParameter«, - // no_semantic_error "A parameter, result or placeholder with name 'uniqueParameter' exists already in this lambda." - »uniqueParameter«, - // semantic_error "A parameter, result or placeholder with name 'parameterAndPlaceholder' exists already in this lambda." - »parameterAndPlaceholder«, - // semantic_error "A parameter, result or placeholder with name 'parameterAndResult' exists already in this lambda." - »parameterAndResult« - ) { - // semantic_error "A parameter, result or placeholder with name 'duplicatePlaceholder' exists already in this lambda." - val »duplicatePlaceholder« = 1; - // semantic_error "A parameter, result or placeholder with name 'duplicatePlaceholder' exists already in this lambda." - val »duplicatePlaceholder« = 1; - // no_semantic_error "A parameter, result or placeholder with name 'uniquePlaceholder' exists already in this lambda." - val »uniquePlaceholder« = 1; - // semantic_error "A parameter, result or placeholder with name 'parameterAndPlaceholder' exists already in this lambda." - val »parameterAndPlaceholder« = 1; - // semantic_error "A parameter, result or placeholder with name 'placeholderAndResult' exists already in this lambda." - val »placeholderAndResult« = 1; - - // semantic_error "A parameter, result or placeholder with name 'duplicateResult' exists already in this lambda." - yield »duplicateResult« = 0; - // semantic_error "A parameter, result or placeholder with name 'duplicateResult' exists already in this lambda." - yield »duplicateResult« = 0; - // no_semantic_error "A parameter, result or placeholder with name 'uniqueResult' exists already in this lambda." - yield »uniqueResult« = 0; - // semantic_error "A parameter, result or placeholder with name 'parameterAndResult' exists already in this lambda." - yield »parameterAndResult« = 0; - //semantic_error "A parameter, result or placeholder with name 'placeholderAndResult' exists already in this lambda." - yield »placeholderAndResult« = 0; - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/enumVariantMustBeInstantiated.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/enumVariantMustBeInstantiated.sdstest deleted file mode 100644 index f257cbf51..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/enumVariantMustBeInstantiated.sdstest +++ /dev/null @@ -1,42 +0,0 @@ -package tests.validation.expressions.memberAccesses.enumVariantMustBeInstantiated - -enum MyEnum { - A - B() - C(c: Int = 0) - D(d: Int) - E -} - -pipeline test { - - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»A«; - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»A«(); - - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»B«; - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»B«(); - - // semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»C«; - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»C«(); - - // semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»D«; - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»D«(); - - // semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»E«; - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»E«(); - - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»Unresolved«; - // no_semantic_error "An enum variant with parameters or type parameters must be instantiated." - MyEnum.»Unresolved«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/instanceMethodMustBeCalled.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/instanceMethodMustBeCalled.sdstest deleted file mode 100644 index a696730de..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/instanceMethodMustBeCalled.sdstest +++ /dev/null @@ -1,25 +0,0 @@ -package tests.instanceMethodMustBeCalled - -class MyClass { - fun myInstanceMethod() - static fun myStaticMethod() -} - -fun myFunction() - -step test(a: () -> ()) { - val b = () {}; - - // semantic_error "An instance method must be called." - MyClass().»myInstanceMethod«; - // no_semantic_error "An instance method must be called." - MyClass().»myInstanceMethod«(); - // no_semantic_error "An instance method must be called." - MyClass.»myStaticMethod«; - // no_semantic_error "An instance method must be called." - »myFunction«; - // no_semantic_error "An instance method must be called." - »a«; - // no_semantic_error "An instance method must be called." - »b«; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/missingSafeAccess.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/missingSafeAccess.sdstest deleted file mode 100644 index afae6c3f3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/missingSafeAccess.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package validation.expressions.memberAccess.missingSafeAccess - -pipeline test { - - // no_semantic_error "The receiver can be null so a safe access must be used." - »(1).toString«(); - // semantic_error "The receiver can be null so a safe access must be used." - »null.toString«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/unnecessarySafeAccess.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/unnecessarySafeAccess.sdstest deleted file mode 100644 index e50ac20c5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/memberAccess/unnecessarySafeAccess.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package validation.expressions.memberAccess.unnecessarySafeAccess - -pipeline test { - - // semantic_info "The receiver is never null so the safe access is unnecessary." - »1?.toString«(); - // no_semantic_info "The receiver is never null so the safe access is unnecessary." - »null?.toString«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/references/must not statically reference class.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/references/must not statically reference class.sdstest deleted file mode 100644 index 42938c636..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/references/must not statically reference class.sdstest +++ /dev/null @@ -1,42 +0,0 @@ -package tests.validation.references.mustNotStaticallyReferenceClass - -class ClassWithConstructor() - -class ClassWithoutConstructor - -class ClassWithStaticMembers { - static attr myAttribute: Int - - class InnerClassWithConstructor() { - static attr myAttribute: Int - } - - class InnerClassWithoutConstructor -} - -pipeline test { - // no_semantic_error "Must not statically reference class." - »ClassWithConstructor«; - // semantic_error "Must not statically reference class." - »ClassWithoutConstructor«; - // no_semantic_error "Must not statically reference class." - »ClassWithoutConstructor«(); - // no_semantic_error "Must not statically reference class." - »ClassWithConstructor«(); - // no_semantic_error "Must not statically reference class." - »ClassWithStaticMembers«.myAttribute; - // no_semantic_error "Must not statically reference class." - »ClassWithStaticMembers«.unresolved; - // no_semantic_error "Must not statically reference class." - // no_semantic_error "Must not statically reference class." - »ClassWithStaticMembers«.»InnerClassWithConstructor«; - // no_semantic_error "Must not statically reference class." - // semantic_error "Must not statically reference class." - »ClassWithStaticMembers«.»InnerClassWithoutConstructor«; - // no_semantic_error "Must not statically reference class." - // no_semantic_error "Must not statically reference class." - »ClassWithStaticMembers«.»InnerClassWithConstructor«(); - // no_semantic_error "Must not statically reference class." - // no_semantic_error "Must not statically reference class." - »ClassWithStaticMembers«.»InnerClassWithConstructor«.myAttribute; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/references/must not statically reference enum.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/references/must not statically reference enum.sdstest deleted file mode 100644 index 01ecdc8ed..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/references/must not statically reference enum.sdstest +++ /dev/null @@ -1,36 +0,0 @@ -package tests.validation.references.mustNotStaticallyReferenceEnum - -enum Enum { - Variant -} - -class ClassWithEnum { - enum Enum { - Variant - } - - class ClassWithEnum { - enum Enum { - Variant - } - } -} - -pipeline test { - // semantic_error "Must not statically reference enum." - »Enum«; - // semantic_error "Must not statically reference enum." - »Enum«(); - // no_semantic_error "Must not statically reference enum." - »Enum«.Variant; - // no_semantic_error "Must not statically reference enum." - »Enum«.unresolved; - // semantic_error "Must not statically reference enum." - ClassWithEnum.»Enum«; - // no_semantic_error "Must not statically reference enum." - ClassWithEnum.»Enum«.Variant; - // semantic_error "Must not statically reference enum." - ClassWithEnum.ClassWithEnum.»Enum«; - // no_semantic_error "Must not statically reference enum." - ClassWithEnum.ClassWithEnum.»Enum«.Variant; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/templateStrings/missingTemplateExpression.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/templateStrings/missingTemplateExpression.sdstest deleted file mode 100644 index 36e311c61..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/expressions/templateStrings/missingTemplateExpression.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package validation.expressions.templateStrings.missingTemplateExpression - -pipeline test { - // semantic_error "There must be a template expression between two template string parts." - // semantic_error "There must be a template expression between two template string parts." - "start {{ »}} inner {{« »}} end"«; - // no_semantic_error "There must be a template expression between two template string parts." - // no_semantic_error "There must be a template expression between two template string parts." - "start {{ 1 »}} inner {{« 1 »}} end"«; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/arguments must be constant.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/arguments must be constant.sdstest deleted file mode 100644 index 8cee274f6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/arguments must be constant.sdstest +++ /dev/null @@ -1,16 +0,0 @@ -package tests.validation.other.annotationCalls.argumentsMustBeConstant - -@Repeatable -annotation MyAnnotation(value: Int) - -fun myFunction() -> value: Int - -// no_semantic_error "Arguments in annotation call must be constant." -@MyAnnotation(»1«) -// no_semantic_error "Arguments in annotation call must be constant." -@MyAnnotation(»1 + 2«) -// semantic_error "Arguments in annotation call must be constant." -@MyAnnotation(»myFunction()«) -// semantic_error "Arguments in annotation call must be constant." -@MyAnnotation(value = »myFunction()«) -class MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/cardinality.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/cardinality.sdstest deleted file mode 100644 index 75a7573a8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/cardinality.sdstest +++ /dev/null @@ -1,33 +0,0 @@ -package tests.validation.other.annotationCalls.cardinality - -@Unrepeatable -annotation ExplicitlySingleUse - -annotation ImplicitlySingleUse - -@Repeatable -annotation ExplicitlyMultiUse - -// no_semantic_error "This annotation can only be used once." -»@ExplicitlySingleUse« -// no_semantic_error "This annotation can only be used once." -»@ImplicitlySingleUse« -// no_semantic_error "This annotation can only be used once." -»@ExplicitlyMultiUse« -// no_semantic_error "This annotation can only be used once." -»@ExplicitlyMultiUse« -// no_semantic_error "This annotation can only be used once." -»@UnresolvedAnnotation« -// no_semantic_error "This annotation can only be used once." -»@UnresolvedAnnotation« -class CorrectUse - -// semantic_error "This annotation can only be used once." -»@ExplicitlySingleUse« -// semantic_error "This annotation can only be used once." -»@ExplicitlySingleUse« -// semantic_error "This annotation can only be used once." -»@ImplicitlySingleUse« -// semantic_error "This annotation can only be used once." -»@ImplicitlySingleUse« -class IncorrectUse diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/duplicateTarget.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/duplicateTarget.sdstest deleted file mode 100644 index d7f62e321..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/duplicateTarget.sdstest +++ /dev/null @@ -1,11 +0,0 @@ -package tests.validation.other.annotationCalls.duplicateTarget - -@Target( - // semantic_warning "This annotation target is used multiple times." - »AnnotationTarget.Annotation«, - // semantic_warning "This annotation target is used multiple times." - »AnnotationTarget.Annotation«, - // no_semantic_warning "This annotation target is used multiple times." - »AnnotationTarget.Class« -) -annotation TestAnnotation diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python module (1).sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python module (1).sdstest deleted file mode 100644 index 5f1c77abe..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python module (1).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// semantic_info "Python module is identical to Safe-DS package (can remove annotation call)." -»@PythonModule("tests.validation.other.annotationCalls.identicalPythonModule")« -package tests.validation.other.annotationCalls.identicalPythonModule diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python module (2).sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python module (2).sdstest deleted file mode 100644 index 500a4711c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python module (2).sdstest +++ /dev/null @@ -1,7 +0,0 @@ -// no_semantic_info "Python module is identical to Safe-DS package (can remove annotation call)." -»@PythonModule("tests.validation.other.annotation_calls.identical_python_module")« -package tests.validation.other.annotationCalls.identicalPythonModule - -// no_semantic_info "Python module is identical to Safe-DS package (can remove annotation call)." -»@PythonModule("TestClass")« -class TestClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python name.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python name.sdstest deleted file mode 100644 index 5b42d55c3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/identical python name.sdstest +++ /dev/null @@ -1,9 +0,0 @@ -package tests.validation.other.annotationCalls.identicalPythonName - -// semantic_info "Python name is identical to Safe-DS name (can remove annotation call)." -»@PythonName("TestClass1")« -class TestClass1 - -// no_semantic_info "Python name is identical to Safe-DS name (can remove annotation call)." -»@PythonName("Test_Class_2")« -class TestClass2 diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/missingArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/missingArgumentList.sdstest deleted file mode 100644 index 36a232305..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/missingArgumentList.sdstest +++ /dev/null @@ -1,35 +0,0 @@ -package tests.validation.other.annotationCalls.missingArgumentList - -@Repeatable -annotation AnnotationWithoutParameterList - -@Repeatable -annotation AnnotationWithEmptyParameterList() - -@Repeatable -annotation AnnotationWithoutRequiredParameters(a: Int = 0) - -@Repeatable -annotation AnnotationWithRequiredParameters(a: Int) - -// no_semantic_error "Missing argument list." -@»AnnotationWithoutParameterList« -// no_semantic_error "Missing argument list." -@»AnnotationWithoutParameterList()« -// no_semantic_error "Missing argument list." -@»AnnotationWithEmptyParameterList« -// no_semantic_error "Missing argument list." -@»AnnotationWithEmptyParameterList()« -// no_semantic_error "Missing argument list." -@»AnnotationWithoutRequiredParameters« -// no_semantic_error "Missing argument list." -@»AnnotationWithoutRequiredParameters()« -// semantic_error "Missing argument list." -@»AnnotationWithRequiredParameters« -// no_semantic_error "Missing argument list." -@»AnnotationWithRequiredParameters()« -// no_semantic_error "Missing argument list." -@»UnresolvedAnnotation« -// no_semantic_error "Missing argument list." -@»UnresolvedAnnotation()« -class MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/pure implies no side effects.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/pure implies no side effects.sdstest deleted file mode 100644 index cd080cfae..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/pure implies no side effects.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.validation.other.annotationCalls.pureImpliesNoSideEffects - -// no_semantic_info "Purity implies absence of side effects (remove this annotation call)." -»@NoSideEffects« -fun functionWithoutSideEffects() - -// semantic_info "Purity implies absence of side effects (remove this annotation call)." -»@NoSideEffects« -@Pure -fun pureFunctionWithoutSideEffects() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/target.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/target.sdstest deleted file mode 100644 index 19a524a95..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/target.sdstest +++ /dev/null @@ -1,151 +0,0 @@ -// semantic_error "This annotation cannot be applied to a compilation unit." -»@AnnotationForEnums« -// no_semantic_error "This annotation cannot be applied to a compilation unit." -»@AnnotationForCompilationUnits« -// no_semantic_error "This annotation cannot be applied to a compilation unit." -»@AnnotationForMultipleTargets« -// no_semantic_error "This annotation cannot be applied to a compilation unit." -»@AnnotationForAnything« -// no_semantic_error "This annotation cannot be applied to a compilation unit." -»@UnresolvedAnnotation« - -package tests.validation.other.annotationCalls.target - -@Target(AnnotationTarget.Annotation) -annotation AnnotationForAnnotations - -@Target(AnnotationTarget.Attribute) -annotation AnnotationForAttributes - -@Target(AnnotationTarget.Class) -annotation AnnotationForClasses - -@Target(AnnotationTarget.CompilationUnit) -annotation AnnotationForCompilationUnits - -@Target(AnnotationTarget.Enum) -annotation AnnotationForEnums - -@Target(AnnotationTarget.EnumVariant) -annotation AnnotationForEnumVariants - -@Target(AnnotationTarget.Function) -annotation AnnotationForFunctions - -@Target(AnnotationTarget.Parameter) -annotation AnnotationForParameters - -@Target(AnnotationTarget.Result) -annotation AnnotationForResults - -@Target(AnnotationTarget.TypeParameter) -annotation AnnotationForTypeParameters - -@Target(AnnotationTarget.Pipeline) -annotation AnnotationForPipelines - -@Target(AnnotationTarget.Step) -annotation AnnotationForSteps - -@Target(AnnotationTarget.CompilationUnit, AnnotationTarget.Class) -annotation AnnotationForMultipleTargets - -annotation AnnotationForAnything - -/* Test declarations -------------------------------------------------------- */ - -// semantic_error "This annotation cannot be applied to an annotation." -»@AnnotationForAttributes« -// no_semantic_error "This annotation cannot be applied to an annotation." -»@AnnotationForAnnotations« -// no_semantic_error "This annotation cannot be applied to an annotation." -»@AnnotationForAnything« -annotation TestAnnotation - -// semantic_error "This annotation cannot be applied to a class." -»@AnnotationForCompilationUnits« -// no_semantic_error "This annotation cannot be applied to a class." -»@AnnotationForClasses« -// no_semantic_error "This annotation cannot be applied to a class." -»@AnnotationForMultipleTargets« -// no_semantic_error "This annotation cannot be applied to a class." -»@AnnotationForAnything« -class TestClass< - - // semantic_error "This annotation cannot be applied to a type parameter." - »@AnnotationForPipelines« - // no_semantic_error "This annotation cannot be applied to a type parameter." - »@AnnotationForTypeParameters« - // no_semantic_error "This annotation cannot be applied to a type parameter." - »@AnnotationForAnything« - TEST_TYPE_PARAMETER -> { - - // semantic_error "This annotation cannot be applied to an attribute." - »@AnnotationForClasses« - // no_semantic_error "This annotation cannot be applied to an attribute." - »@AnnotationForAttributes« - // no_semantic_error "This annotation cannot be applied to an attribute." - »@AnnotationForAnything« - attr testAttribute: Int -} - -// semantic_error "This annotation cannot be applied to an enum." -»@AnnotationForEnumVariants« -// no_semantic_error "This annotation cannot be applied to an enum." -»@AnnotationForEnums« -// no_semantic_error "This annotation cannot be applied to an enum." -»@AnnotationForAnything« -enum TestEnum { - - // semantic_error "This annotation cannot be applied to an enum variant." - »@AnnotationForFunctions« - // no_semantic_error "This annotation cannot be applied to an enum variant." - »@AnnotationForEnumVariants« - // no_semantic_error "This annotation cannot be applied to an enum variant." - »@AnnotationForAnything« - TestEnumVariant -} - - -// semantic_error "This annotation cannot be applied to a function." -»@AnnotationForParameters« -// no_semantic_error "This annotation cannot be applied to a function." -»@AnnotationForFunctions« -// no_semantic_error "This annotation cannot be applied to a function." -»@AnnotationForAnything« -fun testFunction( - - // semantic_error "This annotation cannot be applied to a parameter." - »@AnnotationForResults« - // no_semantic_error "This annotation cannot be applied to a parameter." - »@AnnotationForParameters« - // no_semantic_error "This annotation cannot be applied to a parameter." - »@AnnotationForAnything« - testParameter: Int -) -> ( - - // semantic_error "This annotation cannot be applied to a result." - »@AnnotationForTypeParameters« - // no_semantic_error "This annotation cannot be applied to a result." - »@AnnotationForResults« - // no_semantic_error "This annotation cannot be applied to a result." - »@AnnotationForAnything« - testResult: Int -) - -// semantic_error "This annotation cannot be applied to a pipeline." -»@AnnotationForSteps« -// no_semantic_error "This annotation cannot be applied to a pipeline." -»@AnnotationForPipelines« -// no_semantic_error "This annotation cannot be applied to a pipeline." -»@AnnotationForAnything« -pipeline testPipeline {} - -// semantic_error "This annotation cannot be applied to a step." -»@AnnotationForAnnotations« -// no_semantic_error "This annotation cannot be applied to a step." -»@AnnotationForSteps« -// no_semantic_error "This annotation cannot be applied to a step." -»@AnnotationForAnything« -step testStep() {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/unnecessaryArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/unnecessaryArgumentList.sdstest deleted file mode 100644 index e23be7081..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/annotationCalls/unnecessaryArgumentList.sdstest +++ /dev/null @@ -1,35 +0,0 @@ -package tests.validation.other.annotationCalls.unnecessaryArgumentList - -@Repeatable -annotation AnnotationWithoutParameterList - -@Repeatable -annotation AnnotationWithEmptyParameterList() - -@Repeatable -annotation AnnotationWithoutRequiredParameters(a: Int = 0) - -@Repeatable -annotation AnnotationWithRequiredParameters(a: Int) - -// semantic_info "Unnecessary argument list." -@AnnotationWithoutParameterList»()« -// no_semantic_info "Unnecessary argument list." -@AnnotationWithoutParameterList»(1)« -// semantic_info "Unnecessary argument list." -@AnnotationWithEmptyParameterList»()« -// no_semantic_info "Unnecessary argument list." -@AnnotationWithEmptyParameterList»(1)« -// semantic_info "Unnecessary argument list." -@AnnotationWithoutRequiredParameters»()« -// no_semantic_info "Unnecessary argument list." -@AnnotationWithoutRequiredParameters»(1)« -// no_semantic_info "Unnecessary argument list." -@AnnotationWithParameters»()« -// no_semantic_info "Unnecessary argument list." -@AnnotationWithParameters»(1)« -// no_semantic_info "Unnecessary argument list." -@UnresolvedAnnotation»()« -// no_semantic_info "Unnecessary argument list." -@UnresolvedAnnotation»(1)« -class MyClass diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/missingRequiredParameter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/missingRequiredParameter.sdstest deleted file mode 100644 index 666a96cb4..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/missingRequiredParameter.sdstest +++ /dev/null @@ -1,82 +0,0 @@ -package tests.validation.other.argumentLists.missingRequiredParameter - -annotation A(a: Int, b: Int = 0) - -// semantic_error "The parameter 'a' is required and must be set here." -@A»()« -class C(a: Int, b: Int = 0) - -enum E { - V(a: Int, b: Int = 0) -} - -// no_semantic_error "The parameter 'a' is required and must be set here." -@A»(a = 1)« -// no_semantic_error "The parameter 'b' is required and must be set here." -@A»(a = 1, b = 1)« -// no_semantic_error "The parameter 'a' is required and must be set here." -@A»(1, 2, 3)« -fun f(a: Int, b: Int = 0) - -step g(f: (a: Int, b: Int = 0) -> ()) { - // semantic_error "The parameter 'a' is required and must be set here." - f»()«; - // no_semantic_error "The parameter 'a' is required and must be set here." - f»(a = 1)«; - // no_semantic_error "The parameter 'b' is required and must be set here." - f»(a = 1, b = 1)«; - // no_semantic_error "The parameter 'a' is required and must be set here." - f»(1, 2, 3)«; -} - -step stepWithVariadicParameter(vararg values: Int) {} - -pipeline myPipeline { - // semantic_error "The parameter 'a' is required and must be set here." - C»()«; - // no_semantic_error "The parameter 'a' is required and must be set here." - C»(a = 1)«; - // no_semantic_error "The parameter 'b' is required and must be set here." - C»(a = 1, b = 1)«; - // no_semantic_error "The parameter 'a' is required and must be set here." - C»(1, 2, 3)«; - - // semantic_error "The parameter 'a' is required and must be set here." - E.V»()«; - // no_semantic_error "The parameter 'a' is required and must be set here." - E.V»(a = 1)«; - // no_semantic_error "The parameter 'b' is required and must be set here." - E.V»(a = 1, b = 1)«; - // no_semantic_error "The parameter 'a' is required and must be set here." - E.V»(1, 2, 3)«; - - // semantic_error "The parameter 'a' is required and must be set here." - f»()«; - // no_semantic_error "The parameter 'a' is required and must be set here." - f»(a = 1)«; - // no_semantic_error "The parameter 'b' is required and must be set here." - f»(a = 1, b = 1)«; - // no_semantic_error "The parameter 'a' is required and must be set here." - f»(1, 2, 3)«; - - // semantic_error "The parameter 'a' is required and must be set here." - ((a, b) {})»()«; - // no_semantic_error "The parameter 'a' is required and must be set here." - ((a, b) {})»(a = 1)«; - // no_semantic_error "The parameter 'b' is required and must be set here." - ((a, b) {})»(a = 1, b = 1)«; - // no_semantic_error "The parameter 'a' is required and must be set here." - ((a, b) {})»(1, 2, 3)«; - - // semantic_error "The parameter 'a' is required and must be set here." - ((a, b) -> 1)»()«; - // no_semantic_error "The parameter 'a' is required and must be set here." - ((a, b) -> 1)»(a = 1)«; - // no_semantic_error "The parameter 'b' is required and must be set here." - ((a, b) -> 1)»(a = 1, b = 1)«; - // no_semantic_error "The parameter 'a' is required and must be set here." - ((a, b) -> 1)»(1, 2, 3)«; - - // no_semantic_error "The parameter 'values' is required and must be set here." - stepWithVariadicParameter(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/noPositionalArgumentsAfterFirstNamedArgument.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/noPositionalArgumentsAfterFirstNamedArgument.sdstest deleted file mode 100644 index 4be08f045..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/noPositionalArgumentsAfterFirstNamedArgument.sdstest +++ /dev/null @@ -1,45 +0,0 @@ -package tests.validation.other.argumentLists.noPositionalArgumentsAfterFirstNamedArgument - -annotation MyAnnotation(a: Int, b: Int = 0, c: Int = 0, d: Int = 0, vararg e: Int) - -// no_semantic_error "After the first named argument all arguments must be named." -// no_semantic_error "After the first named argument all arguments must be named." -// semantic_error "After the first named argument all arguments must be named." -// no_semantic_error "After the first named argument all arguments must be named." -// semantic_error "After the first named argument all arguments must be named." -@MyAnnotation(»0«, »a = 1«, »2«, »b = 3«, »4«) class MyClass1 - -// no_semantic_error "After the first named argument all arguments must be named." -@MyAnnotation(»0«) class MyClass2 - -// no_semantic_error "After the first named argument all arguments must be named." -// no_semantic_error "After the first named argument all arguments must be named." -// semantic_error "After the first named argument all arguments must be named." -// no_semantic_error "After the first named argument all arguments must be named." -@UnresolvedAnnotation(»0«, »a = 1«, »2«, »b = 3«) class MyClass3 - -// no_semantic_error "After the first named argument all arguments must be named." -@UnresolvedAnnotation(»0«) class MyClass4 - -fun f(a: Int, b: Int = 0, c: Int = 0, d: Int = 0, vararg e: Int) - -pipeline myPipeline { - // no_semantic_error "After the first named argument all arguments must be named." - // no_semantic_error "After the first named argument all arguments must be named." - // semantic_error "After the first named argument all arguments must be named." - // no_semantic_error "After the first named argument all arguments must be named." - // semantic_error "After the first named argument all arguments must be named." - f(»0«, »a = 1«, »2«, »b = 3«, »4«); - - // no_semantic_error "After the first named argument all arguments must be named." - f(»0«); - - // no_semantic_error "After the first named argument all arguments must be named." - // no_semantic_error "After the first named argument all arguments must be named." - // semantic_error "After the first named argument all arguments must be named." - // no_semantic_error "After the first named argument all arguments must be named." - unresolvedCallable(»0«, »a = 1«, »2«, »b = 3«); - - // no_semantic_error "After the first named argument all arguments must be named." - unresolvedCallable(»0«); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/tooManyArguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/tooManyArguments.sdstest deleted file mode 100644 index a970094c3..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/tooManyArguments.sdstest +++ /dev/null @@ -1,88 +0,0 @@ -package tests.validation.other.argumentLists.tooManyArguments - -annotation MyAnnotation1(a: Int, b: Int = 0) -annotation MyAnnotation2(a: Int) -annotation MyAnnotation3(vararg a: Int) - -// semantic_error "Expected between 1 and 2 arguments but got 3." -@MyAnnotation1»(1, 2, 3)« -// semantic_error "Expected exactly 1 argument but got 3." -@MyAnnotation2»(1, 2, 3)« -class MyClass1(a: Int, b: Int = 0) - -// no_semantic_error "Expected between 1 and 2 arguments but got 0." -@MyAnnotation1»(1)« -// no_semantic_error "Expected exactly 1 argument but got 0." -@MyAnnotation2»(1)« -// no_semantic_error "Expected exactly 1 argument but got 2." -@MyAnnotation3»(1, 2)« -class MyClass2(a: Int) -class MyClass3(vararg a: Int) - -enum MyEnum { - MyVariant1(a: Int, b: Int = 0) - MyVariant2(a: Int) - MyVariant3(vararg a: Int) -} - -fun myFunction1(a: Int, b: Int = 0) -fun myFunction2(a: Int) -fun myFunction3(vararg a: Int) - -step g(f1: (a: Int, b: Int = 0) -> (), f2: (a: Int) -> (), f3: (vararg a: Int) -> ()) { - // semantic_error "Expected between 1 and 2 arguments but got 3." - f1»(1, 2, 3)«; - // semantic_error "Expected exactly 1 argument but got 3." - f2»(1, 2, 3)«; - // no_semantic_error "Expected between 1 and 2 arguments but got 0." - f1»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 0." - f2»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 2." - f3»(1, 2)«; -} - -pipeline myPipeline { - // semantic_error "Expected between 1 and 2 arguments but got 3." - MyClass1»(1, 2, 3)«; - // semantic_error "Expected exactly 1 argument but got 3." - MyClass2»(1, 2, 3)«; - // no_semantic_error "Expected between 1 and 2 arguments but got 0." - MyClass1»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 0." - MyClass2»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 2." - MyClass3»(1, 2)«; - - // semantic_error "Expected between 1 and 2 arguments but got 3." - MyEnum.MyVariant1»(1, 2, 3)«; - // semantic_error "Expected exactly 1 argument but got 3." - MyEnum.MyVariant2»(1, 2, 3)«; - // no_semantic_error "Expected between 1 and 2 arguments but got 0." - MyEnum.MyVariant1»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 0." - MyEnum.MyVariant2»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 2." - MyEnum.MyVariant3»(1, 2)«; - - // semantic_error "Expected between 1 and 2 arguments but got 3." - myFunction1»(1, 2, 3)«; - // semantic_error "Expected exactly 1 argument but got 3." - myFunction2»(1, 2, 3)«; - // no_semantic_error "Expected between 1 and 2 arguments but got 0." - myFunction1»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 0." - myFunction2»(1)«; - // no_semantic_error "Expected exactly 1 argument but got 2." - myFunction3»(1, 2)«; - - // semantic_error "Expected exactly 1 argument but got 3." - ((a) {})»(1, 2, 3)«; - // no_semantic_error "Expected exactly 1 argument but got 0." - ((a) {})»(1)«; - - // semantic_error "Expected exactly 1 argument but got 3." - ((a) -> 1)»(1, 2, 3)«; - // no_semantic_error "Expected exactly 1 argument but got 0." - ((a) -> 1)»(1)«; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/uniqueParameters.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/uniqueParameters.sdstest deleted file mode 100644 index 30313a464..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/argumentLists/uniqueParameters.sdstest +++ /dev/null @@ -1,162 +0,0 @@ -package tests.validation.other.argumentLists.uniqueParameters - -annotation A(a: Int, b: Int = 0) - -@A( - // semantic_error "The parameter 'a' is already set." - »1«, - // semantic_error "The parameter 'a' is already set." - »a = 1« -) -@A( - // semantic_error "The parameter 'b' is already set." - »b = 1«, - // semantic_error "The parameter 'b' is already set." - »b = 1« -) -class C(a: Int, b: Int = 0) - -enum E { - V(a: Int, b: Int = 0) -} - -@A( - // no_semantic_error "The parameter 'a' is already set." - »a = 1«, - // no_semantic_error "The parameter 'b' is already set." - »b = 1« -) -fun f(a: Int, b: Int = 0, vararg c: Int) - -step g(f: (a: Int, b: Int = 0) -> ()) { - f( - // semantic_error "The parameter 'a' is already set." - »1«, - // semantic_error "The parameter 'a' is already set." - »a = 1« - ); - f( - // semantic_error "The parameter 'b' is already set." - »b = 1«, - // semantic_error "The parameter 'b' is already set." - »b = 1« - ); - f( - // no_semantic_error "The parameter 'a' is already set." - »a = 1«, - // no_semantic_error "The parameter 'b' is already set." - »b = 1« - ); - f( - // no_semantic_error "The parameter 'c' is already set." - »c = 1«, - // no_semantic_error "The parameter 'c' is already set." - »c = 1« - ); - f( - 1, - 2, - // no_semantic_error "The parameter 'c' is already set." - »3«, - // no_semantic_error "The parameter 'c' is already set." - »4« - ); -} - -pipeline test { - C( - // semantic_error "The parameter 'a' is already set." - »1«, - // semantic_error "The parameter 'a' is already set." - »a = 1« - ); - C( - // semantic_error "The parameter 'b' is already set." - »b = 1«, - // semantic_error "The parameter 'b' is already set." - »b = 1« - ); - C( - // no_semantic_error "The parameter 'a' is already set." - »a = 1«, - // no_semantic_error "The parameter 'b' is already set." - »b = 1« - ); - - E.V( - // semantic_error "The parameter 'a' is already set." - »1«, - // semantic_error "The parameter 'a' is already set." - »a = 1« - ); - E.V( - // semantic_error "The parameter 'b' is already set." - »b = 1«, - // semantic_error "The parameter 'b' is already set." - »b = 1« - ); - E.V( - // no_semantic_error "The parameter 'a' is already set." - »a = 1«, - // no_semantic_error "The parameter 'b' is already set." - »b = 1« - ); - - - f( - // semantic_error "The parameter 'a' is already set." - »1«, - // semantic_error "The parameter 'a' is already set." - »a = 1« - ); - f( - // semantic_error "The parameter 'b' is already set." - »b = 1«, - // semantic_error "The parameter 'b' is already set." - »b = 1« - ); - f( - // no_semantic_error "The parameter 'a' is already set." - »a = 1«, - // no_semantic_error "The parameter 'b' is already set." - »b = 1« - ); - - ((a, b) {})( - // semantic_error "The parameter 'a' is already set." - »1«, - // semantic_error "The parameter 'a' is already set." - »a = 1« - ); - ((a, b) {})( - // semantic_error "The parameter 'b' is already set." - »b = 1«, - // semantic_error "The parameter 'b' is already set." - »b = 1« - ); - ((a, b) {})( - // no_semantic_error "The parameter 'a' is already set." - »a = 1«, - // no_semantic_error "The parameter 'b' is already set." - »b = 1« - ); - - ((a, b) -> 1)( - // semantic_error "The parameter 'a' is already set." - »1«, - // semantic_error "The parameter 'a' is already set." - »a = 1« - ); - ((a, b) -> 1)( - // semantic_error "The parameter 'b' is already set." - »b = 1«, - // semantic_error "The parameter 'b' is already set." - »b = 1« - ); - ((a, b) -> 1)( - // no_semantic_error "The parameter 'a' is already set." - »a = 1«, - // no_semantic_error "The parameter 'b' is already set." - »b = 1« - ); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/is unnecessary in call.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/is unnecessary in call.sdstest deleted file mode 100644 index 915df9cbf..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/is unnecessary in call.sdstest +++ /dev/null @@ -1,46 +0,0 @@ -package tests.validation.expressions.typeArgumentList.isUnnecessaryInCall - -class ClassWithoutTypeParameters() -class ClassWithTypeParameters() - -enum Enum { - VariantWithoutTypeParameters - VariantWithTypeParameters -} - -fun functionWithoutTypeParameters() -fun functionWithTypeParameters() - -pipeline myPipeline { - // semantic_info "Unnecessary type argument list." - ClassWithoutTypeParameters»<>«(); - // semantic_info "Unnecessary type argument list." - ClassWithoutTypeParameters»«(); - // no_semantic_info "Unnecessary type argument list." - ClassWithTypeParameters»<>«(); - // no_semantic_info "Unnecessary type argument list." - ClassWithTypeParameters»«(); - - // semantic_info "Unnecessary type argument list." - Enum.VariantWithoutTypeParameters»<>«(); - // semantic_info "Unnecessary type argument list." - Enum.VariantWithoutTypeParameters»«(); - // no_semantic_info "Unnecessary type argument list." - Enum.VariantWithTypeParameters»<>«(); - // no_semantic_info "Unnecessary type argument list." - Enum.VariantWithTypeParameters»«(); - - // semantic_info "Unnecessary type argument list." - functionWithoutTypeParameters»<>«(); - // semantic_info "Unnecessary type argument list." - functionWithoutTypeParameters»«(); - // no_semantic_info "Unnecessary type argument list." - functionWithTypeParameters»<>«(); - // no_semantic_info "Unnecessary type argument list." - functionWithTypeParameters»«(); - - // no_semantic_info "Unnecessary type argument list." - unresolved»<>«(); - // no_semantic_info "Unnecessary type argument list." - unresolved»«(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/is unnecessary in named type.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/is unnecessary in named type.sdstest deleted file mode 100644 index d713aa573..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/is unnecessary in named type.sdstest +++ /dev/null @@ -1,46 +0,0 @@ -package tests.validation.expressions.typeArgumentList.isUnnecessaryNamedType - -class ClassWithoutTypeParameters() -class ClassWithTypeParameters() - -enum Enum { - VariantWithoutTypeParameters - VariantWithTypeParameters -} - -fun functionWithoutTypeParameters() -fun functionWithTypeParameters() - -fun myFunction( - // semantic_info "Unnecessary type argument list." - a: ClassWithoutTypeParameters»<>«, - // semantic_info "Unnecessary type argument list." - b: ClassWithoutTypeParameters»«, - // no_semantic_info "Unnecessary type argument list." - c: ClassWithTypeParameters»<>«, - // no_semantic_info "Unnecessary type argument list." - d: ClassWithTypeParameters»«, - - // semantic_info "Unnecessary type argument list." - e: Enum.VariantWithoutTypeParameters»<>«, - // semantic_info "Unnecessary type argument list." - f: Enum.VariantWithoutTypeParameters»«, - // no_semantic_info "Unnecessary type argument list." - g: Enum.VariantWithTypeParameters»<>«, - // no_semantic_info "Unnecessary type argument list." - h: Enum.VariantWithTypeParameters»«, - - // no_semantic_info "Unnecessary type argument list." - i: functionWithoutTypeParameters»<>«, - // no_semantic_info "Unnecessary type argument list." - j: functionWithoutTypeParameters»«, - // no_semantic_info "Unnecessary type argument list." - k: functionWithTypeParameters»<>«, - // no_semantic_info "Unnecessary type argument list." - l: functionWithTypeParameters»«, - - // no_semantic_info "Unnecessary type argument list." - m: Unresolved»<>«, - // no_semantic_info "Unnecessary type argument list." - n: Unresolved»«, -) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/missingRequiredTypeParameter.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/missingRequiredTypeParameter.sdstest deleted file mode 100644 index e38e56ea6..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/missingRequiredTypeParameter.sdstest +++ /dev/null @@ -1,12 +0,0 @@ -package tests.missingRequiredTypeParameter - -class MyClass - -step myStep( - // semantic_error "The type parameter 'T' is required and must be set here." - g: MyClass»<>«, - // no_semantic_error "The type parameter 'T' is required and must be set here." - h: MyClass»«, - // no_semantic_error "The type parameter 'T' is required and must be set here." - i: MyClass»« -) {} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/noPositionalTypeArgumentsAfterFirstNamedTypeArgument.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/noPositionalTypeArgumentsAfterFirstNamedTypeArgument.sdstest deleted file mode 100644 index ca086b89b..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/noPositionalTypeArgumentsAfterFirstNamedTypeArgument.sdstest +++ /dev/null @@ -1,25 +0,0 @@ -package tests.noPositionalTypeArgumentsAfterFirstNamedTypeArgument - -// no_semantic_error "After the first named type argument all type arguments must be named." -// no_semantic_error "After the first named type argument all type arguments must be named." -// semantic_error "After the first named type argument all type arguments must be named." -// no_semantic_error "After the first named type argument all type arguments must be named." -step myStep1( - f: MyClass<»Int«, »A = Int«, »Int«, »B = Int«> -) {} - -// no_semantic_error "After the first named type argument all type arguments must be named." -step myStep2( - f: MyClass<»Int«> -) {} - -pipeline myPipeline { - // no_semantic_error "After the first named type argument all type arguments must be named." - // no_semantic_error "After the first named type argument all type arguments must be named." - // semantic_error "After the first named type argument all type arguments must be named." - // no_semantic_error "After the first named type argument all type arguments must be named." - call<»Int«, »A = Int«, »Int«, »B = Int«>(); - - // no_semantic_error "After the first named type argument all type arguments must be named." - call<»Int«>(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/tooManyTypeArguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/tooManyTypeArguments.sdstest deleted file mode 100644 index ba1a3d73d..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/tooManyTypeArguments.sdstest +++ /dev/null @@ -1,17 +0,0 @@ -package tests.validation.typeArgumentLists.tooManyTypeArguments - -class MyClass1 -class MyClass2 - -step myStep( - // no_semantic_error r"Expected exactly \d* type arguments? but got \d*\." - f: MyClass1»<>«, - // no_semantic_error r"Expected exactly \d* type arguments? but got \d*\." - g: MyClass1»«, - // semantic_error "Expected exactly 1 type argument but got 2." - h: MyClass1»«, - // semantic_error "Expected exactly 2 type arguments but got 3." - i: MyClass2»«, - // no_semantic_error r"Expected exactly \d* type arguments? but got \d*\." - j: Unresolved»« -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/uniqueTypeParameters.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/uniqueTypeParameters.sdstest deleted file mode 100644 index 0563ed69f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/other/typeArgumentLists/uniqueTypeParameters.sdstest +++ /dev/null @@ -1,30 +0,0 @@ -package tests.validation.typeArgumentLists.uniqueTypeParameters - -class MyClass - -step myStep( - f: MyClass< - // semantic_error "The type parameter 'A' is already set." - »Int«, - // semantic_error "The type parameter 'A' is already set." - »A = Int« - >, - g: MyClass< - // semantic_error "The type parameter 'B' is already set." - »B = Int«, - // semantic_error "The type parameter 'B' is already set." - »B = Int« - >, - h: MyClass< - // no_semantic_error r"The type parameter '\w+' is already set\." - »A = Int«, - // no_semantic_error r"The type parameter '\w+' is already set\." - »B = Int« - >, - i: MyClass< - // no_semantic_error r"The type parameter '\w+' is already set\." - »Unresolved = Int«, - // no_semantic_error r"The type parameter '\w+' is already set\." - »Unresolved = Int« - > -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/inferSchema.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/inferSchema.sdstest deleted file mode 100644 index bdca6d9ef..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/inferSchema.sdstest +++ /dev/null @@ -1,132 +0,0 @@ -package tests.validation.schemaTest.inferInitialSchema - -class Dataset { - - static fun loadAndCheckDataset ( - @Constant datasetPath: String, - @Constant columnName: String, - ) -> dataset: Dataset { - constraint { - val ::IntermediateSchema = $readSchema(datasetPath), - yield ::InitialSchema = $checkColumn(::IntermediateSchema, columnName) - } - } - - fun checkColumn (@Constant vararg columnName: String) -> (dataset: Dataset) { - constraint { - yield ::SchemaOut = $checkColumn(::CurrentSchema, columnName) - } - } - - fun removeColumn (@Constant vararg columnName: String) -> (dataset: Dataset) { - constraint { - val ::IntermediateSchema = $checkColumn(::CurrentSchema, columnName), - yield ::SchemaOut = $removeColumn(::IntermediateSchema, columnName) - } - } - - fun removeColumnSilent (@Constant vararg columnName: String) -> (dataset: Dataset) { - constraint { - yield ::SchemaOut = $removeColumn(::CurrentSchema, columnName) - } - } - - fun keepColumn (@Constant vararg columnName: String) -> (dataset: Dataset) { - constraint { - yield ::SchemaOut = $keepColumn(::CurrentSchema, columnName) - } - } - - fun renameColumn ( - @Constant columnName1: String, - @Constant columnName2: String, - ) -> (dataset: Dataset) { - constraint { - val ::IntermediateSchema = $checkColumn(::CurrentSchema, columnName1), - yield ::SchemaOut = $renameColumn(::IntermediateSchema, columnName1, columnName2) - } - } - - fun addColumn (@Constant columnName: String) -> (dataset: Dataset) { - constraint { - yield ::SchemaOut = $addColumn(::CurrentSchema, columnName) - } - } - - fun changeColumnType (@Constant columnName: String) -> (dataset: Dataset) { - constraint { - yield ::SchemaOut = $changeColumnType(::CurrentSchema, columnName) - } - } -} - -pipeline myPipeline { - val path = "./src/test/resources/schema/dummyData.csv"; - - /* Read Dataset *******************************************************************************/ - - // no_semantic_error "Dataset could not be read." - // no_semantic_error "Dataset does not have column named 'Column11'." - val dataset = Dataset.loadAndCheckDataset(»path«, »"Column11"«); - - - /* Remove Column ******************************************************************************/ - - // no_semantic_error "Dataset does not have column named 'Column1'." - // no_semantic_error "Dataset does not have column named 'Column2'." - val data1 = dataset.checkColumn(»"Column1"«, »"Column2"«).removeColumn("Column1", "Column2"); - - // semantic_error "Dataset does not have column named 'Column1'." - data1.checkColumn(»"Column1"«); - // semantic_error "Dataset does not have column named 'Column2'." - data1.checkColumn(»"Column2"«); - - // semantic_error "Dataset does not have column named 'foo'." - dataset.removeColumn(»"foo"«); - - // no_semantic_error "Dataset does not have column named 'bar'." - dataset.removeColumnSilent(»"bar"«); - - - /* Rename Column ******************************************************************************/ - - // semantic_error "Dataset already has column named 'Column4'." - dataset.renameColumn("Column3", »"Column4"«); - - // no_semantic_error "Dataset already has column named 'NewColumn'." - val data2 = dataset.renameColumn("Column3", »"NewColumn"«); - - // no_semantic_error "Dataset does not have column named 'NewColumn'." - // semantic_error "Dataset does not have column named 'Column3'." - data2.checkColumn(»"NewColumn"«, »"Column3"«); - - - /* Keep Column ********************************************************************************/ - - dataset.checkColumn("Column1", "Column2", "Column3", "Column4"); - - val data3 = dataset.keepColumn("Column1", "Column2"); - - // no_semantic_error "Dataset does not have column named 'NewColumn'." - // no_semantic_error "Dataset does not have column named 'NewColumn'." - data3.checkColumn(»"Column1"«, »"Column2"«); - - // semantic_error "Dataset does not have column named 'Column3'." - data3.checkColumn(»"Column3"«); - // semantic_error "Dataset does not have column named 'Column4'." - data3.checkColumn(»"Column4"«); - - /* Change Column Type *************************************************************************/ - - val data4 = dataset.changeColumnType("Column0"); - - /* Keep Column ********************************************************************************/ - - // semantic_error "Dataset does not have column named 'New'." - data4.checkColumn(»"New"«); - - val data5 = data4.addColumn("New"); - - // no_semantic_error "Dataset does not have column named 'New'." - data5.checkColumn(»"New"«); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/predicate.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/predicate.sdstest deleted file mode 100644 index d9afc8a58..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/predicate.sdstest +++ /dev/null @@ -1,67 +0,0 @@ -package tests.validation.schemaTest.predicateTest - -class Dataset { - - static fun loadDataset (@Constant datasetPath: String) -> dataset: Dataset { - constraint { - yield ::InitialSchema = $readSchema(datasetPath) - } - } - - fun checkColumn (@Constant vararg columnName: String) ->(dataset: Dataset) { - constraint { - yield ::SchemaOut = $checkColumn(::CurrentSchema, columnName) - } - } - - fun funWithPred ( - @Constant columnName1: String, - @Constant columnName2: String, - @Constant columnName3: String, - @Constant columnName4: String, - @Constant columnName5: String, - ) -> (dataset: Dataset) { - constraint { - yield ::SchemaOut = predOuter (::CurrentSchema, columnName1, columnName2, columnName3, columnName4, columnName5) - } - } -} - -predicate predOuter ( - ::SchemaIn, - columnName1: String, - columnName2: String, - columnName3: String, - columnName4: String, - columnName5: String, -) -> ::SchemaOut { - val ::S1 = $removeColumn(::SchemaIn, columnName1), - val ::S2 = $renameColumn(::S1, columnName2, columnName3), - yield ::SchemaOut = predInner (::S2, columnName4, columnName5) -} - -predicate predInner ( - ::SchemaIn, - colName1: String, - colName2: String, -) -> ::SchemaOut { - val ::S1 = $removeColumn(::SchemaIn, colName1), - yield ::SchemaOut = $addColumn (::S1, colName2) -} - -pipeline myPipeline { - // no_semantic_error "Dataset could not be read." - val dataset = Dataset.loadDataset(»"./src/test/resources/schema/dummyData.csv"«); - val dataResult = dataset.funWithPred ("Column1", "Column2", "foo", "Column4", "bar"); - - // semantic_error "Dataset does not have column named 'Column1'." - dataResult.checkColumn(»"Column1"«); - // semantic_error "Dataset does not have column named 'Column2'." - dataResult.checkColumn(»"Column2"«); - // no_semantic_error "Dataset does not have column named 'foo'." - dataResult.checkColumn(»"foo"«); - // semantic_error "Dataset does not have column named 'Column4'." - dataResult.checkColumn(»"Column4"«); - // no_semantic_error "Dataset does not have column named 'bar'." - dataResult.checkColumn(»"bar"«); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/schemaEffects.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/schemaEffects.sdstest deleted file mode 100644 index 373710220..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/schema/schemaEffects.sdstest +++ /dev/null @@ -1,8 +0,0 @@ -package tests.validation.schemaTest.schemaEffects - -// semantic_error "Abstract predicates can only be declared for schema effects." -abstract predicate »abstractPredicate«() - -// no_semantic_error "Abstract predicates can only be declared for schema effects." -// semantic_error "Abstract predicates can only be declared in standard library." -abstract predicate »»$checkColumn««() diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/hasNoEffect.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/hasNoEffect.sdstest deleted file mode 100644 index b232f8fa5..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/hasNoEffect.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -step myFunction() -> a: Int { - // semantic_warning "This statement does nothing." - »_ = 1 + 2;« - - // no_semantic_warning "This statement does nothing." - »val a = 1;« - // no_semantic_warning "This statement does nothing." - »yield a = 1;« - - () { - // semantic_warning "This statement does nothing." - »_ = 1 + 2;« - - // no_semantic_warning "This statement does nothing." - »val a = 1;« - // no_semantic_warning "This statement does nothing." - »yield a = 1;« - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/ignoresResultOfCall.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/ignoresResultOfCall.sdstest deleted file mode 100644 index 6af1ff8a8..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/ignoresResultOfCall.sdstest +++ /dev/null @@ -1,65 +0,0 @@ -package tests.ignoresResultOfCall - -class MyClass { - static fun oneResult() -> first: Int - static fun twoResults() -> (first: Int, second: Int) -} - -fun functionOneResult() -> first: Int -fun functionTwoResults() -> (first: Int, second: Int) - -step stepOneResult() -> first: Int {} -step stepTwoResults() -> (first: Int, second: Int) {} - -step test( - paramOneResult: () -> first: Int, - paramTwoResults: () -> (first: Int, second: Int) -) { - val lambdaOneResult = () { - yield first = 1; - }; - val lambdaTwoResults = () { - yield first = 1; - yield second = 2; - }; - - // no_semantic_warning "The result 'first' is implicitly ignored." - »val methodResult1« = MyClass.oneResult(); - // no_semantic_warning "The result 'first' is implicitly ignored." - »val methodResult2« = MyClass.twoResults(); - // semantic_warning "The result 'second' is implicitly ignored." - »val methodResult3« = MyClass.twoResults(); - - // no_semantic_warning "The result 'first' is implicitly ignored." - »val functionResult1« = functionOneResult(); - // no_semantic_warning "The result 'first' is implicitly ignored." - »val functionResult2« = functionTwoResults(); - // semantic_warning "The result 'second' is implicitly ignored." - »val functionResult3« = functionTwoResults(); - - // no_semantic_warning "The result 'first' is implicitly ignored." - »val stepResult1« = stepOneResult(); - // no_semantic_warning "The result 'first' is implicitly ignored." - »val stepResult2« = stepTwoResults(); - // semantic_warning "The result 'second' is implicitly ignored." - »val stepResult3« = stepTwoResults(); - - // no_semantic_warning "The result 'first' is implicitly ignored." - »val callableResult1« = paramOneResult(); - // no_semantic_warning "The result 'first' is implicitly ignored." - »val callableResult2« = paramTwoResults(); - // semantic_warning "The result 'second' is implicitly ignored." - »val callableResult3« = paramTwoResults(); - - // no_semantic_warning "The result 'first' is implicitly ignored." - »val lambdaResult1« = paramOneResult(); - // no_semantic_warning "The result 'first' is implicitly ignored." - »val lambdaResult2« = paramTwoResults(); - // semantic_warning "The result 'second' is implicitly ignored." - »val lambdaResult3« = paramTwoResults(); - - /* If the call cannot be resolved, no additional error should be displayed. */ - - // no_semantic_warning "The result '???' is implicitly ignored." - »val unresolved« = bla(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/nothingAssigned.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/nothingAssigned.sdstest deleted file mode 100644 index dbbe985fd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/nothingAssigned.sdstest +++ /dev/null @@ -1,29 +0,0 @@ -package tests.nothing_assigned - -fun noResults() -fun oneResult() -> first: Int -fun twoResults() -> (first: Int, second: Int) - -step f() { - // semantic_error "No value is assigned to this assignee." - »val a« = noResults(); - // semantic_error "No value is assigned to this assignee." - _, »val b« = oneResult(); - // semantic_error "No value is assigned to this assignee." - _, _, »val c« = twoResults(); - // semantic_error "No value is assigned to this assignee." - _, »val d« = 1; - - // no_semantic_error "No value is assigned to this assignee." - »val e« = oneResult(); - // no_semantic_error "No value is assigned to this assignee." - »val f« = twoResults(); - - - /****************************************************************************************************************** - * If we call an unknown function we already show a different error. - ******************************************************************************************************************/ - - // no_semantic_error "No value is assigned to this assignee." - »val g« = unknownFunction(); -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/unnecessaryAssignment.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/unnecessaryAssignment.sdstest deleted file mode 100644 index 13687f839..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/assignments/unnecessaryAssignment.sdstest +++ /dev/null @@ -1,31 +0,0 @@ -package tests.validation.statements.assignments.unnecessaryAssignment - -fun f() -> (a: Int, b: Int) - -class MyClass { - fun f() -> (a: Int, b: Int) -} - -step myFunction() -> a: Int { - // semantic_info "This assignment can be converted to an expression statement." - »_, _ = f();« - // semantic_info "This assignment can be converted to an expression statement." - »_, _ = MyClass().f();« - - // no_semantic_info "This assignment can be converted to an expression statement." - »val a = 1;« - // no_semantic_info "This assignment can be converted to an expression statement." - »yield a = 1;« - - () { - // semantic_info "This assignment can be converted to an expression statement." - »_, _ = f();« - // semantic_info "This assignment can be converted to an expression statement." - »_, _ = MyClass().f();« - - // no_semantic_info "This assignment can be converted to an expression statement." - »val a = 1;« - // no_semantic_info "This assignment can be converted to an expression statement." - »yield a = 1;« - }; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/expressionStatements/hasNoEffect.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/expressionStatements/hasNoEffect.sdstest deleted file mode 100644 index b5fc08bdb..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/statements/expressionStatements/hasNoEffect.sdstest +++ /dev/null @@ -1,78 +0,0 @@ -package tests.validation.statements.expressionStatements.hasNoEffect - -fun impureFunction() -@Pure fun pureFunction() -> a: Int - -class MyClass() { - fun impureFunction() - @Pure fun pureFunction() -} - -step pureStep() { - val a = pureFunction(); -} - -step impureStep() { - impureFunction(); -} - -step recursiveA() { - recursiveB(); -} - -step recursiveB() { - recursiveA(); -} - -step myStep() { - // semantic_warning "This statement does nothing." - »1 + 2;« - // semantic_warning "This statement does nothing." - »pureFunction();« - // semantic_warning "This statement does nothing." - »MyClass().pureFunction();« - - // no_semantic_warning "This statement does nothing." - »impureFunction();« - // no_semantic_warning "This statement does nothing." - »MyClass().impureFunction();« - - () { - // semantic_warning "This statement does nothing." - »1 + 2;« - // semantic_warning "This statement does nothing." - »pureFunction();« - // semantic_warning "This statement does nothing." - »MyClass().pureFunction();« - - // no_semantic_warning "This statement does nothing." - »impureFunction();« - // no_semantic_warning "This statement does nothing." - »MyClass().impureFunction();« - }; - - // semantic_warning "This statement does nothing." - »(() { - pureFunction(); - MyClass().pureFunction(); - })();« - - // semantic_warning "This statement does nothing." - »pureStep();« - - // no_semantic_warning "This statement does nothing." - »(() { - impureFunction(); - })();« - - // no_semantic_warning "This statement does nothing." - »(() { - MyClass().impureFunction(); - })();« - - // no_semantic_warning "This statement does nothing." - »impureStep();« - - // no_semantic_warning "This statement does nothing." - »recursiveA();« -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/arguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/arguments.sdstest deleted file mode 100644 index cdd85aea0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/arguments.sdstest +++ /dev/null @@ -1,336 +0,0 @@ -package tests.validation.typeChecking.arguments - -step myStep(vararg variadicParam: Int) { - - // no_semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»intToInt«); - // semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»f2«); - // semantic_error "An argument of type 'B' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»B()«); - // semantic_error "An argument of type 'C' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(callableType = »C()«); - // semantic_error "An argument of type 'D' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»maybeC()«); - // semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»someVariantOfMyEnum1()«); - // semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»someVariantOfMyEnum2()«); - // semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»MyEnum1.Variant1«); - // semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»MyEnum1.Variant2«); - // semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»MyEnum2.Variant1«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»aOrC()«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»bOrC()«); - // semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type '(Int) -> (Int)'." - f1(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f1(unresolved = »1«); - - // semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type 'C'." - f2(»intToInt«); - // semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type 'C'." - f2(»f2«); - // semantic_error "An argument of type 'B' cannot be assigned to a parameter of type 'C'." - f2(»B()«); - // no_semantic_error "An argument of type 'C' cannot be assigned to a parameter of type 'C'." - f2(classType = »C()«); - // no_semantic_error "An argument of type 'D' cannot be assigned to a parameter of type 'C'." - f2(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type 'C'." - f2(»maybeC()«); - // semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type 'C'." - f2(»someVariantOfMyEnum1()«); - // semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type 'C'." - f2(»someVariantOfMyEnum2()«); - // semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type 'C'." - f2(»MyEnum1.Variant1«); - // semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type 'C'." - f2(»MyEnum1.Variant2«); - // semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type 'C'." - f2(»MyEnum2.Variant1«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'C'." - f2(»aOrC()«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'C'." - f2(»bOrC()«); - // semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type 'C'." - f2(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type 'C'." - f2(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f2(unresolved = »1«); - - // semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»intToInt«); - // semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»f2«); - // semantic_error "An argument of type 'B' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»B()«); - // semantic_error "An argument of type 'C' cannot be assigned to a parameter of type 'MyEnum1'." - f3(enumType = »C()«); - // semantic_error "An argument of type 'D' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»maybeC()«); - // no_semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»someVariantOfMyEnum1()«); - // semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»someVariantOfMyEnum2()«); - // no_semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»MyEnum1.Variant1«); - // no_semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»MyEnum1.Variant2«); - // semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»MyEnum2.Variant1«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»aOrC()«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»bOrC()«); - // semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type 'MyEnum1'." - f3(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f3(unresolved = »1«); - - // semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»intToInt«); - // semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»f2«); - // semantic_error "An argument of type 'B' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»B()«); - // semantic_error "An argument of type 'C' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(enumVariantType = »C()«); - // semantic_error "An argument of type 'D' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»maybeC()«); - // semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»someVariantOfMyEnum1()«); - // semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»someVariantOfMyEnum2()«); - // no_semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»MyEnum1.Variant1«); - // semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»MyEnum1.Variant2«); - // semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»MyEnum2.Variant1«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»aOrC()«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»bOrC()«); - // semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type 'MyEnum1.Variant1'." - f4(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f4(unresolved = »1«); - - // semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type 'union'." - f5(»intToInt«); - // semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type 'union'." - f5(»f2«); - // no_semantic_error "An argument of type 'B' cannot be assigned to a parameter of type 'union'." - f5(»B()«); - // no_semantic_error "An argument of type 'C' cannot be assigned to a parameter of type 'union'." - f5(unionType = »C()«); - // no_semantic_error "An argument of type 'D' cannot be assigned to a parameter of type 'union'." - f5(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type 'union'." - f5(»maybeC()«); - // semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type 'union'." - f5(»someVariantOfMyEnum1()«); - // semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type 'union'." - f5(»someVariantOfMyEnum2()«); - // semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type 'union'." - f5(»MyEnum1.Variant1«); - // semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type 'union'." - f5(»MyEnum1.Variant2«); - // semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type 'union'." - f5(»MyEnum2.Variant1«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'union'." - f5(»aOrC()«); - // no_semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'union'." - f5(»bOrC()«); - // semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type 'union'." - f5(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type 'union'." - f5(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f5(unresolved = »1«); - - // semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type '$Unresolved'." - f6(»intToInt«); - // semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type '$Unresolved'." - f6(»f2«); - // semantic_error "An argument of type 'B' cannot be assigned to a parameter of type '$Unresolved'." - f6(»B()«); - // semantic_error "An argument of type 'C' cannot be assigned to a parameter of type '$Unresolved'." - f6(unresolvedType = »C()«); - // semantic_error "An argument of type 'D' cannot be assigned to a parameter of type '$Unresolved'." - f6(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type '$Unresolved'." - f6(»maybeC()«); - // semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type '$Unresolved'." - f6(»someVariantOfMyEnum1()«); - // semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type '$Unresolved'." - f6(»someVariantOfMyEnum2()«); - // semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type '$Unresolved'." - f6(»MyEnum1.Variant1«); - // semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type '$Unresolved'." - f6(»MyEnum1.Variant2«); - // semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type '$Unresolved'." - f6(»MyEnum2.Variant1«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type '$Unresolved'." - f6(»aOrC()«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type '$Unresolved'." - f6(»bOrC()«); - // semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type '$Unresolved'." - f6(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type '$Unresolved'." - f6(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f6(unresolved = »1«); - - // semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type 'vararg'." - f7(»intToInt«); - // semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type 'vararg'." - f7(»f2«); - // semantic_error "An argument of type 'B' cannot be assigned to a parameter of type 'vararg'." - f7(»B()«); - // no_semantic_error "An argument of type 'C' cannot be assigned to a parameter of type 'vararg'." - f7(unresolvedType = »C()«); - // no_semantic_error "An argument of type 'D' cannot be assigned to a parameter of type 'vararg'." - f7(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type 'vararg'." - f7(»maybeC()«); - // semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type 'vararg'." - f7(»someVariantOfMyEnum1()«); - // semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type 'vararg'." - f7(»someVariantOfMyEnum2()«); - // semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type 'vararg'." - f7(»MyEnum1.Variant1«); - // semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type 'vararg'." - f7(»MyEnum1.Variant2«); - // semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type 'vararg'." - f7(»MyEnum2.Variant1«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'vararg'." - f7(»aOrC()«); - // semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'vararg'." - f7(»bOrC()«); - // semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type 'vararg'." - f7(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type 'vararg'." - f7(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f7(unresolved = »1«); - - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f8(»(vararg a: Int) {}«); - - // no_semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type 'Any'." - f9(»intToInt«); - // no_semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type 'Any'." - f9(»f2«); - // no_semantic_error "An argument of type 'B' cannot be assigned to a parameter of type 'Any'." - f9(»B()«); - // no_semantic_error "An argument of type 'C' cannot be assigned to a parameter of type 'Any'." - f9(callableType = »C()«); - // no_semantic_error "An argument of type 'D' cannot be assigned to a parameter of type 'Any'." - f9(»D()«); - // semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type 'Any'." - f9(»maybeC()«); - // no_semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type 'Any'." - f9(»someVariantOfMyEnum1()«); - // no_semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type 'Any'." - f9(»someVariantOfMyEnum2()«); - // no_semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type 'Any'." - f9(»MyEnum1.Variant1«); - // no_semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type 'Any'." - f9(»MyEnum1.Variant2«); - // no_semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type 'Any'." - f9(»MyEnum2.Variant1«); - // no_semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'Any'." - f9(»aOrC()«); - // no_semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'Any'." - f9(»bOrC()«); - // no_semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type 'Any'." - f9(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type 'Any'." - f9(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f9(unresolved = »1«); - - // no_semantic_error "An argument of type '(Int) -> (Int)' cannot be assigned to a parameter of type 'Any?'." - f10(»intToInt«); - // no_semantic_error "An argument of type '(C) -> ()' cannot be assigned to a parameter of type 'Any?'." - f10(»f2«); - // no_semantic_error "An argument of type 'B' cannot be assigned to a parameter of type 'Any?'." - f10(»B()«); - // no_semantic_error "An argument of type 'C' cannot be assigned to a parameter of type 'Any?'." - f10(callableType = »C()«); - // no_semantic_error "An argument of type 'D' cannot be assigned to a parameter of type 'Any?'." - f10(»D()«); - // no_semantic_error "An argument of type 'C?' cannot be assigned to a parameter of type 'Any?'." - f10(»maybeC()«); - // no_semantic_error "An argument of type 'MyEnum1' cannot be assigned to a parameter of type 'Any?'." - f10(»someVariantOfMyEnum1()«); - // no_semantic_error "An argument of type 'MyEnum2' cannot be assigned to a parameter of type 'Any?'." - f10(»someVariantOfMyEnum2()«); - // no_semantic_error "An argument of type 'MyEnum1.Variant1' cannot be assigned to a parameter of type 'Any?'." - f10(»MyEnum1.Variant1«); - // no_semantic_error "An argument of type 'MyEnum1.Variant2' cannot be assigned to a parameter of type 'Any?'." - f10(»MyEnum1.Variant2«); - // no_semantic_error "An argument of type 'MyEnum2.Variant1' cannot be assigned to a parameter of type 'Any?'." - f10(»MyEnum2.Variant1«); - // no_semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'Any?'." - f10(»aOrC()«); - // no_semantic_error "An argument of type 'union' cannot be assigned to a parameter of type 'Any?'." - f10(»bOrC()«); - // no_semantic_error "An argument of type 'vararg' cannot be assigned to a parameter of type 'Any?'." - f10(»variadicParam«); - // no_semantic_error "An argument of type '$Unresolved' cannot be assigned to a parameter of type 'Any?'." - f10(»unresolved«); - // no_semantic_error r"An argument of type '[^']*' cannot be assigned to a parameter of type '[^']*'." - f10(unresolved = »1«); -} - -fun f1(callableType: (a: Int) -> (r: Int)) -fun f2(classType: C) -fun f3(enumType: MyEnum1) -fun f4(enumVariantType: MyEnum1.Variant1) -fun f5(unionType: union) -fun f6(unresolvedType: Unresolved) -fun f7(vararg variadicType: C) -fun f8(callableType: (vararg a: Int) -> ()) -fun f9(any: Any) -fun f10(anyOrNull: Any?) - -class A() -class B() -class C() -class D() sub C - -enum MyEnum1 { - Variant1 - Variant2 -} -enum MyEnum2 { - Variant1 - Variant2 -} - -fun maybeC() -> instanceOrNull: C? -fun aOrC() -> instance: union -fun bOrC() -> instance: union -fun someVariantOfMyEnum1() -> variant: MyEnum1 -fun someVariantOfMyEnum2() -> variant: MyEnum2 -fun intToInt(a: Int) -> (r: Int) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/defaultValues.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/defaultValues.sdstest deleted file mode 100644 index 9a077ab70..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/defaultValues.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -package tests.validation.typeChecking.defaultValues - -fun myFun( - // no_semantic_error "An default value of type 'Int' cannot be assigned to a parameter of type 'Int'." - param1: Int = »1«, - - // semantic_error "A default value of type 'String' cannot be assigned to a parameter of type 'Int'." - param2: Int = »""«, -) - -fun myOtherFun(callback: (a: Int) -> ()) - -step myStep() { - // no_semantic_error "An default value of type 'Int' cannot be assigned to a parameter of type 'Int'." - myOtherFun((a = »1«) {}); - - // semantic_error "A default value of type 'String' cannot be assigned to a parameter of type 'Int'." - myOtherFun((a = »""«) {}); -} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/indexedAccesses.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/indexedAccesses.sdstest deleted file mode 100644 index 8eb576994..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/indexedAccesses.sdstest +++ /dev/null @@ -1,39 +0,0 @@ -package tests.validation.typeChecking.indexedAccesses - -step f(a: Int, vararg b: Int) { - // semantic_error "The receiver of an indexed access must refer to a variadic parameter." - »a«[0]; - - // no_semantic_error "The receiver of an indexed access must refer to a variadic parameter." - »b«[0]; - - // no_semantic_error "The receiver of an indexed access must refer to a variadic parameter." - »unresolved«[0]; - - // no_semantic_error "The receiver of an indexed access must refer to a variadic parameter." - »C.unresolved«[0]; - - // no_semantic_error "The index of an indexed access must be an instance of the class 'Int'." - b[»0«]; - - // semantic_error "The index of an indexed access must be an instance of the class 'Int'." - b[»""«]; - - // semantic_error "The index of an indexed access must be an instance of the class 'Int'." - b[»g«]; - - // semantic_error "The index of an indexed access must be an instance of the class 'Int'." - b[»h()«]; - - // semantic_error "The index of an indexed access must be an instance of the class 'Int'." - b[»b«]; - - // no_semantic_error "The index of an indexed access must be an instance of the class 'Int'." - b[»unresolved«]; - - // no_semantic_error "The index of an indexed access must be an instance of the class 'Int'." - b[»C.unresolved«]; -} - -fun g() -fun h() -> index: Int? diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/infixOperations.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/infixOperations.sdstest deleted file mode 100644 index c0c2a0ef0..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/infixOperations.sdstest +++ /dev/null @@ -1,230 +0,0 @@ -package tests.validation.typeChecking.infixOperations - -step f(vararg a: Int) { - - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »true« or »true« ; - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »false« or »false«; - // semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »i()« or »i()«; - // semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »0« or »0«; - // semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »a« or »a«; - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »unresolved« or »unresolved«; - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »C.unresolved« or »C.unresolved«; - - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »true« and »true«; - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »false« and »false«; - // semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »i()« and »i()«; - // semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »0« and »0«; - // semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »a« and »a«; - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »unresolved« and »unresolved«; - // no_semantic_error "The left operand of a logical infix operation must be an instance of the class 'Boolean'." - // no_semantic_error "The right operand of a logical infix operation must be an instance of the class 'Boolean'." - »C.unresolved« and »C.unresolved«; - - - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0.0« + »0.0«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0« + »0«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »h()« + »h()«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »""« + »""«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »a« + »a«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »unresolved« + »unresolved«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« + »C.unresolved«; - - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0.0« - »0.0«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0« - »0«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »h()« - »h()«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »""« - »""«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »a« - »a«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »unresolved« - »unresolved«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« - »C.unresolved«; - - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0.0« * »0.0«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0« * »0«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »h()« * »h()«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »""« * »""«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »a« * »a«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »unresolved« * »unresolved«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« * »C.unresolved«; - - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0.0« / »0.0«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »0« / »0«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »h()« / »h()«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »""« / »""«; - // semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »a« / »a«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »unresolved« / »unresolved«; - // no_semantic_error "The left operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of an arithmetic infix operation must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« / »C.unresolved«; - - - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0.0« < »0.0«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0« < »0«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »h()« < »h()«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »""« < »""«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »a« < »a«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »unresolved« < »unresolved«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« < »C.unresolved«; - - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0.0« <= »0.0«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0« <= »0«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »h()« <= »h()«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »""« <= »""«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »a« <= »a«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »unresolved« <= »unresolved«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« <= »C.unresolved«; - - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0.0« >= »0.0«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0« >= »0«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »h()« >= »h()«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »""« >= »""«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »a« >= »a«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »unresolved« >= »unresolved«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« >= »C.unresolved«; - - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0.0« > »0.0«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »0« > »0«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »h()« > »h()«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »""« > »""«; - // semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »a« > »a«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »unresolved« > »unresolved«; - // no_semantic_error "The left operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - // no_semantic_error "The right operand of a comparison must be an instance of the class 'Float' or the class 'Int'." - »C.unresolved« > »C.unresolved«; -} - -fun g() -fun h() -> index: Int? -fun i() -> isTrue: Boolean? diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/predicateArguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/predicateArguments.sdstest deleted file mode 100644 index ebfc7fcbd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/predicateArguments.sdstest +++ /dev/null @@ -1,10 +0,0 @@ -package tests.validation.typeChecking.predicateArguments - -predicate predicateArgumentsTypeChecking(){ - // semantic_error "An argument of type 'Boolean' cannot be assigned to a parameter of type 'String'." - predicateWithStringParameter(»false«), - // semantic_error "An argument of type 'Int' cannot be assigned to a parameter of type 'String'." - predicateWithStringParameter(»1«) -} - -predicate predicateWithStringParameter(stringParam: String) {} \ No newline at end of file diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/prefixOperations.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/prefixOperations.sdstest deleted file mode 100644 index e3ed3b126..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/prefixOperations.sdstest +++ /dev/null @@ -1,38 +0,0 @@ -package tests.validation.typeChecking.prefixOperations - -step f(vararg a: Int) { - - // no_semantic_error "The operand of a logical negation must be an instance of the class 'Boolean'." - not »true«; - // no_semantic_error "The operand of a logical negation must be an instance of the class 'Boolean'." - not »false«; - // semantic_error "The operand of a logical negation must be an instance of the class 'Boolean'." - not »i()«; - // semantic_error "The operand of a logical negation must be an instance of the class 'Boolean'." - not »0«; - // semantic_error "The operand of a logical negation must be an instance of the class 'Boolean'." - not »a«; - // no_semantic_error "The operand of a logical negation must be an instance of the class 'Boolean'." - not »unresolved«; - // no_semantic_error "The operand of a logical negation must be an instance of the class 'Boolean'." - not »C.unresolved«; - - // no_semantic_error "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'." - -»0.0«; - // no_semantic_error "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'." - -»0«; - // semantic_error "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'." - -»h()«; - // semantic_error "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'." - -»""«; - // semantic_error "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'." - -»a«; - // no_semantic_error "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'." - -»unresolved«; - // no_semantic_error "The operand of an arithmetic negation must be an instance of the class 'Float' or the class 'Int'." - -»C.unresolved«; -} - -fun g() -fun h() -> index: Int? -fun i() -> isTrue: Boolean? diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/schemaEffectArguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/schemaEffectArguments.sdstest deleted file mode 100644 index e0185b100..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/schemaEffectArguments.sdstest +++ /dev/null @@ -1,22 +0,0 @@ -package tests.validation.typeChecking.schemaEffectArguments - -predicate schemaEffects (){ - - /* $ReadSchema ---------------------------------------------------------------------------------------------------*/ - // semantic_error "An argument of type 'Boolean' cannot be assigned to a parameter of type 'String'." - $readSchema(»false«), - - // no_semantic_error "An argument of type 'String' cannot be assigned to a parameter of type 'String'." - $readSchema(»"datasetNameStr"«), - - /* $CheckColumn --------------------------------------------------------------------------------------------------*/ - // semantic_error "An argument of type 'Boolean' cannot be assigned to a parameter of type '::$SchemaType'." - // semantic_error "An argument of type 'Int' cannot be assigned to a parameter of type 'vararg'." - // no_semantic_error "An argument of type 'safeds.lang.String' cannot be assigned to a parameter of type 'safeds.lang.String'." - $checkColumn(»false«, »0«, »"columnNameStr2"«), - - // no_semantic_error "An argument of type '::$SchemaType' cannot be assigned to a parameter of type '::$SchemaType'." - // no_semantic_error "An argument of type 'String' cannot be assigned to a parameter of type 'vararg'." - // no_semantic_error "An argument of type 'String' cannot be assigned to a parameter of type 'String'." - $checkColumn(»::ASchema«, »"columnNameStr1"«, »"columnNameStr2"«) -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/yields.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/yields.sdstest deleted file mode 100644 index 999ce85cd..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/typeChecking/yields.sdstest +++ /dev/null @@ -1,13 +0,0 @@ -package tests.validation.typeChecking.yields - -step myStep1() -> result: Int { - - // no_semantic_error "A value of type 'Int' cannot be assigned to a result of type 'Int'." - yield result = »1«; -} - -step myStep2() -> result: Int { - - // semantic_error "A value of type 'String' cannot be assigned to a result of type 'Int'." - yield result = »""«; -} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/callableTypes/no optional parameters.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/types/callableTypes/no optional parameters.sdstest deleted file mode 100644 index b5a8553cb..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/callableTypes/no optional parameters.sdstest +++ /dev/null @@ -1,4 +0,0 @@ -package tests.validation.types.callableTypes.noOptionalParameters - -// semantic_error "Parameters in callable types must not be optional." -fun f(g: (param: Int = »1«) -> ()) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/callableTypes/uniqueNames.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/types/callableTypes/uniqueNames.sdstest deleted file mode 100644 index 0a26eb77f..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/callableTypes/uniqueNames.sdstest +++ /dev/null @@ -1,23 +0,0 @@ -package tests.uniqueNames - -step s( - f: ( - // semantic_error "A parameter or result with name 'duplicateParameter' exists already in this callable type." - »duplicateParameter«: Int, - // semantic_error "A parameter or result with name 'duplicateParameter' exists already in this callable type." - »duplicateParameter«: Int, - // no_semantic_error "A parameter or result with name 'uniqueParameter' exists already in this callable type." - »uniqueParameter«: Int, - // semantic_error "A parameter or result with name 'parameterAndResult' exists already in this callable type." - »parameterAndResult«: Int - ) -> ( - // semantic_error "A parameter or result with name 'duplicateResult' exists already in this callable type." - »duplicateResult«: Int, - // semantic_error "A parameter or result with name 'duplicateResult' exists already in this callable type." - »duplicateResult«: Int, - // no_semantic_error "A parameter or result with name 'uniqueResult' exists already in this callable type." - »uniqueResult«: Int, - // semantic_error "A parameter or result with name 'parameterAndResult' exists already in this callable type." - »parameterAndResult«: Int - ) -) {} diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/namedTypes/missingTypeArgumentList.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/types/namedTypes/missingTypeArgumentList.sdstest deleted file mode 100644 index 2dfd9c30c..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/namedTypes/missingTypeArgumentList.sdstest +++ /dev/null @@ -1,19 +0,0 @@ -package tests.validation.types.namedTypes.missingTypeArgumentList - -class ClassWithoutTypeParameters -class ClassWithTypeParameters - -fun myFunction( - // no_semantic_error "Missing type argument list." - a: »ClassWithoutTypeParameters«, - // no_semantic_error "Missing type argument list." - b: »ClassWithoutTypeParameters«, - // semantic_error "Missing type argument list." - c: »ClassWithTypeParameters«, - // semantic_error "Missing type argument list." - d: »ClassWithTypeParameters«, - // no_semantic_error "Missing type argument list." - e: »UnresolvedClass«, - // no_semantic_error "Missing type argument list." - f: »UnresolvedClass«, -) diff --git a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/unionTypes/numberOfTypeArguments.sdstest b/DSL/com.larsreimann.safeds/src/test/resources/validation/types/unionTypes/numberOfTypeArguments.sdstest deleted file mode 100644 index 4f684a4d1..000000000 --- a/DSL/com.larsreimann.safeds/src/test/resources/validation/types/unionTypes/numberOfTypeArguments.sdstest +++ /dev/null @@ -1,21 +0,0 @@ -package tests.numberOfTypeArguments - -// semantic_error "A union type must have least one type argument." -step myStep1( - f: »union<>« -) {} - -// semantic_info "A union type with one type argument is equivalent to the the type argument itself." -step myStep1( - f: »union« -) {} - -// no_semantic_error "A union type must have least one type argument." -step myStep1( - f: »union« -) {} - -// no_semantic_info "A union type with one type argument is equivalent to the the type argument itself." -step myStep1( - f: »union« -) {} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/LineBreaks.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/LineBreaks.kt deleted file mode 100644 index 750fcece2..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/LineBreaks.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.larsreimann.safeds.testing - -/** - * Replaces line-breaks in the string with the ones used by the operating system (\n on Unix, \r on MacOS, \r\n on - * Windows). - */ -fun String.withSystemLineBreaks(): String { - return this - .replace(Regex("\r\n?"), "\n") - .replace("\n", System.lineSeparator()) -} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/ParseHelper.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/ParseHelper.kt deleted file mode 100644 index e7f212204..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/ParseHelper.kt +++ /dev/null @@ -1,113 +0,0 @@ -@file:Suppress("unused", "MemberVisibilityCanBePrivate") - -package com.larsreimann.safeds.testing - -import com.google.inject.Inject -import com.google.inject.Provider -import com.larsreimann.safeds.safeDS.SdsCompilationUnit -import com.larsreimann.safeds.stdlibAccess.loadStdlib -import org.eclipse.core.runtime.FileLocator -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.xtext.testing.util.ParseHelper -import java.nio.file.Files -import java.nio.file.Paths - -/** - * Relative path under the `resources` folder of the test source set. - */ -typealias ResourceName = String - -/** - * Utilities for tests that load their test data from files or strings. - */ -class ParseHelper @Inject constructor( - private val parseHelper: ParseHelper, - private val resourceSetProvider: Provider -) { - - /** - * Parses the contents of the resource with the given [resourceName] and returns the contained [SdsCompilationUnit] - * or `null` if something went wrong. Any resources in the [context] are included in the same [ResourceSet]. - * Likewise, if [loadStdlib] is `true`, the standard library is also included in the [ResourceSet]. - */ - fun parseResource( - resourceName: ResourceName, - context: List = emptyList(), - loadStdlib: Boolean = true - ): SdsCompilationUnit? { - - val programText = readProgramTextFromResource(resourceName) ?: return null - val uri = javaClass.classLoader.getResourceEmfUri(resourceName) ?: return null - return parseProgramText(programText, uri, context, loadStdlib) - } - - /** - * Parses the given [programText] and returns the contained [SdsCompilationUnit] or `null` if something went wrong. - * Any resources in the [context] are included in the same [ResourceSet]. Likewise, if [loadStdlib] is `true`, the - * standard library is also included in the [ResourceSet]. - */ - fun parseProgramText( - programText: String, - context: List = emptyList(), - loadStdlib: Boolean = true - ): SdsCompilationUnit? { - - val resourceSet = createResourceSetFromContext(context) - if (loadStdlib) { - resourceSet.loadStdlib() - } - return parseHelper.parse(programText, resourceSet) - } - - /** - * Parses the given [programText] and returns the contained [SdsCompilationUnit] or `null` if something went wrong. - * The [URI] of the [Resource] that contains the created [SdsCompilationUnit] is set to [uriToUse]. Any resources in - * the [context] are included in the same [ResourceSet]. Likewise, if [loadStdlib] is `true`, the standard library - * is also included in the [ResourceSet]. - */ - fun parseProgramText( - programText: String, - uriToUse: URI, - context: List = emptyList(), - loadStdlib: Boolean = true - ): SdsCompilationUnit? { - - val resourceSet = createResourceSetFromContext(context) - if (loadStdlib) { - resourceSet.loadStdlib() - } - return parseHelper.parse(programText, uriToUse, resourceSet) - } - - /** - * Returns the program text within the resource with the given [resourceName] or `null` if reading failed. - */ - private fun readProgramTextFromResource(resourceName: ResourceName): String? { - val resourcePath = javaClass.classLoader.getResourcePath(resourceName) ?: return null - if (!Files.isReadable(resourcePath)) { - return null - } - - return Files.readString(resourcePath).replace("\r\n", "\n") - } - - /** - * Creates a [ResourceSet] containing all resources in the [context]. - */ - private fun createResourceSetFromContext(context: List): ResourceSet { - val result = resourceSetProvider.get() - for (resourceName in context) { - val resourceUrl = javaClass.classLoader.getResource(resourceName) ?: continue - val resourceFileUri = FileLocator.resolve(resourceUrl).toURI() - val resourceEmfUri = URI.createURI(resourceFileUri.toString(), false) - val resourcePath = Paths.get(resourceFileUri) - - result - .createResource(resourceEmfUri) - ?.load(Files.newInputStream(resourcePath), result.loadOptions) - } - return result - } -} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/SafeDSInjectorProvider.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/SafeDSInjectorProvider.kt deleted file mode 100644 index 059fce7f9..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/SafeDSInjectorProvider.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.larsreimann.safeds.testing - -import com.google.inject.Guice -import com.google.inject.Injector -import com.larsreimann.safeds.SafeDSRuntimeModule -import com.larsreimann.safeds.SafeDSStandaloneSetup -import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento -import org.eclipse.xtext.testing.GlobalRegistries.initializeDefaults -import org.eclipse.xtext.testing.GlobalRegistries.makeCopyOfGlobalState -import org.eclipse.xtext.testing.IInjectorProvider -import org.eclipse.xtext.testing.IRegistryConfigurator - -class SafeDSInjectorProvider : IInjectorProvider, IRegistryConfigurator { - private var stateBeforeInjectorCreation: GlobalStateMemento? = null - private var stateAfterInjectorCreation: GlobalStateMemento? = null - private var injector: Injector? = null - - override fun getInjector(): Injector { - if (injector == null) { - injector = internalCreateInjector() - stateAfterInjectorCreation = makeCopyOfGlobalState() - } - return injector!! - } - - private fun internalCreateInjector(): Injector { - return object : SafeDSStandaloneSetup() { - override fun createInjector(): Injector { - return Guice.createInjector(createRuntimeModule()) - } - }.createInjectorAndDoEMFRegistration() - } - - private fun createRuntimeModule(): SafeDSRuntimeModule { - // make it work also with Maven/Tycho and OSGI - // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672 - return object : SafeDSRuntimeModule() { - override fun bindClassLoaderToInstance(): ClassLoader { - return SafeDSInjectorProvider::class.java.classLoader - } - } - } - - override fun restoreRegistry() { - stateBeforeInjectorCreation!!.restoreGlobalState() - stateBeforeInjectorCreation = null - } - - override fun setupRegistry() { - stateBeforeInjectorCreation = makeCopyOfGlobalState() - if (injector == null) { - getInjector() - } - stateAfterInjectorCreation!!.restoreGlobalState() - } - - companion object { - init { - initializeDefaults() - } - } -} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestMarker.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestMarker.kt deleted file mode 100644 index 781656a5d..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestMarker.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.larsreimann.safeds.testing - -/** - * Describe a program range in a test file from the opening to the closing test marker. - */ -object TestMarker { - - /** - * Start of the test marker. - */ - const val OPEN = '\u00BB' // » - - /** - * End of the test marker. - */ - const val CLOSE = '\u00AB' // « -} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestRanges.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestRanges.kt deleted file mode 100644 index 7947b5e51..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestRanges.kt +++ /dev/null @@ -1,140 +0,0 @@ -package com.larsreimann.safeds.testing - -import com.larsreimann.safeds.location.XtextPosition -import com.larsreimann.safeds.location.XtextRange -import com.larsreimann.safeds.testing.FindTestRangesResult.CloseWithoutOpenFailure -import com.larsreimann.safeds.testing.FindTestRangesResult.OpenWithoutCloseFailure -import com.larsreimann.safeds.testing.FindTestRangesResult.Success -import com.larsreimann.safeds.testing.TestMarker.CLOSE -import com.larsreimann.safeds.testing.TestMarker.OPEN - -/** - * Finds test ranges, i.e. parts of the program delimited by opening and closing test markers. They are sorted by the - * position of their opening test markers. In case opening and closing markers don't match an error value is returned. - * Nested test markers are supported. - * - * @param program The program with test markers. - * @return A wrapper that indicates success of failure. - * @see FindTestRangesResult - * @see TestMarker - */ -fun findTestRanges(program: String): FindTestRangesResult { - var currentLine = 1 - var currentColumn = 1 - var previousChar: Char? = null - - val testRangeStarts = ArrayDeque() - val finishedLocations = mutableListOf() - - program.toCharArray().forEachIndexed { currentIndex, currentChar -> - when (currentChar) { - OPEN -> { - currentColumn++ - - testRangeStarts.addLast( - TestRangeStart(currentLine, currentColumn, currentIndex) - ) - } - CLOSE -> { - currentColumn++ - - if (testRangeStarts.isEmpty()) { - return CloseWithoutOpenFailure( - XtextPosition.fromInts( - line = currentLine, - column = currentColumn - 1 - ) - ) - } - - finishedLocations += testRangeStarts.removeLast().toProgramRange( - endLine = currentLine, - endColumn = currentColumn - 1, - endIndex = currentIndex - 1 - ) - } - '\r' -> { - currentLine++ - currentColumn = 1 - } - '\n' -> { - if (previousChar != '\r') { - currentLine++ - currentColumn = 1 - } - } - else -> { - currentColumn++ - } - } - - previousChar = currentChar - } - - return when { - testRangeStarts.isEmpty() -> Success(finishedLocations.sortedBy { it.start }) - else -> OpenWithoutCloseFailure( - testRangeStarts.map { - XtextPosition.fromInts(it.startLine, it.startColumn - 1) - } - ) - } -} - -/** - * A wrapper that indicates success of failure of the `findTestRanges` method. - */ -@Suppress("MemberVisibilityCanBePrivate") -sealed interface FindTestRangesResult { - - /** - * Opening and closing test markers matched and program ranges were successfully created. - */ - class Success(val ranges: List) : FindTestRangesResult - - /** - * Something went wrong when creating program ranges. - */ - sealed interface Failure : FindTestRangesResult { - - /** - * A human-readable description of what went wrong. - */ - val message: String - } - - /** - * Found a closing test marker without a previous opening test marker. - */ - class CloseWithoutOpenFailure(val position: XtextPosition) : Failure { - override val message: String - get() { - return "Found '$CLOSE' without previous '$OPEN' at $position." - } - } - - /** - * Reached the end of the program but there were still unclosed opening test markers. - */ - class OpenWithoutCloseFailure(val positions: List) : Failure { - override val message: String - get() { - return "Found '$OPEN' without following '$CLOSE' at ${positions.joinToString()}." - } - } -} - -/** - * Stores where a test range starts. - */ -private class TestRangeStart(val startLine: Int, val startColumn: Int, val startIndex: Int) { - fun toProgramRange(endLine: Int, endColumn: Int, endIndex: Int): XtextRange { - return XtextRange.fromInts( - startLine, - startColumn, - endLine, - endColumn, - length = endIndex - startIndex - ) - } -} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestResourceUtils.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestResourceUtils.kt deleted file mode 100644 index 1540b64ab..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/TestResourceUtils.kt +++ /dev/null @@ -1,89 +0,0 @@ -package com.larsreimann.safeds.testing - -import com.larsreimann.safeds.constant.SdsFileExtension -import com.larsreimann.safeds.utils.ExperimentalSdsApi -import org.eclipse.core.runtime.FileLocator -import org.eclipse.emf.common.util.URI -import org.junit.jupiter.api.DynamicContainer -import org.junit.jupiter.api.DynamicNode -import org.junit.jupiter.api.DynamicTest -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths -import java.util.stream.Stream -import kotlin.streams.asSequence - -fun ClassLoader.getResourcePath(fileOrFolder: String): Path? { - val resourceUrl = getResource(fileOrFolder) ?: return null - val resourceFileUri = FileLocator.resolve(resourceUrl).toURI() - return Paths.get(resourceFileUri) -} - -fun ClassLoader.getResourceEmfUri(fileOrFolder: String): URI? { - val resourceUrl = getResource(fileOrFolder) ?: return null - val resourceFileUri = FileLocator.resolve(resourceUrl).toURI() - return URI.createURI(resourceFileUri.toString(), false) -} - -fun Path.createDynamicTestsFromResourceFolder( - validator: (resourcePath: Path, filePath: Path, program: String) -> String?, - categorizedTestCreator: (resourcePath: Path, filePath: Path, program: String) -> Sequence, -): Stream { - return Files.walk(this) - .asSequence() - .filter(::isTestFile) - .flatMap { filePath -> createDynamicTestFromResource(this, filePath, validator, categorizedTestCreator) } - .groupBy { it.category } - .map { (category, tests) -> - DynamicContainer.dynamicContainer(category, tests.map { it.test }) - } - .stream() -} - -private fun createDynamicTestFromResource( - resourcePath: Path, - filePath: Path, - validator: (resourcePath: Path, filePath: Path, program: String) -> String?, - categorizedTestCreator: (resourcePath: Path, filePath: Path, program: String) -> Sequence, -) = sequence { - val program = Files.readString(filePath) - - val testFileError = validator(resourcePath, filePath, program) - if (testFileError != null) { - yield( - CategorizedTest( - "### BAD TEST FILE ###", - DynamicTest.dynamicTest(testDisplayName(resourcePath, filePath), filePath.toUri()) { - throw IllegalArgumentException(testFileError) - }, - ), - ) - } else { - yieldAll(categorizedTestCreator(resourcePath, filePath, program)) - } -} - -@OptIn(ExperimentalSdsApi::class) -private fun isTestFile(filePath: Path): Boolean { - return Files.isRegularFile(filePath) && - ( - filePath.fileName.toString().endsWith(".${SdsFileExtension.Pipeline}") || - filePath.fileName.toString().endsWith(".${SdsFileExtension.Schema}") || - filePath.fileName.toString().endsWith(".${SdsFileExtension.Stub}") || - filePath.fileName.toString().endsWith(".${SdsFileExtension.Test}") - ) && - !filePath.fileName.toString().startsWith("_skip_") -} - -fun testDisplayName(resourcePath: Path, filePath: Path, message: String = "") = buildString { - append("[") - val relativePath = resourcePath.relativize(filePath) - append(relativePath.toString().replace("\\", "/")) - append("]") - - if (message.isNotBlank()) { - append(" \"$message\"") - } -} - -class CategorizedTest(val category: String, val test: DynamicNode) diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/EmfAssertions.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/EmfAssertions.kt deleted file mode 100644 index 5acfb06b7..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/EmfAssertions.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.larsreimann.safeds.testing.assertions - -import com.larsreimann.safeds.emf.descendants -import com.larsreimann.safeds.safeDS.SdsAbstractDeclaration -import org.eclipse.emf.ecore.EObject - -/** - * Find a unique declaration among the descendants of the receiver with the given type and name. - * - * @receiver Root of the subtree within the EMF model that should be searched. - * @param name The name the declaration needs to have. - * @return The unique declaration if it exists. - * @throws AssertionError If no unique declaration exists. - */ -inline fun EObject.findUniqueDeclarationOrFail(name: String): T { - shouldHaveUniqueDeclaration(name) - return this.descendants().find { it.name == name }!! -} - -/** - * Assert that a unique declaration exists among the descendants of the receiver with the given type and name. - * - * @receiver Root of the subtree within the EMF model that should be searched. - * @param name The name the declaration needs to have. - */ -inline fun EObject.shouldHaveUniqueDeclaration(name: String) { - val candidates = this.descendants().filter { it.name == name }.toList() - - if (candidates.isEmpty()) { - throw AssertionError("Expected a unique matching fact of type ${T::class.simpleName} but found none.") - } else if (candidates.size > 1) { - throw AssertionError("Expected a unique matching fact but found ${candidates.size}: $candidates") - } -} - -fun SdsAbstractDeclaration.shouldBeResolved() { - if (this.eIsProxy()) { - throw AssertionError("Expected cross-reference to be resolved but it wasn't.") - } -} - -fun SdsAbstractDeclaration.shouldNotBeResolved() { - if (!this.eIsProxy()) { - throw AssertionError("Expected cross-reference to be unresolved but it wasn't.") - } -} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/NumberAssertions.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/NumberAssertions.kt deleted file mode 100644 index b43a84b3d..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/NumberAssertions.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.larsreimann.safeds.testing.assertions - -import io.kotest.matchers.doubles.plusOrMinus -import io.kotest.matchers.shouldBe - -infix fun Double.shouldBeCloseTo(n: Double) { - this.shouldBe(n plusOrMinus Math.ulp(n)) -} diff --git a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/ParsingAssertions.kt b/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/ParsingAssertions.kt deleted file mode 100644 index 2a18e9eb0..000000000 --- a/DSL/com.larsreimann.safeds/src/testFixtures/kotlin/com/larsreimann/safeds/testing/assertions/ParsingAssertions.kt +++ /dev/null @@ -1,132 +0,0 @@ -package com.larsreimann.safeds.testing.assertions - -import com.larsreimann.safeds.location.XtextRange -import org.eclipse.xtext.diagnostics.Severity -import org.eclipse.xtext.validation.Issue - -fun List.shouldHaveNoErrorsOrWarnings() { - val errorsOrWarnings = this.filter { it.severity == Severity.ERROR || it.severity == Severity.WARNING } - if (errorsOrWarnings.isNotEmpty()) { - throw AssertionError("Expected no errors or warnings but got${errorsOrWarnings.stringify()}") - } -} - -fun List.shouldHaveSyntaxError(expected: ExpectedIssue) { - val syntaxErrors = this.filter { it.isSyntaxError } - if (syntaxErrors.none { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveNoSyntaxError(expected: ExpectedIssue) { - val syntaxErrors = this.filter { it.isSyntaxError } - if (syntaxErrors.any { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveSemanticError(expected: ExpectedIssue) { - val errors = this.filter { it.severity == Severity.ERROR } - if (errors.none { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveNoSemanticError(expected: ExpectedIssue) { - val errors = this.filter { it.severity == Severity.ERROR } - if (errors.any { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveSemanticWarning(expected: ExpectedIssue) { - val warnings = this.filter { it.severity == Severity.WARNING } - if (warnings.none { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveNoSemanticWarning(expected: ExpectedIssue) { - val warnings = this.filter { it.severity == Severity.WARNING } - if (warnings.any { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveSemanticInfo(expected: ExpectedIssue) { - val infos = this.filter { it.severity == Severity.INFO } - if (infos.none { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveNoSemanticInfo(expected: ExpectedIssue) { - val infos = this.filter { it.severity == Severity.INFO } - if (infos.any { expected.matches(it) }) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.shouldHaveNoIssue(expected: ExpectedIssue) { - if (this.isNotEmpty()) { - throw AssertionError("Expected $expected but got${this.stringify()}") - } -} - -fun List.stringify(): String { - if (this.isEmpty()) { - return " nothing." - } - - return this.joinToString(prefix = ":\n", separator = "\n") { " * $it" } -} - -class ExpectedIssue( - val severity: String, - val message: String, - val messageIsRegex: Boolean, - private val range: XtextRange? -) { - - fun matches(issue: Issue): Boolean { - return locationMatches(issue) && messageMatches(issue) - } - - private fun locationMatches(issue: Issue): Boolean { - return range == null || range == issue.range - } - - private fun messageMatches(issue: Issue): Boolean { - return when { - message.isBlank() -> true - !messageIsRegex -> message == issue.message - else -> { - val regex = Regex(message) - regex.matches(issue.message) - } - } - } - - private val Issue.range: XtextRange - get() = XtextRange.fromInts( - this.lineNumber, - this.column, - this.lineNumberEnd, - this.columnEnd, - this.length - ) - - override fun toString() = buildString { - append(severity) - if (messageIsRegex || message.isNotBlank()) { - append(" ") - } - if (messageIsRegex) { - append("r") - } - if (message.isNotBlank()) { - append("\"$message\"") - } - range?.let { append(" at $range") } - } -} diff --git a/DSL/gradle.properties b/DSL/gradle.properties deleted file mode 100644 index da6ddc4f7..000000000 --- a/DSL/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -org.gradle.caching = true \ No newline at end of file diff --git a/DSL/gradle/wrapper/gradle-wrapper.jar b/DSL/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 5c2d1cf01..000000000 Binary files a/DSL/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/DSL/gradle/wrapper/gradle-wrapper.properties b/DSL/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index aa991fcea..000000000 --- a/DSL/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/DSL/gradlew b/DSL/gradlew deleted file mode 100755 index 83f2acfdc..000000000 --- a/DSL/gradlew +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/DSL/gradlew.bat b/DSL/gradlew.bat deleted file mode 100644 index 9618d8d96..000000000 --- a/DSL/gradlew.bat +++ /dev/null @@ -1,100 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/DSL-langium/langium-config.json b/DSL/langium-config.json similarity index 79% rename from DSL-langium/langium-config.json rename to DSL/langium-config.json index 6ded9333a..b937942ef 100644 --- a/DSL-langium/langium-config.json +++ b/DSL/langium-config.json @@ -4,7 +4,7 @@ { "id": "safe-ds", "grammar": "src/language-server/grammar/safe-ds.langium", - "fileExtensions": [".sdspipe", ".sdsschema", ".sdsstub", ".sdstest"], + "fileExtensions": [".sdspipe", ".sdsstub", ".sdstest"], "textMate": { "out": "syntaxes/safe-ds.tmLanguage.json" } diff --git a/DSL-langium/langium-quickstart.md b/DSL/langium-quickstart.md similarity index 100% rename from DSL-langium/langium-quickstart.md rename to DSL/langium-quickstart.md diff --git a/DSL/langium/SafeDS-types.langium b/DSL/langium/SafeDS-types.langium deleted file mode 100644 index 3814ca862..000000000 --- a/DSL/langium/SafeDS-types.langium +++ /dev/null @@ -1,428 +0,0 @@ - -interface SdsCompilationUnit extends SdsAbstractDeclaration { - imports: SdsImport[] - members: SdsAbstractAnnotatedObject[] -} - -interface SdsAbstractDeclaration extends SdsAbstractAnnotatedObject { - annotationCallList?: SdsAnnotationCallList - name?: string -} - -interface SdsAbstractAnnotatedObject extends SdsAbstractObject { - annotationCalls: SdsAnnotationCall[] -} - -interface SdsAbstractObject { -} - -interface SdsAnnotationCall extends SdsAbstractCall { - annotation?: @SdsAnnotation -} - -interface SdsAbstractCall extends SdsAbstractObject { - argumentList?: SdsArgumentList -} - -interface SdsArgumentList extends SdsAbstractObject { - arguments: SdsArgument[] -} - -interface SdsArgument extends SdsAbstractExpression { - parameter?: @SdsParameter - value?: SdsAbstractExpression -} - -interface SdsAbstractExpression extends SdsAbstractObject { -} - -interface SdsParameter extends SdsAbstractLocalVariable { - defaultValue?: SdsAbstractExpression - ^type?: SdsAbstractType - variadic: boolean -} - -interface SdsAbstractLocalVariable extends SdsAbstractDeclaration { -} - -interface SdsAbstractType extends SdsAbstractObject { -} - -interface SdsAnnotation extends SdsAbstractCallable, SdsAbstractCompilationUnitMember { - constraint?: SdsConstraint -} - -interface SdsAbstractCallable extends SdsAbstractObject { - parameterList?: SdsParameterList -} - -interface SdsParameterList extends SdsAbstractObject { - parameters: SdsParameter[] -} - -interface SdsAbstractCompilationUnitMember extends SdsAbstractDeclaration { -} - -interface SdsConstraint extends SdsAbstractObject { - body?: SdsBlock -} - -interface SdsBlock extends SdsAbstractObject { - statements: SdsAbstractStatement[] -} - -interface SdsAbstractStatement extends SdsAbstractObject { -} - -interface SdsAnnotationCallList extends SdsAbstractAnnotatedObject { -} - -interface SdsImport extends SdsAbstractObject { - importedNamespace?: string - alias?: SdsImportAlias -} - -interface SdsImportAlias extends SdsAbstractObject { - name?: string -} - -interface SdsClass extends SdsAbstractCallable, SdsAbstractClassMember, SdsAbstractCompilationUnitMember, SdsAbstractNamedTypeDeclaration { - typeParameterList?: SdsTypeParameterList - parentTypeList?: SdsParentTypeList - body?: SdsClassBody -} - -interface SdsAbstractClassMember extends SdsAbstractDeclaration { -} - -interface SdsAbstractNamedTypeDeclaration extends SdsAbstractDeclaration { -} - -interface SdsTypeParameterList extends SdsAbstractObject { - typeParameters: SdsTypeParameter[] -} - -interface SdsTypeParameter extends SdsAbstractNamedTypeDeclaration { - variance?: string - kind?: string -} - -interface SdsParentTypeList extends SdsAbstractObject { - parentTypes: SdsAbstractType[] -} - -interface SdsClassBody extends SdsAbstractObject { - members: SdsAbstractObject[] -} - -interface SdsEnum extends SdsAbstractNamedTypeDeclaration, SdsAbstractClassMember, SdsAbstractCompilationUnitMember { - body?: SdsEnumBody -} - -interface SdsEnumBody extends SdsAbstractObject { - variants: SdsEnumVariant[] -} - -interface SdsEnumVariant extends SdsAbstractCallable, SdsAbstractNamedTypeDeclaration { - typeParameterList?: SdsTypeParameterList - constraint?: SdsConstraint -} - -interface SdsFunction extends SdsAbstractCallable, SdsAbstractClassMember, SdsAbstractCompilationUnitMember, SdsAbstractProtocolToken { - static: boolean - typeParameterList?: SdsTypeParameterList - resultList?: SdsResultList - body?: SdsFunctionBody -} - -interface SdsAbstractProtocolToken extends SdsAbstractDeclaration { -} - -interface SdsResultList extends SdsAbstractObject { - results: SdsResult[] -} - -interface SdsResult extends SdsAbstractResult { - ^type?: SdsAbstractType -} - -interface SdsAbstractResult extends SdsAbstractDeclaration { -} - -interface SdsFunctionBody extends SdsAbstractObject { - statements: SdsAbstractObject[] -} - -interface SdsPredicate extends SdsAbstractCompilationUnitMember, SdsAbstractCallable { - typeParameterList?: SdsTypeParameterList - resultList?: SdsResultList - body?: SdsBlock -} - -interface SdsSchema extends SdsAbstractCompilationUnitMember { - columnList?: SdsColumnList -} - -interface SdsColumnList extends SdsAbstractObject { - columns: SdsColumn[] -} - -interface SdsColumn extends SdsAbstractObject { - columnName?: SdsString - columnType?: SdsAbstractType -} - -interface SdsString extends SdsAbstractLiteral { - value?: string -} - -interface SdsAbstractLiteral extends SdsAbstractExpression { -} - -interface SdsPipeline extends SdsAbstractCompilationUnitMember { - body?: SdsBlock -} - -interface SdsStep extends SdsAbstractCallable, SdsAbstractCompilationUnitMember { - visibility?: string - resultList?: SdsResultList - body?: SdsBlock -} - -interface SdsMemberType extends SdsAbstractType { - member?: SdsNamedType - receiver?: SdsAbstractType -} - -interface SdsNamedType extends SdsAbstractType { - declaration?: @SdsAbstractNamedTypeDeclaration - nullable: boolean - typeArgumentList?: SdsTypeArgumentList -} - -interface SdsTypeArgumentList extends SdsAbstractObject { - typeArguments: SdsTypeArgument[] -} - -interface SdsTypeArgument extends SdsAbstractObject { - typeParameter?: @SdsTypeParameter - value?: SdsAbstractTypeArgumentValue -} - -interface SdsAbstractTypeArgumentValue extends SdsAbstractObject { -} - -interface SdsParenthesizedType extends SdsAbstractType { - ^type?: SdsAbstractType -} - -interface SdsAttribute extends SdsAbstractClassMember, SdsAbstractProtocolToken { - static: boolean - ^type?: SdsAbstractType -} - -interface SdsProtocol extends SdsAbstractObject { - body?: SdsProtocolBody -} - -interface SdsProtocolBody extends SdsAbstractObject { - subtermList?: SdsProtocolSubtermList - term?: SdsAbstractProtocolTerm -} - -interface SdsProtocolSubtermList extends SdsAbstractObject { - subterms: SdsProtocolSubterm[] -} - -interface SdsProtocolSubterm extends SdsAbstractProtocolToken { - term?: SdsAbstractProtocolTerm -} - -interface SdsAbstractProtocolTerm extends SdsAbstractObject { -} - -interface SdsProtocolAlternative extends SdsAbstractProtocolTerm { - terms: SdsAbstractProtocolTerm[] -} - -interface SdsProtocolSequence extends SdsAbstractProtocolTerm { - terms: SdsAbstractProtocolTerm[] -} - -interface SdsProtocolQuantifiedTerm extends SdsAbstractProtocolTerm { - term?: SdsAbstractProtocolTerm - quantifier?: string -} - -interface SdsProtocolComplement extends SdsAbstractProtocolTerm { - universe?: SdsProtocolTokenClass - referenceList?: SdsProtocolReferenceList -} - -interface SdsProtocolTokenClass extends SdsAbstractProtocolTerm { - value?: string -} - -interface SdsProtocolReferenceList extends SdsAbstractProtocolTerm { - references: SdsProtocolReference[] -} - -interface SdsProtocolReference extends SdsAbstractProtocolTerm { - token?: @SdsAbstractProtocolToken -} - -interface SdsProtocolParenthesizedTerm extends SdsAbstractProtocolTerm { - term?: SdsAbstractProtocolTerm -} - -interface SdsLambdaParameterList extends SdsAbstractExpression, SdsParameterList { -} - -interface SdsAssignment extends SdsAbstractStatement { - assigneeList?: SdsAssigneeList - expression?: SdsAbstractExpression -} - -interface SdsAssigneeList extends SdsAbstractObject { - assignees: SdsAbstractAssignee[] -} - -interface SdsAbstractAssignee extends SdsAbstractObject { -} - -interface SdsPlaceholder extends SdsAbstractAssignee, SdsAbstractLocalVariable { -} - -interface SdsWildcard extends SdsAbstractAssignee { -} - -interface SdsYield extends SdsAbstractAssignee { - result?: @SdsResult -} - -interface SdsExpressionStatement extends SdsAbstractStatement { - expression?: SdsAbstractExpression -} - -interface SdsSchemaPlaceholder extends SdsAbstractAssignee, SdsAbstractNamedTypeDeclaration { -} - -interface SdsSchemaYield extends SdsAbstractAssignee { - ^type?: SdsSchemaType -} - -interface SdsSchemaType extends SdsAbstractType { - declaration?: @SdsAbstractNamedTypeDeclaration -} - -interface SdsBlockLambda extends SdsAbstractLambda { - body?: SdsBlock -} - -interface SdsAbstractLambda extends SdsAbstractCallable, SdsAbstractExpression { -} - -interface SdsExpressionLambda extends SdsAbstractLambda { - result?: SdsAbstractExpression -} - -interface SdsBlockLambdaResult extends SdsAbstractAssignee, SdsAbstractResult { -} - -interface SdsInfixOperation extends SdsAbstractExpression { - leftOperand?: SdsAbstractExpression - operator?: string - rightOperand?: SdsAbstractExpression -} - -interface SdsPrefixOperation extends SdsAbstractExpression { - operand?: SdsAbstractExpression - operator?: string -} - -interface SdsCall extends SdsAbstractCall, SdsAbstractChainedExpression { - typeArgumentList?: SdsTypeArgumentList -} - -interface SdsAbstractChainedExpression extends SdsAbstractExpression { - receiver?: SdsAbstractExpression -} - -interface SdsIndexedAccess extends SdsAbstractChainedExpression { - index?: SdsAbstractExpression -} - -interface SdsMemberAccess extends SdsAbstractChainedExpression { - member?: SdsReference - nullSafe: boolean -} - -interface SdsReference extends SdsAbstractExpression { - declaration?: @SdsAbstractDeclaration -} - -interface SdsSchemaReference extends SdsAbstractExpression { - ^type?: SdsSchemaType -} - -interface SdsBoolean extends SdsAbstractLiteral { - true: boolean -} - -interface SdsFloat extends SdsAbstractNumber { - value?: number -} - -interface SdsAbstractNumber extends SdsAbstractLiteral { -} - -interface SdsInt extends SdsAbstractNumber { - value?: number -} - -interface SdsNull extends SdsAbstractLiteral { -} - -interface SdsParenthesizedExpression extends SdsAbstractExpression { - expression?: SdsAbstractExpression -} - -interface SdsTemplateString extends SdsAbstractExpression { - expressions: SdsAbstractExpression[] -} - -interface SdsTemplateStringStart extends SdsAbstractTemplateStringPart { -} - -interface SdsAbstractTemplateStringPart extends SdsAbstractLiteral { - value?: string -} - -interface SdsTemplateStringInner extends SdsAbstractTemplateStringPart { -} - -interface SdsTemplateStringEnd extends SdsAbstractTemplateStringPart { -} - -interface SdsCallableType extends SdsAbstractCallable, SdsAbstractType { - resultList?: SdsResultList -} - -interface SdsUnionType extends SdsAbstractType { - typeArgumentList?: SdsTypeArgumentList -} - -interface SdsTypeProjection extends SdsAbstractTypeArgumentValue { - ^type?: SdsAbstractType - variance?: string -} - -interface SdsTypeParameterConstraint extends SdsAbstractStatement { - leftOperand?: @SdsTypeParameter - operator?: string - rightOperand?: SdsAbstractType -} - -interface SdsStarProjection extends SdsAbstractTypeArgumentValue { -} - diff --git a/DSL/langium/SafeDS.langium b/DSL/langium/SafeDS.langium deleted file mode 100644 index ea9c11b46..000000000 --- a/DSL/langium/SafeDS.langium +++ /dev/null @@ -1,493 +0,0 @@ -grammar SafeDS -import 'SafeDS-types' - -entry SdsCompilationUnit returns SdsCompilationUnit: - {SdsCompilationUnit} annotationCalls+=SdsAnnotationCall * ('package' name=QualifiedName )? imports+=SdsImport * members+=SdsCompilationUnitMember * -; - -SdsCompilationUnitMember returns SdsAbstractAnnotatedObject: - {SdsAnnotationCallList} annotationCalls+=SdsAnnotationCall * ({SdsAnnotation.annotationCallList=current} 'annotation' name=ID parameterList=SdsParameterList ? constraint=SdsConstraint ? | {SdsClass.annotationCallList=current} 'class' name=ID typeParameterList=SdsTypeParameterList ? parameterList=SdsParameterList ? parentTypeList=SdsParentTypeList ? body=SdsClassBody ? | {SdsEnum.annotationCallList=current} 'enum' name=ID body=SdsEnumBody ? | {SdsFunction.annotationCallList=current} 'fun' name=ID typeParameterList=SdsTypeParameterList ? parameterList=SdsParameterList resultList=SdsResultList ? body=SdsFunctionBody ? | {SdsPredicate.annotationCallList=current} 'predicate' name=ID typeParameterList=SdsTypeParameterList ? parameterList=SdsPredicateParameterList resultList=SdsPredicateResultList ? body=SdsPredicateBlock | {SdsPredicate.annotationCallList=current} 'abstract' 'predicate' name=ID typeParameterList=SdsTypeParameterList ? parameterList=SdsPredicateParameterList resultList=SdsPredicateResultList ? | {SdsSchema.annotationCallList=current} 'schema' name=ID columnList=SdsColumnList | {SdsPipeline.annotationCallList=current} 'pipeline' name=ID body=SdsBlock | {SdsStep.annotationCallList=current} visibility=('internal' | 'private' )? 'step' name=ID parameterList=SdsParameterList resultList=SdsResultList ? body=SdsBlock ) -; - -SdsImport returns SdsImport: - 'import' importedNamespace=QualifiedNameWithWildcard alias=SdsImportAlias ? -; - -SdsImportAlias returns SdsImportAlias: - 'as' name=ID -; - -SdsAnnotationCall returns SdsAnnotationCall: - '@' annotation=[SdsAnnotation:ID ] argumentList=SdsAnnotationCallArgumentList ? -; - -SdsAnnotationCallArgumentList returns SdsArgumentList: - {SdsArgumentList} '(' (arguments+=SdsAnnotationCallArgument (',' arguments+=SdsAnnotationCallArgument )* ','? )? ')' -; - -SdsAnnotationCallArgument returns SdsArgument: - (parameter=[SdsParameter:ID ] '=' )? value=SdsExpression -; - -SdsParentTypeList returns SdsParentTypeList: - 'sub' parentTypes+=SdsParentType (',' parentTypes+=SdsParentType )* ','? -; - -SdsParentType returns SdsAbstractType: - SdsParentPrimaryType {SdsMemberType.receiver=current} '.' member=SdsNamedType * -; - -SdsParentPrimaryType returns SdsAbstractType: - SdsNamedType | SdsParentParenthesizedType -; - -SdsParentParenthesizedType returns SdsParenthesizedType: - '(' ^type=SdsParentType ')' -; - -SdsClassBody returns SdsClassBody: - {SdsClassBody} '{' members+=SdsClassMember * '}' -; - -SdsClassMember returns SdsAbstractObject: - SdsAnnotatedClassMember | SdsProtocol | SdsConstraint -; - -SdsAnnotatedClassMember returns SdsAbstractAnnotatedObject: - {SdsAnnotationCallList} annotationCalls+=SdsAnnotationCall * ({SdsAttribute.annotationCallList=current} static?='static' ? 'attr' name=ID (':' ^type=SdsType )? | {SdsClass.annotationCallList=current} 'class' name=ID typeParameterList=SdsTypeParameterList ? parameterList=SdsParameterList ? parentTypeList=SdsParentTypeList ? body=SdsClassBody ? | {SdsEnum.annotationCallList=current} 'enum' name=ID body=SdsEnumBody ? | {SdsFunction.annotationCallList=current} static?='static' ? 'fun' name=ID typeParameterList=SdsTypeParameterList ? parameterList=SdsParameterList resultList=SdsResultList ? body=SdsFunctionBody ? ) -; - -SdsConstraint returns SdsConstraint: - 'constraint' body=SdsConstraintBlock -; - -SdsProtocol returns SdsProtocol: - 'protocol' body=SdsProtocolBody -; - -SdsProtocolBody returns SdsProtocolBody: - {SdsProtocolBody} '{' subtermList=SdsProtocolSubtermList ? term=SdsProtocolTerm ? '}' -; - -SdsProtocolSubtermList returns SdsProtocolSubtermList: - subterms+=SdsProtocolSubterm + -; - -SdsProtocolSubterm returns SdsProtocolSubterm: - 'subterm' name=ID '=' term=SdsProtocolTerm ';' -; - -SdsProtocolTerm returns SdsAbstractProtocolTerm: - SdsProtocolAlternative -; - -SdsProtocolAlternative returns SdsAbstractProtocolTerm: - SdsProtocolSequence ({SdsProtocolAlternative.terms+=current} '|' terms+=SdsProtocolSequence ('|' terms+=SdsProtocolSequence )* )? -; - -SdsProtocolSequence returns SdsAbstractProtocolTerm: - SdsProtocolQuantifiedTerm ({SdsProtocolSequence.terms+=current} terms+=SdsProtocolQuantifiedTerm (terms+=SdsProtocolQuantifiedTerm )* )? -; - -SdsProtocolQuantifiedTerm returns SdsAbstractProtocolTerm: - SdsProtocolPrimaryElement ({SdsProtocolQuantifiedTerm.term=current} quantifier=SdsProtocolQuantifier )? -; - -SdsProtocolQuantifier returns string: - '?' | '*' | '+' -; - -SdsProtocolPrimaryElement returns SdsAbstractProtocolTerm: - SdsProtocolComplement | SdsProtocolReference | SdsProtocolTokenClass | SdsProtocolParenthesizedTerm -; - -SdsProtocolComplement returns SdsProtocolComplement: - {SdsProtocolComplement} '[' universe=SdsProtocolTokenClass ? '^' referenceList=SdsProtocolReferenceList ? ']' -; - -SdsProtocolReferenceList returns SdsProtocolReferenceList: - references+=SdsProtocolReference + -; - -SdsProtocolReference returns SdsProtocolReference: - token=[SdsAbstractProtocolToken:ID ] -; - -SdsProtocolTokenClass returns SdsProtocolTokenClass: - value=SdsProtocolTokenClassValue -; - -SdsProtocolTokenClassValue returns string: - '.' | '\\a' | '\\f' -; - -SdsProtocolParenthesizedTerm returns SdsProtocolParenthesizedTerm: - '(' term=SdsProtocolTerm ')' -; - -SdsEnumBody returns SdsEnumBody: - {SdsEnumBody} '{' variants+=SdsEnumVariant * '}' -; - -SdsEnumVariant returns SdsEnumVariant: - annotationCalls+=SdsAnnotationCall * name=ID typeParameterList=SdsTypeParameterList ? parameterList=SdsParameterList ? constraint=SdsConstraint ? -; - -SdsParameterList returns SdsParameterList: - {SdsParameterList} '(' (parameters+=SdsParameter (',' parameters+=SdsParameter )* ','? )? ')' -; - -SdsLambdaParameterList returns SdsLambdaParameterList: - {SdsLambdaParameterList} '(' (parameters+=SdsParameter (',' parameters+=SdsParameter )* ','? )? ')' -; - -SdsParameter returns SdsParameter: - annotationCalls+=SdsAnnotationCall * variadic?='vararg' ? name=ID (':' ^type=SdsType )? ('=' defaultValue=SdsExpression )? -; - -SdsPredicateParameterList returns SdsParameterList: - {SdsParameterList} '(' (parameters+=SdsPredicateParameter (',' parameters+=SdsPredicateParameter )* ','? )? ')' -; - -SdsPredicateParameter returns SdsParameter: - annotationCalls+=SdsAnnotationCall * (variadic?='vararg' ? name=ID (':' ^type=SdsType )? ('=' defaultValue=SdsExpression )? | ^type=SdsSchemaType ) -; - -SdsResultList returns SdsResultList: - {SdsResultList} '->' results+=SdsResult | {SdsResultList} '->' '(' (results+=SdsResult (',' results+=SdsResult )* ','? )? ')' -; - -SdsResult returns SdsResult: - annotationCalls+=SdsAnnotationCall * name=ID (':' ^type=SdsType )? -; - -SdsPredicateResultList returns SdsResultList: - {SdsResultList} '->' results+=SdsPredicateResult -; - -SdsPredicateResult returns SdsResult: - annotationCalls+=SdsAnnotationCall * ^type=SdsSchemaType -; - -SdsFunctionBody returns SdsFunctionBody: - {SdsFunctionBody} '{' statements+=SdsFunctionStatement * '}' -; - -SdsFunctionStatement returns SdsAbstractObject: - SdsConstraint -; - -SdsBlock returns SdsBlock: - {SdsBlock} '{' statements+=SdsStatement * '}' -; - -SdsStatement returns SdsAbstractStatement: - SdsAssignment | SdsExpressionStatement -; - -SdsAssignment returns SdsAssignment: - assigneeList=SdsAssigneeList '=' expression=SdsExpression ';' -; - -SdsAssigneeList returns SdsAssigneeList: - assignees+=SdsAssignee (',' assignees+=SdsAssignee )* ','? -; - -SdsAssignee returns SdsAbstractAssignee: - {SdsPlaceholder} 'val' name=ID | {SdsWildcard} '_' | {SdsYield} 'yield' result=[SdsResult:ID ] -; - -SdsExpressionStatement returns SdsExpressionStatement: - expression=SdsExpression ';' -; - -SdsConstraintBlock returns SdsBlock: - {SdsBlock} '{' (statements+=SdsConstraintStatement (',' statements+=SdsConstraintStatement )* )? '}' -; - -SdsConstraintStatement returns SdsAbstractStatement: - SdsPredicateAssignment | SdsPredicateExpressionStatement | SdsTypeParameterConstraint -; - -SdsPredicateBlock returns SdsBlock: - {SdsBlock} '{' (statements+=SdsPredicateStatement (',' statements+=SdsPredicateStatement )* )? '}' -; - -SdsPredicateStatement returns SdsAbstractStatement: - SdsPredicateAssignment | SdsPredicateExpressionStatement -; - -SdsPredicateAssignment returns SdsAssignment: - assigneeList=SdsPredicateAssigneeList '=' expression=SdsExpression -; - -SdsPredicateAssigneeList returns SdsAssigneeList: - assignees+=SdsPredicateAssignee (',' assignees+=SdsPredicateAssignee )* ','? -; - -SdsPredicateAssignee returns SdsAbstractAssignee: - {SdsPlaceholder} 'val' name=ID | {SdsWildcard} '_' | {SdsSchemaPlaceholder} 'val' '::' name=ID | {SdsSchemaYield} 'yield' ^type=SdsSchemaType -; - -SdsPredicateExpressionStatement returns SdsExpressionStatement: - expression=SdsExpression -; - -SdsExpression returns SdsAbstractExpression: - SdsLambda | SdsOrExpression -; - -SdsLambda returns SdsAbstractExpression: - SdsLambdaParameterList ({SdsBlockLambda.parameterList=current} body=SdsBlockLambdaBlock | {SdsExpressionLambda.parameterList=current} '->' result=SdsExpression ) -; - -SdsBlockLambdaBlock returns SdsBlock: - {SdsBlock} '{' statements+=SdsBlockLambdaStatement * '}' -; - -SdsBlockLambdaStatement returns SdsAbstractStatement: - SdsBlockLambdaAssignment | SdsExpressionStatement -; - -SdsBlockLambdaAssignment returns SdsAssignment: - assigneeList=SdsBlockLambdaAssigneeList '=' expression=SdsExpression ';' -; - -SdsBlockLambdaAssigneeList returns SdsAssigneeList: - assignees+=SdsBlockLambdaAssignee (',' assignees+=SdsBlockLambdaAssignee )* ','? -; - -SdsBlockLambdaAssignee returns SdsAbstractAssignee: - {SdsWildcard} '_' | {SdsPlaceholder} 'val' name=ID | {SdsBlockLambdaResult} 'yield' name=ID -; - -SdsOrExpression returns SdsAbstractExpression: - SdsAndExpression ({SdsInfixOperation.leftOperand=current} operator='or' rightOperand=SdsAndExpression )* -; - -SdsAndExpression returns SdsAbstractExpression: - SdsNotExpression ({SdsInfixOperation.leftOperand=current} operator='and' rightOperand=SdsNotExpression )* -; - -SdsNotExpression returns SdsAbstractExpression: - {SdsPrefixOperation} operator='not' operand=SdsNotExpression | SdsEqualityExpression -; - -SdsEqualityExpression returns SdsAbstractExpression: - SdsComparisonExpression ({SdsInfixOperation.leftOperand=current} operator=SdsEqualityOperator rightOperand=SdsComparisonExpression )? -; - -SdsEqualityOperator returns string: - '==' | '!=' | '===' | '!==' -; - -SdsComparisonExpression returns SdsAbstractExpression: - SdsAdditiveExpression ({SdsInfixOperation.leftOperand=current} operator=SdsComparisonOperator rightOperand=SdsAdditiveExpression )? -; - -SdsComparisonOperator returns string: - '<' | '<=' | '>=' | '>' -; - -SdsAdditiveExpression returns SdsAbstractExpression: - SdsMultiplicativeExpression ({SdsInfixOperation.leftOperand=current} operator=SdsAdditiveOperator rightOperand=SdsMultiplicativeExpression )* -; - -SdsAdditiveOperator returns string: - '+' | '-' -; - -SdsMultiplicativeExpression returns SdsAbstractExpression: - SdsElvisExpression ({SdsInfixOperation.leftOperand=current} operator=SdsMultiplicativeOperator rightOperand=SdsElvisExpression )* -; - -SdsMultiplicativeOperator returns string: - '*' | '/' -; - -SdsElvisExpression returns SdsAbstractExpression: - SdsUnaryOperation ({SdsInfixOperation.leftOperand=current} operator='?:' rightOperand=SdsUnaryOperation )* -; - -SdsUnaryOperation returns SdsAbstractExpression: - {SdsPrefixOperation} operator='-' operand=SdsUnaryOperation | SdsChainedExpression -; - -SdsChainedExpression returns SdsAbstractExpression: - SdsPrimaryExpression {SdsCall.receiver=current} typeArgumentList=SdsTypeArgumentList ? argumentList=SdsCallArgumentList | {SdsIndexedAccess.receiver=current} '[' index=SdsExpression ']' | {SdsMemberAccess.receiver=current} (nullSafe?='?' )? '.' member=SdsReference * -; - -SdsCallArgumentList returns SdsArgumentList: - {SdsArgumentList} '(' (arguments+=SdsCallArgument (',' arguments+=SdsCallArgument )* ','? )? ')' -; - -SdsCallArgument returns SdsArgument: - (parameter=[SdsParameter:ID ] '=' )? value=SdsExpression -; - -SdsPrimaryExpression returns SdsAbstractExpression: - SdsLiteral | SdsParenthesizedExpression | SdsReference | SdsTemplateString | {SdsSchemaReference} ^type=SdsSchemaType -; - -SdsLiteral returns SdsAbstractLiteral: - SdsBoolean | SdsFloat | SdsInt | SdsNull | SdsString -; - -SdsBoolean returns SdsBoolean: - true?='true' | {SdsBoolean} 'false' -; - -SdsFloat returns SdsFloat: - value=FLOAT -; - -SdsInt returns SdsInt: - value=INT -; - -SdsNull returns SdsNull: - {SdsNull} 'null' -; - -SdsString returns SdsString: - value=STRING -; - -SdsReference returns SdsReference: - declaration=[SdsAbstractDeclaration:ID ] -; - -SdsParenthesizedExpression returns SdsParenthesizedExpression: - '(' expression=SdsExpression ')' -; - -SdsTemplateString returns SdsTemplateString: - expressions+=SdsTemplateStringStart expressions+=SdsExpression ? (expressions+=SdsTemplateStringInner expressions+=SdsExpression ? )* expressions+=SdsTemplateStringEnd -; - -SdsTemplateStringStart returns SdsTemplateStringStart: - value=TEMPLATE_STRING_START -; - -SdsTemplateStringInner returns SdsTemplateStringInner: - value=TEMPLATE_STRING_INNER -; - -SdsTemplateStringEnd returns SdsTemplateStringEnd: - value=TEMPLATE_STRING_END -; - -SdsColumnList returns SdsColumnList: - {SdsColumnList} '{' (columns+=SdsColumn (',' columns+=SdsColumn )* ','? )? '}' -; - -SdsColumn returns SdsColumn: - columnName=SdsString ":" columnType=SdsType -; - -QualifiedName returns string: - ID ('.' ID )* -; - -QualifiedNameWithWildcard returns string: - QualifiedName ('.' '*' )? -; - -SdsType returns SdsAbstractType: - SdsPrimaryType {SdsMemberType.receiver=current} '.' member=SdsNamedType * -; - -SdsPrimaryType returns SdsAbstractType: - SdsCallableType | SdsNamedType | SdsUnionType | SdsParenthesizedType -; - -SdsParenthesizedType returns SdsParenthesizedType: - '(' ^type=SdsType ')' -; - -SdsCallableType returns SdsCallableType: - parameterList=SdsParameterList resultList=SdsResultList -; - -SdsNamedType returns SdsNamedType: - declaration=[SdsAbstractNamedTypeDeclaration:ID ] typeArgumentList=SdsTypeArgumentList ? (nullable?='?' )? -; - -SdsSchemaType returns SdsSchemaType: - '::' declaration=[SdsAbstractNamedTypeDeclaration:ID ] -; - -SdsUnionType returns SdsUnionType: - 'union' typeArgumentList=SdsUnionTypeArgumentList -; - -SdsUnionTypeArgumentList returns SdsTypeArgumentList: - {SdsTypeArgumentList} ('<' (typeArguments+=SdsUnionTypeArgument (',' typeArguments+=SdsUnionTypeArgument )* ','? )? '>' ) -; - -SdsUnionTypeArgument returns SdsTypeArgument: - value=SdsUnionTypeArgumentValue -; - -SdsUnionTypeArgumentValue returns SdsAbstractTypeArgumentValue: - {SdsTypeProjection} ^type=SdsType -; - -SdsTypeParameterList returns SdsTypeParameterList: - {SdsTypeParameterList} ('<' (typeParameters+=SdsTypeParameter (',' typeParameters+=SdsTypeParameter )* ','? )? '>' ) -; - -SdsTypeParameter returns SdsTypeParameter: - annotationCalls+=SdsAnnotationCall * variance=SdsTypeParameterVariance ? name=ID ('::' kind=SdsTypeParameterKind )? -; - -SdsTypeParameterVariance returns string: - 'in' | 'out' -; - -SdsTypeParameterKind returns string: - '$SchemaType' | '$ExpressionType' | '$IntType' | '$FloatType' | '$BooleanType' | '$StringType' | '$NamedType' -; - -SdsTypeParameterConstraint returns SdsTypeParameterConstraint: - leftOperand=[SdsTypeParameter:ID ] operator=SdsTypeParameterConstraintOperator rightOperand=SdsType -; - -SdsTypeParameterConstraintOperator returns string: - 'sub' | 'super' -; - -SdsTypeArgumentList returns SdsTypeArgumentList: - {SdsTypeArgumentList} '<' (typeArguments+=SdsTypeArgument (',' typeArguments+=SdsTypeArgument )* ','? )? '>' -; - -SdsTypeArgument returns SdsTypeArgument: - (typeParameter=[SdsTypeParameter:ID ] '=' )? value=SdsTypeArgumentValue -; - -SdsTypeArgumentValue returns SdsAbstractTypeArgumentValue: - {SdsStarProjection} '*' | {SdsTypeProjection} variance=SdsTypeParameterVariance ? ^type=SdsType -; - -terminal FLOAT returns number:DECIMAL_DIGIT+ '.' DECIMAL_DIGIT+ FLOAT_EXPONENT? | DECIMAL_DIGIT+ FLOAT_EXPONENT ; -terminal DECIMAL_DIGIT returns string:'0' ..'9' ; -terminal FLOAT_EXPONENT returns string:('e' | 'E' )('+' | '-' )?DECIMAL_DIGIT+ ; -terminal ID returns string:IDENTIFIER | '`' IDENTIFIER '`' ; -terminal IDENTIFIER returns string:('a' ..'z' | 'A' ..'Z' | '_' )('a' ..'z' | 'A' ..'Z' | '_' | '0' ..'9' )* | SCHEMA_EFFECT ; -terminal SCHEMA_EFFECT returns string:'$readSchema' | '$checkColumn' | '$removeColumn' | '$keepColumn' | '$renameColumn' | '$addColumn' | '$changeColumnType' ; -terminal INT returns number:DECIMAL_DIGIT+ ; -hidden terminal ML_COMMENT returns string:'/*' -> '*/' ; -hidden terminal SL_COMMENT returns string:'//' !('\r' | '\n' )('\r'? '\n' )? ; -terminal STRING returns string:STRING_START STRING_TEXT* STRING_END ; -terminal STRING_START returns string:STRING_DELIMITER ; -terminal STRING_END returns string:'{'? STRING_DELIMITER ; -terminal STRING_DELIMITER returns string:'"' ; -terminal STRING_TEXT returns string:'{'? ESCAPE_SEQUENCE | '{'? !('\\' | STRING_DELIMITER | '{' ) ; -terminal ESCAPE_SEQUENCE returns string:'\\' . ; -terminal TEMPLATE_EXPRESSION_START returns string:'{{' ; -terminal TEMPLATE_EXPRESSION_END returns string:'}}' ; -terminal TEMPLATE_STRING_START returns string:STRING_START STRING_TEXT* TEMPLATE_EXPRESSION_START ; -terminal TEMPLATE_STRING_INNER returns string:TEMPLATE_EXPRESSION_END STRING_TEXT* TEMPLATE_EXPRESSION_START ; -terminal TEMPLATE_STRING_END returns string:TEMPLATE_EXPRESSION_END STRING_TEXT* STRING_END ; -hidden terminal TEST_MARKER returns string:'»' | '«' ; -hidden terminal WS returns string:(' ' | '\t' | '\r' | '\n' )+; diff --git a/DSL/language-configuration.json b/DSL/language-configuration.json new file mode 100644 index 000000000..92d75bae8 --- /dev/null +++ b/DSL/language-configuration.json @@ -0,0 +1,29 @@ +{ + "comments": { + "lineComment": "//", + "blockComment": ["/*", "*/"] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["»", "«"] + ], + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["»", "«"], + ["\"", "\""], + ["`", "`"] + ], + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["<", ">"], + ["»", "«"], + ["\"", "\""], + ["`", "`"] + ] +} diff --git a/DSL/package-lock.json b/DSL/package-lock.json new file mode 100644 index 000000000..0fc1b7d8b --- /dev/null +++ b/DSL/package-lock.json @@ -0,0 +1,4165 @@ +{ + "name": "safe-ds", + "version": "0.1.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "safe-ds", + "version": "0.1.0", + "dependencies": { + "chalk": "^5.3.0", + "chevrotain": "^10.5.0", + "commander": "^11.0.0", + "glob": "^10.3.1", + "langium": "^1.2.1", + "radash": "^11.0.0", + "true-myth": "^6.2.0", + "vscode-languageclient": "^8.1.0", + "vscode-languageserver": "^8.1.0", + "vscode-languageserver-types": "^3.17.3", + "vscode-uri": "^3.0.7" + }, + "bin": { + "safe-ds-cli": "bin/cli" + }, + "devDependencies": { + "@types/node": "^18.16.18", + "@types/vscode": "^1.79.1", + "@vitest/coverage-v8": "^0.32.4", + "@vitest/ui": "^0.32.4", + "langium-cli": "^1.2.1", + "typescript": "^5.1.6", + "vitest": "^0.32.4" + }, + "engines": { + "vscode": "^1.79.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@chevrotain/cst-dts-gen": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.5.0.tgz", + "integrity": "sha512-lhmC/FyqQ2o7pGK4Om+hzuDrm9rhFYIJ/AXoQBeongmn870Xeb0L6oGEiuR8nohFNL5sMaQEJWCxr1oIVIVXrw==", + "dependencies": { + "@chevrotain/gast": "10.5.0", + "@chevrotain/types": "10.5.0", + "lodash": "4.17.21" + } + }, + "node_modules/@chevrotain/gast": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-10.5.0.tgz", + "integrity": "sha512-pXdMJ9XeDAbgOWKuD1Fldz4ieCs6+nLNmyVhe2gZVqoO7v8HXuHYs5OV2EzUtbuai37TlOAQHrTDvxMnvMJz3A==", + "dependencies": { + "@chevrotain/types": "10.5.0", + "lodash": "4.17.21" + } + }, + "node_modules/@chevrotain/types": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-10.5.0.tgz", + "integrity": "sha512-f1MAia0x/pAVPWH/T73BJVyO2XU5tI4/iE7cnxb7tqdNTNhQI3Uq3XkqcoteTmD4t1aM0LbHCJOhgIDn07kl2A==" + }, + "node_modules/@chevrotain/utils": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-10.5.0.tgz", + "integrity": "sha512-hBzuU5+JjB2cqNZyszkDHZgOSrUUT8V3dhgRl8Q9Gp6dAj/H5+KILGjbhDpc3Iy9qmqlm/akuOI2ut9VUtzJxQ==" + }, + "node_modules/@esbuild/android-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.0.tgz", + "integrity": "sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.21", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", + "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==", + "dev": true + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@types/chai": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", + "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", + "dev": true + }, + "node_modules/@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/node": { + "version": "18.16.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.18.tgz", + "integrity": "sha512-/aNaQZD0+iSBAGnvvN2Cx92HqE5sZCPZtx2TsK+4nvV23fFe09jVDvpArXr2j9DnYlzuU9WuoykDDc6wqvpNcw==", + "dev": true + }, + "node_modules/@types/vscode": { + "version": "1.79.1", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.79.1.tgz", + "integrity": "sha512-Ikwc4YbHABzqthrWfeAvItaAIfX9mdjMWxqNgTpGjhgOu0TMRq9LzyZ2yBK0JhYqoSjEubEPawf6zJgnl6Egtw==", + "dev": true + }, + "node_modules/@vitest/coverage-v8": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-0.32.4.tgz", + "integrity": "sha512-itiCYY3TmWEK+5wnFBoNr0ZA+adACp7Op1r2TeX5dPOgU2See7+Gx2NlK2lVMHVxfPsu5z9jszKa3i//eR+hqg==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.1", + "@bcoe/v8-coverage": "^0.2.3", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.1", + "istanbul-reports": "^3.1.5", + "magic-string": "^0.30.0", + "picocolors": "^1.0.0", + "std-env": "^3.3.3", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^9.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": ">=0.32.0 <1" + } + }, + "node_modules/@vitest/expect": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.32.4.tgz", + "integrity": "sha512-m7EPUqmGIwIeoU763N+ivkFjTzbaBn0n9evsTOcde03ugy2avPs3kZbYmw3DkcH1j5mxhMhdamJkLQ6dM1bk/A==", + "dev": true, + "dependencies": { + "@vitest/spy": "0.32.4", + "@vitest/utils": "0.32.4", + "chai": "^4.3.7" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.32.4.tgz", + "integrity": "sha512-cHOVCkiRazobgdKLnczmz2oaKK9GJOw6ZyRcaPdssO1ej+wzHVIkWiCiNacb3TTYPdzMddYkCgMjZ4r8C0JFCw==", + "dev": true, + "dependencies": { + "@vitest/utils": "0.32.4", + "p-limit": "^4.0.0", + "pathe": "^1.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.32.4.tgz", + "integrity": "sha512-IRpyqn9t14uqsFlVI2d7DFMImGMs1Q9218of40bdQQgMePwVdmix33yMNnebXcTzDU5eiV3eUsoxxH5v0x/IQA==", + "dev": true, + "dependencies": { + "magic-string": "^0.30.0", + "pathe": "^1.1.1", + "pretty-format": "^29.5.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.32.4.tgz", + "integrity": "sha512-oA7rCOqVOOpE6rEoXuCOADX7Lla1LIa4hljI2MSccbpec54q+oifhziZIJXxlE/CvI2E+ElhBHzVu0VEvJGQKQ==", + "dev": true, + "dependencies": { + "tinyspy": "^2.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/ui": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-0.32.4.tgz", + "integrity": "sha512-92y7bkjf55L08nomvHHYQkDWQEIkb36dJkgi+F/zpO5cFbrmk1pv/dYiaZKQ772uP96fAWinmux6sXNMNUh16w==", + "dev": true, + "dependencies": { + "@vitest/utils": "0.32.4", + "fast-glob": "^3.2.12", + "fflate": "^0.8.0", + "flatted": "^3.2.7", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "sirv": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": ">=0.30.1 <1" + } + }, + "node_modules/@vitest/utils": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.32.4.tgz", + "integrity": "sha512-Gwnl8dhd1uJ+HXrYyV0eRqfmk9ek1ASE/LWfTCuWMw+d07ogHqp4hEAV28NiecimK6UY9DpSEPh+pXBA5gtTBg==", + "dev": true, + "dependencies": { + "diff-sequences": "^29.4.3", + "loupe": "^2.3.6", + "pretty-format": "^29.5.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/acorn": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz", + "integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/chevrotain": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-10.5.0.tgz", + "integrity": "sha512-Pkv5rBY3+CsHOYfV5g/Vs5JY9WTHHDEKOlohI2XeygaZhUeqhAlldZ8Hz9cRmxu709bvS08YzxHdTPHhffc13A==", + "dependencies": { + "@chevrotain/cst-dts-gen": "10.5.0", + "@chevrotain/gast": "10.5.0", + "@chevrotain/types": "10.5.0", + "@chevrotain/utils": "10.5.0", + "lodash": "4.17.21", + "regexp-to-ast": "0.5.0" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/diff-sequences": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/esbuild": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" + } + }, + "node_modules/fast-glob": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", + "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fflate": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.0.tgz", + "integrity": "sha512-FAdS4qMuFjsJj6XHbBaZeXOgaypXp8iw/Tpyuq/w3XA41jjLHT8NPA+n7czH/DDhdncq0nAyDZmPeWXh2qmdIg==", + "dev": true + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/glob": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.1.tgz", + "integrity": "sha512-9BKYcEeIs7QwlCYs+Y3GBvqAMISufUS0i2ELd11zpZjxI5V9iyRj0HgzB5/cLf2NY4vcYBTYzJ7GIui7j/4DOw==", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2", + "path-scurry": "^1.10.0" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", + "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/signal-exit": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.1.tgz", + "integrity": "sha512-uUWsN4aOxJAS8KOuf3QMyFtgm1pkb6I+KRZbRF/ghdf5T7sM+B1lLLzPDxswUjkmHyxQAVzEgG35E3NzDM9GVw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jackspeak": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.1.0.tgz", + "integrity": "sha512-DiEwVPqsieUzZBNxQ2cxznmFzfg/AMgJUjYw5xl6rSmCxAQXECcbSdwcLM6Ds6T09+SBfSNCGPhYUoQ96P4h7A==", + "dependencies": { + "cliui": "^7.0.4" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonschema": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", + "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/langium": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium/-/langium-1.2.1.tgz", + "integrity": "sha512-tpUa1r47pxuUBNqX5X4GAB08qhWpVwWhxjwOV+948skElHO9OV6emngfY3jOYzchJS4H6UZwyKalsOb8GGPsnQ==", + "dependencies": { + "chevrotain": "~10.4.2", + "chevrotain-allstar": "~0.1.4", + "vscode-languageserver": "~8.0.2", + "vscode-languageserver-textdocument": "~1.0.8", + "vscode-uri": "~3.0.7" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/langium-cli": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-1.2.1.tgz", + "integrity": "sha512-sbGucMXqfDfLmF6bvFsyv7f4/y2dNivVKpXD5j//OxMrBsF+N8fATVqq8bopUvAxxvb0dmaV0xpIxYr7b7Efjg==", + "dev": true, + "dependencies": { + "chalk": "~4.1.2", + "commander": "~10.0.0", + "fs-extra": "~11.1.0", + "jsonschema": "~1.4.1", + "langium": "~1.2.0", + "lodash": "~4.17.21" + }, + "bin": { + "langium": "bin/langium.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/langium-cli/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/langium-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/langium/node_modules/@chevrotain/cst-dts-gen": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.4.2.tgz", + "integrity": "sha512-0+4bNjlndNWMoVLH/+y4uHnf6GrTipsC+YTppJxelVJo+xeRVQ0s2PpkdDCVTsu7efyj+8r1gFiwVXsp6JZ0iQ==", + "dependencies": { + "@chevrotain/gast": "10.4.2", + "@chevrotain/types": "10.4.2", + "lodash": "4.17.21" + } + }, + "node_modules/langium/node_modules/@chevrotain/gast": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-10.4.2.tgz", + "integrity": "sha512-4ZAn8/mjkmYonilSJ60gGj1tAF0cVWYUMlIGA0e4ATAc3a648aCnvpBw7zlPHDQjFp50XC13iyWEgWAKiRKTOA==", + "dependencies": { + "@chevrotain/types": "10.4.2", + "lodash": "4.17.21" + } + }, + "node_modules/langium/node_modules/@chevrotain/types": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-10.4.2.tgz", + "integrity": "sha512-QzSCjg6G4MvIoLeIgOiMR0IgzkGEQqrNJJIr3T5ETRa7l4Av4AMIiEctV99mvDr57iXwwk0/kr3RJxiU36Nevw==" + }, + "node_modules/langium/node_modules/@chevrotain/utils": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-10.4.2.tgz", + "integrity": "sha512-V34dacxWLwKcvcy32dx96ADJVdB7kOJLm7LyBkBQw5u5HC9WdEFw2G17zml+U3ivavGTrGPJHl8o9/UJm0PlUw==" + }, + "node_modules/langium/node_modules/chevrotain": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-10.4.2.tgz", + "integrity": "sha512-gzF5GxE0Ckti5kZVuKEZycLntB5X2aj9RVY0r4/220GwQjdnljU+/t3kP74/FMWC7IzCDDEjQ9wsFUf0WCdSHg==", + "dependencies": { + "@chevrotain/cst-dts-gen": "10.4.2", + "@chevrotain/gast": "10.4.2", + "@chevrotain/types": "10.4.2", + "@chevrotain/utils": "10.4.2", + "lodash": "4.17.21", + "regexp-to-ast": "0.5.0" + } + }, + "node_modules/langium/node_modules/chevrotain-allstar": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.1.7.tgz", + "integrity": "sha512-oMSHkXVCDQxnj3tDCqcEoMnNIEiYlAYT0FVja1PaLrT3njXGvg5JXTXs/tk2NI42SR3LMJyqTNgjR4VyDIf19w==", + "dependencies": { + "lodash": "^4.17.21" + }, + "peerDependencies": { + "chevrotain": "~10.4.1" + } + }, + "node_modules/langium/node_modules/vscode-jsonrpc": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.0.2.tgz", + "integrity": "sha512-RY7HwI/ydoC1Wwg4gJ3y6LpU9FJRZAUnTYMXthqhFXXu77ErDd/xkREpGuk4MyYkk4a+XDWAMqe0S3KkelYQEQ==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/langium/node_modules/vscode-languageserver": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.0.2.tgz", + "integrity": "sha512-bpEt2ggPxKzsAOZlXmCJ50bV7VrxwCS5BI4+egUmure/oI/t4OlFzi/YNtVvY24A2UDOZAgwFGgnZPwqSJubkA==", + "dependencies": { + "vscode-languageserver-protocol": "3.17.2" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/langium/node_modules/vscode-languageserver-protocol": { + "version": "3.17.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.2.tgz", + "integrity": "sha512-8kYisQ3z/SQ2kyjlNeQxbkkTNmVFoQCqkmGrzLH6A9ecPlgTbp3wDTnUNqaUxYr4vlAcloxx8zwy7G5WdguYNg==", + "dependencies": { + "vscode-jsonrpc": "8.0.2", + "vscode-languageserver-types": "3.17.2" + } + }, + "node_modules/langium/node_modules/vscode-languageserver-types": { + "version": "3.17.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", + "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" + }, + "node_modules/local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/magic-string": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.1.tgz", + "integrity": "sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/magic-string/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minipass": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", + "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mlly": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.0.tgz", + "integrity": "sha512-ua8PAThnTwpprIaU47EPeZ/bPUVp2QYBbWMphUQpVdBI3Lgqzm5KZQ45Agm3YJedHXaIHl6pBGabaLSUPPSptg==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "pathe": "^1.1.1", + "pkg-types": "^1.0.3", + "ufo": "^1.1.2" + } + }, + "node_modules/mrmime": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", + "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.0.tgz", + "integrity": "sha512-tZFEaRQbMLjwrsmidsGJ6wDMv0iazJWk6SfIKnY4Xru8auXgmJkOBa5DUbYFcFD2Rzk2+KDlIiF0GVXNCbgC7g==", + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/pathe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" + } + }, + "node_modules/postcss": { + "version": "8.4.24", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz", + "integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/pretty-format": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.0.tgz", + "integrity": "sha512-XH+D4n7Ey0iSR6PdAnBs99cWMZdGsdKrR33iUHQNr79w1szKTCIZDVdXuccAsHVwDBp0XeWPfNEoaxP9EZgRmQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.0", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/radash": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/radash/-/radash-11.0.0.tgz", + "integrity": "sha512-CRWxTFTDff0IELGJ/zz58yY4BDgyI14qSM5OLNKbCItJrff7m7dXbVF0kWYVCXQtPb3SXIVhXvAImH6eT7VLSg==", + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/regexp-to-ast": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", + "integrity": "sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==" + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "3.26.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.26.0.tgz", + "integrity": "sha512-YzJH0eunH2hr3knvF3i6IkLO/jTjAEwU4HoMUbQl4//Tnl3ou0e7P5SjxdDr8HQJdeUJShlbEHXrrnEHy1l7Yg==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/semver": { + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "node_modules/sirv": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.3.tgz", + "integrity": "sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==", + "dev": true, + "dependencies": { + "@polka/url": "^1.0.0-next.20", + "mrmime": "^1.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.3.tgz", + "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==", + "dev": true + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-literal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", + "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/tinybench": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.0.tgz", + "integrity": "sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.5.0.tgz", + "integrity": "sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz", + "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/true-myth": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/true-myth/-/true-myth-6.2.0.tgz", + "integrity": "sha512-NYvzj/h2mGXmdIBmz825c/lQhpI4bzUQEEiBCAbNOVpr6aeYa1WTpJ+OmGmj1yPqbTLPKCCSi54yDnaEup504Q==", + "engines": { + "node": "14.* || 16.* || >= 18.*" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.1.2.tgz", + "integrity": "sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==", + "dev": true + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/vite": { + "version": "4.3.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz", + "integrity": "sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==", + "dev": true, + "dependencies": { + "esbuild": "^0.17.5", + "postcss": "^8.4.23", + "rollup": "^3.21.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.32.4.tgz", + "integrity": "sha512-L2gIw+dCxO0LK14QnUMoqSYpa9XRGnTTTDjW2h19Mr+GR0EFj4vx52W41gFXfMLqpA00eK4ZjOVYo1Xk//LFEw==", + "dev": true, + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.4.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vitest": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.32.4.tgz", + "integrity": "sha512-3czFm8RnrsWwIzVDu/Ca48Y/M+qh3vOnF16czJm98Q/AN1y3B6PBsyV8Re91Ty5s7txKNjEhpgtGPcfdbh2MZg==", + "dev": true, + "dependencies": { + "@types/chai": "^4.3.5", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.32.4", + "@vitest/runner": "0.32.4", + "@vitest/snapshot": "0.32.4", + "@vitest/spy": "0.32.4", + "@vitest/utils": "0.32.4", + "acorn": "^8.9.0", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.7", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.3.3", + "strip-literal": "^1.0.1", + "tinybench": "^2.5.0", + "tinypool": "^0.5.0", + "vite": "^3.0.0 || ^4.0.0", + "vite-node": "0.32.4", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.18.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*", + "playwright": "*", + "safaridriver": "*", + "webdriverio": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "playwright": { + "optional": true + }, + "safaridriver": { + "optional": true + }, + "webdriverio": { + "optional": true + } + } + }, + "node_modules/vscode-jsonrpc": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", + "integrity": "sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageclient": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", + "integrity": "sha512-GL4QdbYUF/XxQlAsvYWZRV3V34kOkpRlvV60/72ghHfsYFnS/v2MANZ9P6sHmxFcZKOse8O+L9G7Czg0NUWing==", + "dependencies": { + "minimatch": "^5.1.0", + "semver": "^7.3.7", + "vscode-languageserver-protocol": "3.17.3" + }, + "engines": { + "vscode": "^1.67.0" + } + }, + "node_modules/vscode-languageclient/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/vscode-languageclient/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/vscode-languageserver": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.1.0.tgz", + "integrity": "sha512-eUt8f1z2N2IEUDBsKaNapkz7jl5QpskN2Y0G01T/ItMxBxw1fJwvtySGB9QMecatne8jFIWJGWI61dWjyTLQsw==", + "dependencies": { + "vscode-languageserver-protocol": "3.17.3" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.3.tgz", + "integrity": "sha512-924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA==", + "dependencies": { + "vscode-jsonrpc": "8.1.0", + "vscode-languageserver-types": "3.17.3" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz", + "integrity": "sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", + "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" + }, + "node_modules/vscode-uri": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.7.tgz", + "integrity": "sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "@chevrotain/cst-dts-gen": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.5.0.tgz", + "integrity": "sha512-lhmC/FyqQ2o7pGK4Om+hzuDrm9rhFYIJ/AXoQBeongmn870Xeb0L6oGEiuR8nohFNL5sMaQEJWCxr1oIVIVXrw==", + "requires": { + "@chevrotain/gast": "10.5.0", + "@chevrotain/types": "10.5.0", + "lodash": "4.17.21" + } + }, + "@chevrotain/gast": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-10.5.0.tgz", + "integrity": "sha512-pXdMJ9XeDAbgOWKuD1Fldz4ieCs6+nLNmyVhe2gZVqoO7v8HXuHYs5OV2EzUtbuai37TlOAQHrTDvxMnvMJz3A==", + "requires": { + "@chevrotain/types": "10.5.0", + "lodash": "4.17.21" + } + }, + "@chevrotain/types": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-10.5.0.tgz", + "integrity": "sha512-f1MAia0x/pAVPWH/T73BJVyO2XU5tI4/iE7cnxb7tqdNTNhQI3Uq3XkqcoteTmD4t1aM0LbHCJOhgIDn07kl2A==" + }, + "@chevrotain/utils": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-10.5.0.tgz", + "integrity": "sha512-hBzuU5+JjB2cqNZyszkDHZgOSrUUT8V3dhgRl8Q9Gp6dAj/H5+KILGjbhDpc3Iy9qmqlm/akuOI2ut9VUtzJxQ==" + }, + "@esbuild/android-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "dev": true, + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "dev": true, + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "dev": true, + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "dev": true, + "optional": true + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jest/schemas": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.0.tgz", + "integrity": "sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ==", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.27.8" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true + }, + "@polka/url": { + "version": "1.0.0-next.21", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", + "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==", + "dev": true + }, + "@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "@types/chai": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", + "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", + "dev": true + }, + "@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "requires": { + "@types/chai": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "@types/node": { + "version": "18.16.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.18.tgz", + "integrity": "sha512-/aNaQZD0+iSBAGnvvN2Cx92HqE5sZCPZtx2TsK+4nvV23fFe09jVDvpArXr2j9DnYlzuU9WuoykDDc6wqvpNcw==", + "dev": true + }, + "@types/vscode": { + "version": "1.79.1", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.79.1.tgz", + "integrity": "sha512-Ikwc4YbHABzqthrWfeAvItaAIfX9mdjMWxqNgTpGjhgOu0TMRq9LzyZ2yBK0JhYqoSjEubEPawf6zJgnl6Egtw==", + "dev": true + }, + "@vitest/coverage-v8": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-0.32.4.tgz", + "integrity": "sha512-itiCYY3TmWEK+5wnFBoNr0ZA+adACp7Op1r2TeX5dPOgU2See7+Gx2NlK2lVMHVxfPsu5z9jszKa3i//eR+hqg==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.1", + "@bcoe/v8-coverage": "^0.2.3", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.1", + "istanbul-reports": "^3.1.5", + "magic-string": "^0.30.0", + "picocolors": "^1.0.0", + "std-env": "^3.3.3", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^9.1.0" + } + }, + "@vitest/expect": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.32.4.tgz", + "integrity": "sha512-m7EPUqmGIwIeoU763N+ivkFjTzbaBn0n9evsTOcde03ugy2avPs3kZbYmw3DkcH1j5mxhMhdamJkLQ6dM1bk/A==", + "dev": true, + "requires": { + "@vitest/spy": "0.32.4", + "@vitest/utils": "0.32.4", + "chai": "^4.3.7" + } + }, + "@vitest/runner": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.32.4.tgz", + "integrity": "sha512-cHOVCkiRazobgdKLnczmz2oaKK9GJOw6ZyRcaPdssO1ej+wzHVIkWiCiNacb3TTYPdzMddYkCgMjZ4r8C0JFCw==", + "dev": true, + "requires": { + "@vitest/utils": "0.32.4", + "p-limit": "^4.0.0", + "pathe": "^1.1.1" + } + }, + "@vitest/snapshot": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.32.4.tgz", + "integrity": "sha512-IRpyqn9t14uqsFlVI2d7DFMImGMs1Q9218of40bdQQgMePwVdmix33yMNnebXcTzDU5eiV3eUsoxxH5v0x/IQA==", + "dev": true, + "requires": { + "magic-string": "^0.30.0", + "pathe": "^1.1.1", + "pretty-format": "^29.5.0" + } + }, + "@vitest/spy": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.32.4.tgz", + "integrity": "sha512-oA7rCOqVOOpE6rEoXuCOADX7Lla1LIa4hljI2MSccbpec54q+oifhziZIJXxlE/CvI2E+ElhBHzVu0VEvJGQKQ==", + "dev": true, + "requires": { + "tinyspy": "^2.1.1" + } + }, + "@vitest/ui": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-0.32.4.tgz", + "integrity": "sha512-92y7bkjf55L08nomvHHYQkDWQEIkb36dJkgi+F/zpO5cFbrmk1pv/dYiaZKQ772uP96fAWinmux6sXNMNUh16w==", + "dev": true, + "requires": { + "@vitest/utils": "0.32.4", + "fast-glob": "^3.2.12", + "fflate": "^0.8.0", + "flatted": "^3.2.7", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "sirv": "^2.0.3" + } + }, + "@vitest/utils": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.32.4.tgz", + "integrity": "sha512-Gwnl8dhd1uJ+HXrYyV0eRqfmk9ek1ASE/LWfTCuWMw+d07ogHqp4hEAV28NiecimK6UY9DpSEPh+pXBA5gtTBg==", + "dev": true, + "requires": { + "diff-sequences": "^29.4.3", + "loupe": "^2.3.6", + "pretty-format": "^29.5.0" + } + }, + "acorn": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz", + "integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true + }, + "chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "dev": true + }, + "chevrotain": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-10.5.0.tgz", + "integrity": "sha512-Pkv5rBY3+CsHOYfV5g/Vs5JY9WTHHDEKOlohI2XeygaZhUeqhAlldZ8Hz9cRmxu709bvS08YzxHdTPHhffc13A==", + "requires": { + "@chevrotain/cst-dts-gen": "10.5.0", + "@chevrotain/gast": "10.5.0", + "@chevrotain/types": "10.5.0", + "@chevrotain/utils": "10.5.0", + "lodash": "4.17.21", + "regexp-to-ast": "0.5.0" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "commander": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "diff-sequences": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", + "dev": true + }, + "esbuild": { + "version": "0.17.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" + } + }, + "fast-glob": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", + "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "fflate": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.0.tgz", + "integrity": "sha512-FAdS4qMuFjsJj6XHbBaZeXOgaypXp8iw/Tpyuq/w3XA41jjLHT8NPA+n7czH/DDhdncq0nAyDZmPeWXh2qmdIg==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true + }, + "glob": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.1.tgz", + "integrity": "sha512-9BKYcEeIs7QwlCYs+Y3GBvqAMISufUS0i2ELd11zpZjxI5V9iyRj0HgzB5/cLf2NY4vcYBTYzJ7GIui7j/4DOw==", + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2", + "path-scurry": "^1.10.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + } + }, + "minimatch": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", + "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "signal-exit": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.0.1.tgz", + "integrity": "sha512-uUWsN4aOxJAS8KOuf3QMyFtgm1pkb6I+KRZbRF/ghdf5T7sM+B1lLLzPDxswUjkmHyxQAVzEgG35E3NzDM9GVw==" + } + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + } + }, + "istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jackspeak": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.1.0.tgz", + "integrity": "sha512-DiEwVPqsieUzZBNxQ2cxznmFzfg/AMgJUjYw5xl6rSmCxAQXECcbSdwcLM6Ds6T09+SBfSNCGPhYUoQ96P4h7A==", + "requires": { + "@pkgjs/parseargs": "^0.11.0", + "cliui": "^7.0.4" + } + }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "jsonschema": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", + "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", + "dev": true + }, + "langium": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium/-/langium-1.2.1.tgz", + "integrity": "sha512-tpUa1r47pxuUBNqX5X4GAB08qhWpVwWhxjwOV+948skElHO9OV6emngfY3jOYzchJS4H6UZwyKalsOb8GGPsnQ==", + "requires": { + "chevrotain": "~10.4.2", + "chevrotain-allstar": "~0.1.4", + "vscode-languageserver": "~8.0.2", + "vscode-languageserver-textdocument": "~1.0.8", + "vscode-uri": "~3.0.7" + }, + "dependencies": { + "@chevrotain/cst-dts-gen": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.4.2.tgz", + "integrity": "sha512-0+4bNjlndNWMoVLH/+y4uHnf6GrTipsC+YTppJxelVJo+xeRVQ0s2PpkdDCVTsu7efyj+8r1gFiwVXsp6JZ0iQ==", + "requires": { + "@chevrotain/gast": "10.4.2", + "@chevrotain/types": "10.4.2", + "lodash": "4.17.21" + } + }, + "@chevrotain/gast": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-10.4.2.tgz", + "integrity": "sha512-4ZAn8/mjkmYonilSJ60gGj1tAF0cVWYUMlIGA0e4ATAc3a648aCnvpBw7zlPHDQjFp50XC13iyWEgWAKiRKTOA==", + "requires": { + "@chevrotain/types": "10.4.2", + "lodash": "4.17.21" + } + }, + "@chevrotain/types": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-10.4.2.tgz", + "integrity": "sha512-QzSCjg6G4MvIoLeIgOiMR0IgzkGEQqrNJJIr3T5ETRa7l4Av4AMIiEctV99mvDr57iXwwk0/kr3RJxiU36Nevw==" + }, + "@chevrotain/utils": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-10.4.2.tgz", + "integrity": "sha512-V34dacxWLwKcvcy32dx96ADJVdB7kOJLm7LyBkBQw5u5HC9WdEFw2G17zml+U3ivavGTrGPJHl8o9/UJm0PlUw==" + }, + "chevrotain": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-10.4.2.tgz", + "integrity": "sha512-gzF5GxE0Ckti5kZVuKEZycLntB5X2aj9RVY0r4/220GwQjdnljU+/t3kP74/FMWC7IzCDDEjQ9wsFUf0WCdSHg==", + "requires": { + "@chevrotain/cst-dts-gen": "10.4.2", + "@chevrotain/gast": "10.4.2", + "@chevrotain/types": "10.4.2", + "@chevrotain/utils": "10.4.2", + "lodash": "4.17.21", + "regexp-to-ast": "0.5.0" + } + }, + "chevrotain-allstar": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.1.7.tgz", + "integrity": "sha512-oMSHkXVCDQxnj3tDCqcEoMnNIEiYlAYT0FVja1PaLrT3njXGvg5JXTXs/tk2NI42SR3LMJyqTNgjR4VyDIf19w==", + "requires": { + "lodash": "^4.17.21" + } + }, + "vscode-jsonrpc": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.0.2.tgz", + "integrity": "sha512-RY7HwI/ydoC1Wwg4gJ3y6LpU9FJRZAUnTYMXthqhFXXu77ErDd/xkREpGuk4MyYkk4a+XDWAMqe0S3KkelYQEQ==" + }, + "vscode-languageserver": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.0.2.tgz", + "integrity": "sha512-bpEt2ggPxKzsAOZlXmCJ50bV7VrxwCS5BI4+egUmure/oI/t4OlFzi/YNtVvY24A2UDOZAgwFGgnZPwqSJubkA==", + "requires": { + "vscode-languageserver-protocol": "3.17.2" + } + }, + "vscode-languageserver-protocol": { + "version": "3.17.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.2.tgz", + "integrity": "sha512-8kYisQ3z/SQ2kyjlNeQxbkkTNmVFoQCqkmGrzLH6A9ecPlgTbp3wDTnUNqaUxYr4vlAcloxx8zwy7G5WdguYNg==", + "requires": { + "vscode-jsonrpc": "8.0.2", + "vscode-languageserver-types": "3.17.2" + } + }, + "vscode-languageserver-types": { + "version": "3.17.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", + "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" + } + } + }, + "langium-cli": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/langium-cli/-/langium-cli-1.2.1.tgz", + "integrity": "sha512-sbGucMXqfDfLmF6bvFsyv7f4/y2dNivVKpXD5j//OxMrBsF+N8fATVqq8bopUvAxxvb0dmaV0xpIxYr7b7Efjg==", + "dev": true, + "requires": { + "chalk": "~4.1.2", + "commander": "~10.0.0", + "fs-extra": "~11.1.0", + "jsonschema": "~1.4.1", + "langium": "~1.2.0", + "lodash": "~4.17.21" + }, + "dependencies": { + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true + } + } + }, + "local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "requires": { + "get-func-name": "^2.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "magic-string": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.1.tgz", + "integrity": "sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==", + "dev": true, + "requires": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "dependencies": { + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + } + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minipass": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", + "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==" + }, + "mlly": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.0.tgz", + "integrity": "sha512-ua8PAThnTwpprIaU47EPeZ/bPUVp2QYBbWMphUQpVdBI3Lgqzm5KZQ45Agm3YJedHXaIHl6pBGabaLSUPPSptg==", + "dev": true, + "requires": { + "acorn": "^8.9.0", + "pathe": "^1.1.1", + "pkg-types": "^1.0.3", + "ufo": "^1.1.2" + } + }, + "mrmime": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", + "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "requires": { + "yocto-queue": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-scurry": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.0.tgz", + "integrity": "sha512-tZFEaRQbMLjwrsmidsGJ6wDMv0iazJWk6SfIKnY4Xru8auXgmJkOBa5DUbYFcFD2Rzk2+KDlIiF0GVXNCbgC7g==", + "requires": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2" + }, + "dependencies": { + "lru-cache": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==" + } + } + }, + "pathe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, + "requires": { + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" + } + }, + "postcss": { + "version": "8.4.24", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz", + "integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==", + "dev": true, + "requires": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "pretty-format": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.0.tgz", + "integrity": "sha512-XH+D4n7Ey0iSR6PdAnBs99cWMZdGsdKrR33iUHQNr79w1szKTCIZDVdXuccAsHVwDBp0XeWPfNEoaxP9EZgRmQ==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.0", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "radash": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/radash/-/radash-11.0.0.tgz", + "integrity": "sha512-CRWxTFTDff0IELGJ/zz58yY4BDgyI14qSM5OLNKbCItJrff7m7dXbVF0kWYVCXQtPb3SXIVhXvAImH6eT7VLSg==" + }, + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "regexp-to-ast": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", + "integrity": "sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==" + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rollup": { + "version": "3.26.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.26.0.tgz", + "integrity": "sha512-YzJH0eunH2hr3knvF3i6IkLO/jTjAEwU4HoMUbQl4//Tnl3ou0e7P5SjxdDr8HQJdeUJShlbEHXrrnEHy1l7Yg==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "semver": { + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "sirv": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.3.tgz", + "integrity": "sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==", + "dev": true, + "requires": { + "@polka/url": "^1.0.0-next.20", + "mrmime": "^1.0.0", + "totalist": "^3.0.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, + "stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "std-env": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.3.3.tgz", + "integrity": "sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-literal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", + "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", + "dev": true, + "requires": { + "acorn": "^8.8.2" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "tinybench": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.0.tgz", + "integrity": "sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==", + "dev": true + }, + "tinypool": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.5.0.tgz", + "integrity": "sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ==", + "dev": true + }, + "tinyspy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz", + "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true + }, + "true-myth": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/true-myth/-/true-myth-6.2.0.tgz", + "integrity": "sha512-NYvzj/h2mGXmdIBmz825c/lQhpI4bzUQEEiBCAbNOVpr6aeYa1WTpJ+OmGmj1yPqbTLPKCCSi54yDnaEup504Q==" + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "typescript": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "dev": true + }, + "ufo": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.1.2.tgz", + "integrity": "sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==", + "dev": true + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true + }, + "v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + } + }, + "vite": { + "version": "4.3.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz", + "integrity": "sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==", + "dev": true, + "requires": { + "esbuild": "^0.17.5", + "fsevents": "~2.3.2", + "postcss": "^8.4.23", + "rollup": "^3.21.0" + } + }, + "vite-node": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.32.4.tgz", + "integrity": "sha512-L2gIw+dCxO0LK14QnUMoqSYpa9XRGnTTTDjW2h19Mr+GR0EFj4vx52W41gFXfMLqpA00eK4ZjOVYo1Xk//LFEw==", + "dev": true, + "requires": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.4.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^3.0.0 || ^4.0.0" + } + }, + "vitest": { + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.32.4.tgz", + "integrity": "sha512-3czFm8RnrsWwIzVDu/Ca48Y/M+qh3vOnF16czJm98Q/AN1y3B6PBsyV8Re91Ty5s7txKNjEhpgtGPcfdbh2MZg==", + "dev": true, + "requires": { + "@types/chai": "^4.3.5", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "@vitest/expect": "0.32.4", + "@vitest/runner": "0.32.4", + "@vitest/snapshot": "0.32.4", + "@vitest/spy": "0.32.4", + "@vitest/utils": "0.32.4", + "acorn": "^8.9.0", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.7", + "debug": "^4.3.4", + "local-pkg": "^0.4.3", + "magic-string": "^0.30.0", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.3.3", + "strip-literal": "^1.0.1", + "tinybench": "^2.5.0", + "tinypool": "^0.5.0", + "vite": "^3.0.0 || ^4.0.0", + "vite-node": "0.32.4", + "why-is-node-running": "^2.2.2" + } + }, + "vscode-jsonrpc": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", + "integrity": "sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw==" + }, + "vscode-languageclient": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", + "integrity": "sha512-GL4QdbYUF/XxQlAsvYWZRV3V34kOkpRlvV60/72ghHfsYFnS/v2MANZ9P6sHmxFcZKOse8O+L9G7Czg0NUWing==", + "requires": { + "minimatch": "^5.1.0", + "semver": "^7.3.7", + "vscode-languageserver-protocol": "3.17.3" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, + "vscode-languageserver": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-8.1.0.tgz", + "integrity": "sha512-eUt8f1z2N2IEUDBsKaNapkz7jl5QpskN2Y0G01T/ItMxBxw1fJwvtySGB9QMecatne8jFIWJGWI61dWjyTLQsw==", + "requires": { + "vscode-languageserver-protocol": "3.17.3" + } + }, + "vscode-languageserver-protocol": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.3.tgz", + "integrity": "sha512-924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA==", + "requires": { + "vscode-jsonrpc": "8.1.0", + "vscode-languageserver-types": "3.17.3" + } + }, + "vscode-languageserver-textdocument": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz", + "integrity": "sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==" + }, + "vscode-languageserver-types": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", + "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" + }, + "vscode-uri": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.7.tgz", + "integrity": "sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "requires": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true + } + } +} diff --git a/DSL/package.json b/DSL/package.json new file mode 100644 index 000000000..50fb0dd50 --- /dev/null +++ b/DSL/package.json @@ -0,0 +1,80 @@ +{ + "name": "safe-ds", + "displayName": "safe-ds", + "description": "Statically checked Data Science programs.", + "version": "0.1.0", + "engines": { + "vscode": "^1.79.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [ + { + "id": "safe-ds", + "aliases": [ + "Safe-DS", + "safe-ds" + ], + "extensions": [ + ".sdspipe", + ".sdsstub", + ".sdstest" + ], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "safe-ds", + "scopeName": "source.safe-ds", + "path": "./syntaxes/safe-ds.tmLanguage.json" + } + ] + }, + "activationEvents": [ + "onLanguage:safe-ds" + ], + "files": [ + "bin", + "out", + "src" + ], + "bin": { + "safe-ds-cli": "./bin/cli" + }, + "main": "./out/src/extension.js", + "scripts": { + "vscode:prepublish": "npm run build && npm run lint", + "build": "tsc -b tsconfig.json", + "watch": "tsc -b tsconfig.json --watch", + "test": "vitest --dir tests", + "test-with-coverage": "vitest --coverage --dir tests", + "test-ui": "vitest --ui --coverage --dir tests", + "langium:generate": "langium generate", + "langium:watch": "langium generate --watch" + }, + "dependencies": { + "chalk": "^5.3.0", + "chevrotain": "^10.5.0", + "commander": "^11.0.0", + "glob": "^10.3.1", + "langium": "^1.2.1", + "radash": "^11.0.0", + "true-myth": "^6.2.0", + "vscode-languageclient": "^8.1.0", + "vscode-languageserver": "^8.1.0", + "vscode-languageserver-types": "^3.17.3", + "vscode-uri": "^3.0.7" + }, + "devDependencies": { + "@types/node": "^18.16.18", + "@types/vscode": "^1.79.1", + "@vitest/coverage-v8": "^0.32.4", + "@vitest/ui": "^0.32.4", + "langium-cli": "^1.2.1", + "typescript": "^5.1.6", + "vitest": "^0.32.4" + } +} diff --git a/DSL/settings.gradle.kts b/DSL/settings.gradle.kts deleted file mode 100644 index aeb5a86fe..000000000 --- a/DSL/settings.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -rootProject.name = "Safe-DS.DSL" - -include( - "com.larsreimann.safeds", - "com.larsreimann.safeds.ide", - "com.larsreimann.safeds.vscode" -) diff --git a/DSL-langium/src/cli/cli-util.ts b/DSL/src/cli/cli-util.ts similarity index 100% rename from DSL-langium/src/cli/cli-util.ts rename to DSL/src/cli/cli-util.ts diff --git a/DSL-langium/src/cli/generator.ts b/DSL/src/cli/generator.ts similarity index 100% rename from DSL-langium/src/cli/generator.ts rename to DSL/src/cli/generator.ts diff --git a/DSL-langium/src/cli/index.ts b/DSL/src/cli/index.ts similarity index 100% rename from DSL-langium/src/cli/index.ts rename to DSL/src/cli/index.ts diff --git a/DSL/src/extension.ts b/DSL/src/extension.ts new file mode 100644 index 000000000..5aad5c4be --- /dev/null +++ b/DSL/src/extension.ts @@ -0,0 +1,57 @@ +import * as vscode from 'vscode'; +import * as path from 'path'; +import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient/node'; + +let client: LanguageClient; + +// This function is called when the extension is activated. +export const activate = function (context: vscode.ExtensionContext): void { + client = startLanguageClient(context); +}; + +// This function is called when the extension is deactivated. +export const deactivate = function (): Thenable | undefined { + if (client) { + return client.stop(); + } + return undefined; +}; + +const startLanguageClient = function (context: vscode.ExtensionContext): LanguageClient { + const serverModule = context.asAbsolutePath(path.join('out', 'src', 'language-server', 'main')); + // The debug options for the server + // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging. + // By setting `process.env.DEBUG_BREAK` to a truthy value, the language server will wait until a debugger is attached. + const debugOptions = { + execArgv: [ + '--nolazy', + `--inspect${process.env.DEBUG_BREAK ? '-brk' : ''}=${process.env.DEBUG_SOCKET || '6009'}`, + ], + }; + + // If the extension is launched in debug mode then the debug server options are used + // Otherwise the run options are used + const serverOptions: ServerOptions = { + run: { module: serverModule, transport: TransportKind.ipc }, + debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }, + }; + + const fileSystemWatcher = vscode.workspace.createFileSystemWatcher('**/*.{sdspipe,sdsstub,sdstest}'); + context.subscriptions.push(fileSystemWatcher); + + // Options to control the language client + const clientOptions: LanguageClientOptions = { + documentSelector: [{ scheme: 'file', language: 'safe-ds' }], + synchronize: { + // Notify the server about file changes to files contained in the workspace + fileEvents: fileSystemWatcher, + }, + }; + + // Create the language client and start the client. + const result = new LanguageClient('safe-ds', 'Safe-DS', serverOptions, clientOptions); + + // Start the client. This will also launch the server + result.start(); + return result; +}; diff --git a/DSL-langium/src/language-server/constant/fileExtensions.ts b/DSL/src/language-server/constant/fileExtensions.ts similarity index 75% rename from DSL-langium/src/language-server/constant/fileExtensions.ts rename to DSL/src/language-server/constant/fileExtensions.ts index 521a09d7b..407522a2c 100644 --- a/DSL-langium/src/language-server/constant/fileExtensions.ts +++ b/DSL/src/language-server/constant/fileExtensions.ts @@ -8,14 +8,6 @@ import { AstNode, getDocument, LangiumDocument } from 'langium'; */ export const PIPELINE_FILE_EXTENSION = 'sdspipe'; -/** - * Marks the file as a schema file. - * - * @see isInSchemaFile - * @see isSchemaFile - */ -export const SCHEMA_FILE_EXTENSION = 'sdsschema'; - /** * Marks the file as a stub file, which describes an external API. * @@ -36,22 +28,13 @@ export const TEST_FILE_EXTENSION = 'sdstest'; /** * All file extensions that are supported by the Safe-DS language. */ -export type SdSFileExtension = - | typeof PIPELINE_FILE_EXTENSION - | typeof SCHEMA_FILE_EXTENSION - | typeof STUB_FILE_EXTENSION - | typeof TEST_FILE_EXTENSION; +export type SdSFileExtension = typeof PIPELINE_FILE_EXTENSION | typeof STUB_FILE_EXTENSION | typeof TEST_FILE_EXTENSION; /** * Returns whether the object is contained in a pipeline file. */ export const isInPipelineFile = (node: AstNode) => isPipelineFile(getDocument(node)); -/** - * Returns whether the object is contained in a schema file. - */ -export const isInSchemaFile = (node: AstNode) => isSchemaFile(getDocument(node)); - /** * Returns whether the object is contained in a stub file. */ @@ -67,11 +50,6 @@ export const isInTestFile = (node: AstNode) => isTestFile(getDocument(node)); */ export const isPipelineFile = (document: LangiumDocument) => hasExtension(document, PIPELINE_FILE_EXTENSION); -/** - * Returns whether the resource represents a schema file. - */ -export const isSchemaFile = (document: LangiumDocument) => hasExtension(document, SCHEMA_FILE_EXTENSION); - /** * Returns whether the resource represents a stub file. */ diff --git a/DSL/src/language-server/formatting/safe-ds-formatter.ts b/DSL/src/language-server/formatting/safe-ds-formatter.ts new file mode 100644 index 000000000..e65c26d68 --- /dev/null +++ b/DSL/src/language-server/formatting/safe-ds-formatter.ts @@ -0,0 +1,921 @@ +import { AbstractFormatter, AstNode, CstNode, findCommentNode, Formatting, isAstNode } from 'langium'; +import * as ast from '../generated/ast'; +import { SdsImport, SdsImportAlias, SdsModule } from '../generated/ast'; +import { annotationCallsOrEmpty, typeArgumentsOrEmpty } from '../helpers/astShortcuts'; +import { FormattingAction, FormattingActionOptions } from 'langium/src/lsp/formatter'; +import noSpace = Formatting.noSpace; +import newLine = Formatting.newLine; +import newLines = Formatting.newLines; +import oneSpace = Formatting.oneSpace; +import indent = Formatting.indent; + +const newLinesWithIndent = function (count: number, options?: FormattingActionOptions): FormattingAction { + return { + options: options ?? {}, + moves: [ + { + tabs: 1, + lines: count, + }, + ], + }; +}; + +export class SafeDSFormatter extends AbstractFormatter { + protected override format(node: AstNode): void { + // ----------------------------------------------------------------------------- + // Module + // ----------------------------------------------------------------------------- + if (ast.isSdsModule(node)) { + this.formatSdsModule(node); + } else if (ast.isSdsImport(node)) { + this.formatSdsImport(node); + } else if (ast.isSdsImportAlias(node)) { + this.formatSdsImportAlias(node); + } + + // ----------------------------------------------------------------------------- + // Declarations + // ----------------------------------------------------------------------------- + else if (ast.isSdsAnnotation(node)) { + this.formatSdsAnnotation(node); + } else if (ast.isSdsAttribute(node)) { + this.formatSdsAttribute(node); + } else if (ast.isSdsClass(node)) { + this.formatSdsClass(node); + } else if (ast.isSdsParentTypeList(node)) { + this.formatSdsParentTypeList(node); + } else if (ast.isSdsClassBody(node)) { + this.formatSdsClassBody(node); + } else if (ast.isSdsEnum(node)) { + this.formatSdsEnum(node); + } else if (ast.isSdsEnumBody(node)) { + this.formatSdsEnumBody(node); + } else if (ast.isSdsEnumVariant(node)) { + this.formatSdsEnumVariant(node); + } else if (ast.isSdsFunction(node)) { + this.formatSdsFunction(node); + } else if (ast.isSdsPipeline(node)) { + this.formatSdsPipeline(node); + } else if (ast.isSdsSegment(node)) { + this.formatSdsSegment(node); + } + + // ----------------------------------------------------------------------------- + // Annotation calls + // ----------------------------------------------------------------------------- + else if (ast.isSdsAnnotationCallList(node)) { + this.formatSdsAnnotationCallList(node); + } else if (ast.isSdsAnnotationCall(node)) { + this.formatSdsAnnotationCall(node); + } + + // ----------------------------------------------------------------------------- + // Constraints + // ----------------------------------------------------------------------------- + else if (ast.isSdsConstraintList(node)) { + this.formatSdsConstraintList(node); + } else if (ast.isSdsTypeParameterConstraint(node)) { + this.formatSdsTypeParameterConstraint(node); + } + + // ----------------------------------------------------------------------------- + // Callables, parameters, and results + // ----------------------------------------------------------------------------- + else if (ast.isSdsParameterList(node)) { + this.formatSdsParameterList(node); + } else if (ast.isSdsParameter(node)) { + this.formatSdsParameter(node); + } else if (ast.isSdsResultList(node)) { + this.formatSdsResultList(node); + } else if (ast.isSdsResult(node)) { + this.formatSdsResult(node); + } + + // ----------------------------------------------------------------------------- + // Statements + // ----------------------------------------------------------------------------- + else if (ast.isSdsBlock(node)) { + this.formatSdsBlock(node); + } else if (ast.isSdsAssignment(node)) { + this.formatSdsAssignment(node); + } else if (ast.isSdsAssigneeList(node)) { + this.formatSdsAssigneeList(node); + } else if (ast.isSdsPlaceholder(node)) { + this.formatSdsPlaceholder(node); + } else if (ast.isSdsYield(node)) { + this.formatSdsYield(node); + } else if (ast.isSdsExpressionStatement(node)) { + this.formatSdsExpressionStatement(node); + } + + // ----------------------------------------------------------------------------- + // Expressions + // ----------------------------------------------------------------------------- + else if (ast.isSdsBlockLambda(node)) { + this.formatSdsBlockLambda(node); + } else if (ast.isSdsBlockLambdaResult(node)) { + this.formatSdsBlockLambdaResult(node); + } else if (ast.isSdsExpressionLambda(node)) { + this.formatSdsExpressionLambda(node); + } else if (ast.isSdsInfixOperation(node)) { + this.formatSdsInfixOperation(node); + } else if (ast.isSdsPrefixOperation(node)) { + this.formatSdsPrefixOperation(node); + } else if (ast.isSdsCall(node)) { + this.formatSdsCall(node); + } else if (ast.isSdsArgumentList(node)) { + this.formatSdsArgumentList(node); + } else if (ast.isSdsArgument(node)) { + this.formatSdsArgument(node); + } else if (ast.isSdsIndexedAccess(node)) { + this.formatSdsIndexedAccess(node); + } else if (ast.isSdsMemberAccess(node)) { + this.formatSdsMemberAccess(node); + } else if (ast.isSdsParenthesizedExpression(node)) { + this.formatSdsParenthesizedExpression(node); + } else if (ast.isSdsTemplateStringStart(node)) { + this.formatSdsTemplateStringStart(node); + } else if (ast.isSdsTemplateStringInner(node)) { + this.formatSdsTemplateStringInner(node); + } else if (ast.isSdsTemplateStringEnd(node)) { + this.formatSdsTemplateStringEnd(node); + } + + // ----------------------------------------------------------------------------- + // Types + // ----------------------------------------------------------------------------- + else if (ast.isSdsMemberType(node)) { + this.formatSdsMemberType(node); + } else if (ast.isSdsCallableType(node)) { + this.formatSdsCallableType(node); + } else if (ast.isSdsNamedType(node)) { + this.formatSdsNamedType(node); + } else if (ast.isSdsUnionType(node)) { + this.formatSdsUnionType(node); + } else if (ast.isSdsTypeParameterList(node)) { + this.formatSdsTypeParameterList(node); + } else if (ast.isSdsTypeParameter(node)) { + this.formatSdsTypeParameter(node); + } else if (ast.isSdsTypeArgumentList(node)) { + this.formatSdsTypeArgumentList(node); + } else if (ast.isSdsTypeArgument(node)) { + this.formatSdsTypeArgument(node); + } else if (ast.isSdsTypeProjection(node)) { + this.formatSdsTypeProjection(node); + } + + // ----------------------------------------------------------------------------- + // Schemas + // ----------------------------------------------------------------------------- + else if (ast.isSdsSchema(node)) { + this.formatSdsSchema(node); + } else if (ast.isSdsColumnList(node)) { + this.formatSdsColumnList(node); + } else if (ast.isSdsColumn(node)) { + this.formatSdsColumn(node); + } + } + + // ----------------------------------------------------------------------------- + // Module + // ----------------------------------------------------------------------------- + + private formatSdsModule(node: SdsModule): void { + const formatter = this.getNodeFormatter(node); + const annotations = annotationCallsOrEmpty(node); + const name = node.name; + const imports = node.imports; + const members = node.members; + + // Annotations + annotations.forEach((value, index) => { + if (index === 0) { + if (this.hasComment(value)) { + formatter.node(value).prepend(newLine()); + } else { + formatter.node(value).prepend(noSpace()); + } + } else { + formatter.node(value).prepend(newLines(1)); + } + }); + + // Package + if (annotations.length === 0) { + const packageKeyword = formatter.keyword('package'); + const cstNodes = packageKeyword.nodes; + + if (cstNodes.length > 0 && this.hasComment(cstNodes[0])) { + packageKeyword.prepend(newLine()); + } else { + packageKeyword.prepend(noSpace()); + } + } else { + formatter.keyword('package').prepend(newLines(2)); + } + formatter.keyword('package').append(oneSpace()); + formatter.keyword('.').surround(noSpace()); + + // Imports + imports.forEach((value, index) => { + if (index === 0) { + if (annotations.length === 0 && !name) { + if (this.hasComment(value)) { + formatter.node(value).prepend(newLine()); + } else { + formatter.node(value).prepend(noSpace()); + } + } else { + formatter.node(value).prepend(newLines(2)); + } + } else { + formatter.node(value).prepend(newLines(1)); + } + }); + + // Members + members.forEach((value, index) => { + if (index === 0) { + if (annotations.length === 0 && !name && imports.length === 0) { + if (this.hasComment(value)) { + formatter.node(value).prepend(newLine()); + } else { + formatter.node(value).prepend(noSpace()); + } + } else { + const valueAnnotations = annotationCallsOrEmpty(value); + if (valueAnnotations.length > 0) { + formatter.node(valueAnnotations[0]).prepend(newLines(2)); + } else { + formatter.node(value).prepend(newLines(2)); + } + } + } else { + const valueAnnotations = annotationCallsOrEmpty(value); + if (valueAnnotations.length > 0) { + formatter.node(valueAnnotations[0]).prepend(newLines(2)); + } else { + formatter.node(value).prepend(newLines(2)); + } + } + }); + } + + private formatSdsImport(node: SdsImport): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('import').append(oneSpace()); + formatter.keyword('.').surround(noSpace()); + } + + private formatSdsImportAlias(node: SdsImportAlias): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('as').surround(Formatting.oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Declarations + // ----------------------------------------------------------------------------- + + private formatSdsAnnotation(node: ast.SdsAnnotation): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('annotation').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('constraintList').prepend(oneSpace()); + } + + private formatSdsAttribute(node: ast.SdsAttribute): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + if (node.static) { + formatter.keyword('static').prepend(newLine()); + } else { + formatter.keyword('attr').prepend(newLine()); + } + } + + formatter.keyword('static').append(oneSpace()); + formatter.property('name').prepend(oneSpace()); + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + } + + private formatSdsClass(node: ast.SdsClass): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('class').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('typeParameterList').prepend(noSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('parentTypeList').prepend(oneSpace()); + formatter.property('constraintList').prepend(oneSpace()); + + if (node.constraintList) { + formatter.property('body').prepend(newLine()); + } else { + formatter.property('body').prepend(oneSpace()); + } + } + + formatSdsParentTypeList(node: ast.SdsParentTypeList): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('sub').append(oneSpace()); + formatter.keywords(',').prepend(noSpace()).append(oneSpace()); + } + + private formatSdsClassBody(node: ast.SdsClassBody): void { + const formatter = this.getNodeFormatter(node); + + const members = node.members ?? []; + if (members.length === 0) { + formatter.keyword('{').append(noSpace()); + formatter.keyword('}').prepend(noSpace()); + } else { + members.forEach((value, index) => { + if (index === 0) { + formatter.node(value).prepend(indent()); + } else { + formatter.node(value).prepend(newLinesWithIndent(2)); + } + }); + formatter.keyword('}').prepend(newLine()); + } + } + + private formatSdsEnum(node: ast.SdsEnum): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('enum').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('body').prepend(oneSpace()); + } + + private formatSdsEnumBody(node: ast.SdsEnumBody): void { + const formatter = this.getNodeFormatter(node); + + const variants = node.variants ?? []; + if (variants.length === 0) { + formatter.keyword('{').append(noSpace()); + formatter.keyword('}').prepend(noSpace()); + } else { + variants.forEach((value, index) => { + if (index === 0) { + formatter.node(value).prepend(indent()); + } else { + formatter.node(value).prepend(newLinesWithIndent(2)); + } + }); + formatter.keyword('}').prepend(newLine()); + } + } + + private formatSdsEnumVariant(node: ast.SdsEnumVariant): void { + const formatter = this.getNodeFormatter(node); + + const annotationCalls = annotationCallsOrEmpty(node); + + formatter.nodes(...annotationCalls.slice(1)).prepend(newLine()); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.property('name').prepend(newLine()); + } + + formatter.property('typeParameterList').prepend(noSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('constraintList').prepend(oneSpace()); + } + + formatSdsFunction(node: ast.SdsFunction): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + if (node.static) { + formatter.keyword('static').prepend(newLine()); + } else { + formatter.keyword('fun').prepend(newLine()); + } + } + + formatter.keyword('static').append(oneSpace()); + formatter.property('name').prepend(oneSpace()); + formatter.property('typeParameterList').prepend(noSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('resultList').prepend(oneSpace()); + formatter.property('constraintList').prepend(oneSpace()); + } + + private formatSdsPipeline(node: ast.SdsPipeline): void { + const formatter = this.getNodeFormatter(node); + + formatter.property('annotationCallList').prepend(noSpace()); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('pipeline').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.node(node.body).prepend(oneSpace()); + } + + private formatSdsSegment(node: ast.SdsSegment): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length === 0) { + if (node.visibility) { + formatter.keyword('segment').prepend(oneSpace()); + } + } else { + if (node.visibility) { + formatter.property('visibility').prepend(newLine()); + formatter.keyword('segment').prepend(oneSpace()); + } else { + formatter.keyword('segment').prepend(newLine()); + } + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('resultList').prepend(oneSpace()); + formatter.property('body').prepend(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Annotation calls + // ----------------------------------------------------------------------------- + + private formatSdsAnnotationCallList(node: ast.SdsAnnotationCallList): void { + const formatter = this.getNodeFormatter(node); + const annotationCalls = node.annotationCalls ?? []; + + formatter.nodes(...annotationCalls.slice(1)).prepend(newLine()); + } + + private formatSdsAnnotationCall(node: ast.SdsAnnotationCall): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('@').append(noSpace()); + formatter.property('argumentList').prepend(noSpace()); + } + + // ----------------------------------------------------------------------------- + // Constraints + // ----------------------------------------------------------------------------- + + private formatSdsConstraintList(node: ast.SdsConstraintList) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('where').append(oneSpace()); + + const openingBrace = formatter.keyword('{'); + const closingBrace = formatter.keyword('}'); + + const constraints = node.constraints ?? []; + + if (constraints.length === 0) { + openingBrace.append(noSpace()); + closingBrace.prepend(noSpace()); + } else { + formatter.nodes(...constraints).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingBrace.prepend(newLine()); + } + } + + private formatSdsTypeParameterConstraint(node: ast.SdsTypeParameterConstraint) { + const formatter = this.getNodeFormatter(node); + + formatter.property('operator').surround(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Callables, parameters, and results + // ----------------------------------------------------------------------------- + + private formatSdsParameterList(node: ast.SdsParameterList): void { + const formatter = this.getNodeFormatter(node); + + const openingParenthesis = formatter.keyword('('); + const closingParenthesis = formatter.keyword(')'); + + const parameters = node.parameters ?? []; + + if ( + parameters.length >= 3 || + parameters.some((it) => annotationCallsOrEmpty(it).length > 0 || this.isComplexType(it.type)) + ) { + formatter.nodes(...parameters).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(newLine()); + } else { + openingParenthesis.append(noSpace()); + formatter.nodes(...parameters.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(noSpace()); + } + } + + private formatSdsParameter(node: ast.SdsParameter): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length === 0) { + if (node.variadic) { + formatter.property('name').prepend(oneSpace()); + } + } else { + formatter.property('name').prepend(newLine()); + } + + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + formatter.keyword('=').surround(oneSpace()); + } + + private formatSdsResultList(node: ast.SdsResultList): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('->').surround(oneSpace()); + + const openingParenthesis = formatter.keyword('('); + const closingParenthesis = formatter.keyword(')'); + + const results = node.results ?? []; + + if ( + results.length >= 3 || + results.some((it) => annotationCallsOrEmpty(it).length > 0 || this.isComplexType(it.type)) + ) { + formatter.nodes(...results).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(newLine()); + } else { + openingParenthesis.append(noSpace()); + formatter.nodes(...results.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(noSpace()); + } + } + + private formatSdsResult(node: ast.SdsResult): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.property('name').prepend(newLine()); + } + + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Statements + // ----------------------------------------------------------------------------- + + private formatSdsBlock(node: ast.SdsBlock): void { + const formatter = this.getNodeFormatter(node); + const openingBrace = formatter.keyword('{'); + const closingBrace = formatter.keyword('}'); + + if (node.statements.length === 0) { + openingBrace.append(noSpace()); + closingBrace.prepend(noSpace()); + } else { + formatter.nodes(...node.statements).prepend(indent({ allowMore: true })); + closingBrace.prepend(newLine()); + } + } + + private formatSdsAssignment(node: ast.SdsAssignment) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('=').surround(oneSpace()); + formatter.keyword(';').prepend(noSpace()); + } + + private formatSdsAssigneeList(node: ast.SdsAssigneeList) { + const formatter = this.getNodeFormatter(node); + + formatter.keywords(',').prepend(noSpace()).append(oneSpace()); + } + + private formatSdsPlaceholder(node: ast.SdsPlaceholder) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('val').append(oneSpace()); + } + + private formatSdsYield(node: ast.SdsYield) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('yield').append(oneSpace()); + formatter.property('result').prepend(oneSpace()); + } + + private formatSdsExpressionStatement(node: ast.SdsExpressionStatement) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword(';').prepend(noSpace()); + } + + // ----------------------------------------------------------------------------- + // Expressions + // ----------------------------------------------------------------------------- + + private formatSdsBlockLambda(node: ast.SdsBlockLambda): void { + const formatter = this.getNodeFormatter(node); + + formatter.property('body').prepend(oneSpace()); + } + + private formatSdsBlockLambdaResult(node: ast.SdsBlockLambdaResult) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('yield').append(oneSpace()); + } + + private formatSdsExpressionLambda(node: ast.SdsExpressionLambda) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('->').surround(oneSpace()); + } + + private formatSdsInfixOperation(node: ast.SdsInfixOperation) { + const formatter = this.getNodeFormatter(node); + + formatter.property('operator').surround(oneSpace()); + } + + private formatSdsPrefixOperation(node: ast.SdsPrefixOperation) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('not').append(oneSpace()); + formatter.keyword('-').append(noSpace()); + } + + private formatSdsCall(node: ast.SdsCall) { + const formatter = this.getNodeFormatter(node); + + formatter.property('typeArgumentList').prepend(noSpace()); + formatter.property('argumentList').prepend(noSpace()); + } + + private formatSdsArgumentList(node: ast.SdsArgumentList): void { + const formatter = this.getNodeFormatter(node); + + const openingParenthesis = formatter.keyword('('); + const closingParenthesis = formatter.keyword(')'); + + const args = node.arguments ?? []; + + if (args.length >= 3 || args.some((it) => this.isComplexExpression(it.value))) { + formatter.nodes(...args).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(newLine()); + } else { + openingParenthesis.append(noSpace()); + formatter.nodes(...args.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(noSpace()); + } + } + + private formatSdsArgument(node: ast.SdsArgument): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('=').surround(oneSpace()); + } + + private formatSdsIndexedAccess(node: ast.SdsIndexedAccess) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('[').surround(noSpace()); + formatter.keyword(']').prepend(noSpace()); + } + + private formatSdsMemberAccess(node: ast.SdsMemberAccess) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('?').surround(noSpace()); + formatter.keyword('.').surround(noSpace()); + } + + private formatSdsParenthesizedExpression(node: ast.SdsParenthesizedExpression): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('(').append(noSpace()); + formatter.keyword(')').prepend(noSpace()); + } + + private formatSdsTemplateStringStart(node: ast.SdsTemplateStringStart) { + const formatter = this.getNodeFormatter(node); + + formatter.node(node).append(oneSpace()); + } + + private formatSdsTemplateStringInner(node: ast.SdsTemplateStringInner) { + const formatter = this.getNodeFormatter(node); + + formatter.node(node).surround(oneSpace()); + } + + private formatSdsTemplateStringEnd(node: ast.SdsTemplateStringEnd) { + const formatter = this.getNodeFormatter(node); + + formatter.node(node).prepend(oneSpace()); + } + + /** + * Returns whether the expression is considered complex and requires special formatting like placing the associated + * argument on its own line. + * + * @param node The expression to check. + */ + private isComplexExpression(node: ast.SdsExpression | undefined): boolean { + return ast.isSdsChainedExpression(node); + } + + // ----------------------------------------------------------------------------- + // Types + // ----------------------------------------------------------------------------- + + private formatSdsMemberType(node: ast.SdsMemberType) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('.').surround(noSpace()); + } + + private formatSdsCallableType(node: ast.SdsCallableType) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('->').surround(oneSpace()); + } + + private formatSdsNamedType(node: ast.SdsNamedType) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('?').prepend(noSpace()); + formatter.property('typeArgumentList').prepend(noSpace()); + } + + private formatSdsUnionType(node: ast.SdsUnionType): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('union').append(noSpace()); + } + + private formatSdsTypeParameterList(node: ast.SdsTypeParameterList): void { + const formatter = this.getNodeFormatter(node); + + const closingBracket = formatter.keyword('>'); + + const typeParameters = node.typeParameters ?? []; + + if (typeParameters.length >= 3 || typeParameters.some((it) => annotationCallsOrEmpty(it).length > 0)) { + formatter.nodes(...typeParameters).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingBracket.prepend(newLine()); + } else { + if (typeParameters.length > 0) { + formatter.node(typeParameters[0]).prepend(noSpace()); + formatter.nodes(...typeParameters.slice(1)).prepend(oneSpace()); + } + formatter.keywords(',').prepend(noSpace()); + closingBracket.prepend(noSpace()); + } + } + + private formatSdsTypeParameter(node: ast.SdsTypeParameter) { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + if (node.variance) { + formatter.property('variance').prepend(newLine()); + } else { + formatter.property('name').prepend(newLine()); + } + } + + formatter.property('variance').append(oneSpace()); + } + + private formatSdsTypeArgumentList(node: ast.SdsTypeArgumentList): void { + const formatter = this.getNodeFormatter(node); + const typeArguments = node.typeArguments ?? []; + + if (typeArguments.length > 0) { + formatter.node(typeArguments[0]).prepend(noSpace()); + formatter.nodes(...typeArguments.slice(1)).prepend(oneSpace()); + } + + formatter.keywords(',').prepend(noSpace()); + formatter.keyword('>').prepend(noSpace()); + } + + private formatSdsTypeArgument(node: ast.SdsTypeArgument) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('=').surround(oneSpace()); + } + + private formatSdsTypeProjection(node: ast.SdsTypeProjection) { + const formatter = this.getNodeFormatter(node); + + formatter.property('variance').append(oneSpace()); + } + + /** + * Returns whether the type is considered complex and requires special formatting like placing the associated + * parameter on its own line. + * + * @param node The type to check. + */ + private isComplexType(node: ast.SdsType | undefined): boolean { + if (!node) { + return false; + } + + if (ast.isSdsCallableType(node) || ast.isSdsMemberType(node)) { + return true; + } else if (ast.isSdsUnionType(node)) { + return typeArgumentsOrEmpty(node.typeArgumentList).length > 0; + } else if (ast.isSdsNamedType(node)) { + return typeArgumentsOrEmpty(node.typeArgumentList).length > 0; + } else { + return false; + } + } + + // ----------------------------------------------------------------------------- + // Schemas + // ----------------------------------------------------------------------------- + + private formatSdsSchema(node: ast.SdsSchema) { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('schema').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('columnList').prepend(oneSpace()); + } + + private formatSdsColumnList(node: ast.SdsColumnList) { + const formatter = this.getNodeFormatter(node); + const columns = node.columns ?? []; + + if (columns.length === 0) { + formatter.keyword('{').append(noSpace()); + formatter.keyword('}').prepend(noSpace()); + } else { + formatter.nodes(...columns).prepend(indent()); + formatter.keywords(',').prepend(noSpace()).append(newLine()); + formatter.keyword('}').prepend(newLine()); + } + } + + private formatSdsColumn(node: ast.SdsColumn) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Helpers + // ----------------------------------------------------------------------------- + + /** + * Returns whether the given node has a comment associated with it. + * + * @param node The node to check. + */ + private hasComment(node: AstNode | CstNode | undefined): boolean { + return Boolean(this.getCommentNode(node)); + } + + /** + * Returns the comment associated with the given node. + * + * @param node The node to get the comment for. + */ + private getCommentNode(node: AstNode | CstNode | undefined): CstNode | undefined { + const commentNames = ['ML_COMMENT', 'SL_COMMENT']; + + if (isAstNode(node)) { + return findCommentNode(node.$cstNode, commentNames); + } else { + return findCommentNode(node, commentNames); + } + } +} diff --git a/DSL/src/language-server/grammar/safe-ds.langium b/DSL/src/language-server/grammar/safe-ds.langium new file mode 100644 index 000000000..61dbfe921 --- /dev/null +++ b/DSL/src/language-server/grammar/safe-ds.langium @@ -0,0 +1,1057 @@ +grammar SafeDs + +// ----------------------------------------------------------------------------- +// Base interfaces +// ----------------------------------------------------------------------------- + +interface SdsObject {} + +interface SdsAnnotatedObject extends SdsObject { + annotationCalls?: SdsAnnotationCall[] +} + +interface SdsAbstractCall extends SdsObject { + argumentList: SdsArgumentList +} + +interface SdsDeclaration extends SdsAnnotatedObject, SdsObject { + annotationCallList?: SdsAnnotationCallList + name: string +} + +interface SdsLocalVariable extends SdsDeclaration, SdsObject {} + + +// ----------------------------------------------------------------------------- +// Module +// ----------------------------------------------------------------------------- + +interface SdsModule extends SdsDeclaration { + imports: SdsImport[]; + members: SdsAnnotatedObject[] +} + +entry SdsModule returns SdsModule: + {SdsModule} + annotationCalls+=SdsAnnotationCall* + ( + ('package' name=QualifiedName) + imports+=SdsImport* + members+=(SdsAnnotatedModuleMember | SdsUnannotatedModuleMember)* + + | imports+=SdsImport+ + members+=(SdsAnnotatedModuleMember | SdsUnannotatedModuleMember)* + + | members+=SdsUnannotatedModuleMember + members+=(SdsAnnotatedModuleMember | SdsUnannotatedModuleMember)* + )? +; + +interface SdsImport extends SdsObject { + importedNamespace: string; + alias?: SdsImportAlias; +} + +SdsImport returns SdsImport: + 'import' + importedNamespace=QualifiedNameWithWildcard + alias=SdsImportAlias? +; + +interface SdsImportAlias extends SdsObject { + name: string; +} + +SdsImportAlias returns SdsImportAlias: + 'as' name=ID +; + +QualifiedNameWithWildcard returns string: + ID ('.' ID)* ('.' '*')? +; + +QualifiedName returns string: + ID ('.' ID)* +; + + +// ----------------------------------------------------------------------------- +// Declarations +// ----------------------------------------------------------------------------- + +interface SdsModuleMember extends SdsDeclaration, SdsObject {} + +SdsAnnotatedModuleMember returns SdsAnnotatedObject: + {SdsAnnotationCallList} + annotationCalls+=SdsAnnotationCall+ + ( + {SdsAnnotation.annotationCallList=current} + SdsAnnotationFragment + + | {SdsClass.annotationCallList=current} + SdsClassFragment + + | {SdsEnum.annotationCallList=current} + SdsEnumFragment + + | {SdsFunction.annotationCallList=current} + SdsFunctionFragment + + | {SdsSchema.annotationCallList=current} + SdsSchemaFragment + + | {SdsPipeline.annotationCallList=current} + SdsPipelineFragment + + | {SdsSegment.annotationCallList=current} + SdsSegmentFragment + ) +; + +SdsUnannotatedModuleMember returns SdsAnnotatedObject: + {SdsAnnotation} + SdsAnnotationFragment + + | {SdsClass} + SdsClassFragment + + | {SdsEnum} + SdsEnumFragment + + | {SdsFunction} + SdsFunctionFragment + + | {SdsSchema} + SdsSchemaFragment + + | {SdsPipeline} + SdsPipelineFragment + + | {SdsSegment} + SdsSegmentFragment +; + +interface SdsAnnotation extends SdsCallable, SdsModuleMember { + constraintList?: SdsConstraintList +} + +fragment SdsAnnotationFragment: + 'annotation' name=ID + parameterList=SdsParameterList? + constraintList=SdsConstraintList? +; + +interface SdsClass extends SdsCallable, SdsClassMember, SdsModuleMember, SdsNamedTypeDeclaration { + typeParameterList?: SdsTypeParameterList + parentTypeList?: SdsParentTypeList + constraintList?: SdsConstraintList + body?: SdsClassBody +} + +fragment SdsClassFragment: + 'class' + name=ID + typeParameterList=SdsTypeParameterList? + parameterList=SdsParameterList? + parentTypeList=SdsParentTypeList? + constraintList=SdsConstraintList? + body=SdsClassBody? +; + +interface SdsParentTypeList extends SdsObject { + parentTypes: SdsType[] +} + +SdsParentTypeList returns SdsParentTypeList: + 'sub' + parentTypes+=SdsParentType + (',' parentTypes+=SdsParentType)* + ','? +; + +interface SdsClassBody extends SdsObject { + members: SdsObject[] +} + +SdsClassBody returns SdsClassBody: + {SdsClassBody} '{' members+=SdsClassMember* '}' +; + +interface SdsClassMember extends SdsDeclaration, SdsObject {} + +SdsClassMember returns SdsObject: + SdsAnnotatedClassMember + | SdsUnannotatedClassMember +; + +SdsAnnotatedClassMember returns SdsAnnotatedObject: + {SdsAnnotationCallList} + annotationCalls+=SdsAnnotationCall+ + ( + {SdsAttribute.annotationCallList=current} + SdsAttributeFragment + + | {SdsClass.annotationCallList=current} + SdsClassFragment + + | {SdsEnum.annotationCallList=current} + SdsEnumFragment + + | {SdsFunction.annotationCallList=current} + static?='static'? + SdsFunctionFragment + ) +; + +SdsUnannotatedClassMember returns SdsAnnotatedObject: + {SdsAttribute} + SdsAttributeFragment + + | {SdsClass} + SdsClassFragment + + | {SdsEnum} + SdsEnumFragment + + | {SdsFunction} + static?='static'? + SdsFunctionFragment +; + +interface SdsAttribute extends SdsClassMember { + static: boolean + ^type?: SdsType +} + +fragment SdsAttributeFragment: + static?='static'? + 'attr' + name=ID + (':' ^type=SdsType)? +; + +interface SdsEnum extends SdsNamedTypeDeclaration, SdsClassMember, SdsModuleMember { + body?: SdsEnumBody +} + +fragment SdsEnumFragment: + 'enum' + name=ID + body=SdsEnumBody? +; + +interface SdsEnumBody extends SdsObject { + variants: SdsEnumVariant[] +} + +SdsEnumBody returns SdsEnumBody: + {SdsEnumBody} '{' variants+=SdsEnumVariant * '}' +; + +interface SdsEnumVariant extends SdsCallable, SdsNamedTypeDeclaration { + typeParameterList?: SdsTypeParameterList + constraintList?: SdsConstraintList +} + +SdsEnumVariant returns SdsEnumVariant: + annotationCalls+=SdsAnnotationCall* + name=ID + typeParameterList=SdsTypeParameterList? + parameterList=SdsParameterList? + constraintList=SdsConstraintList? +; + +interface SdsFunction extends SdsCallable, SdsClassMember, SdsModuleMember { + static: boolean + typeParameterList?: SdsTypeParameterList + resultList?: SdsResultList + constraintList?: SdsConstraintList +} + +fragment SdsFunctionFragment: + 'fun' + name=ID + typeParameterList=SdsTypeParameterList? + parameterList=SdsParameterList + resultList=SdsResultList? + constraintList=SdsConstraintList? +; + +interface SdsPipeline extends SdsModuleMember { + body: SdsBlock +} + +fragment SdsPipelineFragment: + 'pipeline' + name=ID + body=SdsBlock +; + +interface SdsSegment extends SdsCallable, SdsModuleMember { + visibility?: string + resultList?: SdsResultList + body: SdsBlock +} + +fragment SdsSegmentFragment: + visibility=('internal' | 'private')? + 'segment' + name=ID + parameterList=SdsParameterList + resultList=SdsResultList? + body=SdsBlock +; + + +// ----------------------------------------------------------------------------- +// Annotation calls +// ----------------------------------------------------------------------------- + +interface SdsAnnotationCallList extends SdsAnnotatedObject {} + +interface SdsAnnotationCall extends SdsAbstractCall { + annotation?: @SdsAnnotation +} + +SdsAnnotationCall returns SdsAnnotationCall: + '@' annotation=[SdsAnnotation:ID] argumentList=SdsAnnotationCallArgumentList? +; + +SdsAnnotationCallArgumentList returns SdsArgumentList: + {SdsArgumentList} '(' (arguments+=SdsAnnotationCallArgument (',' arguments+=SdsAnnotationCallArgument )* ','? )? ')' +; + +SdsAnnotationCallArgument returns SdsArgument: + (parameter=[SdsParameter:ID ] '=')? value=SdsExpression +; + + +// ----------------------------------------------------------------------------- +// Constraints +// ----------------------------------------------------------------------------- + +interface SdsConstraintList extends SdsObject { + constraints: SdsConstraint[] +} + +SdsConstraintList returns SdsConstraintList: + 'where' + '{' + ( + constraints+=SdsConstraint + (',' constraints+=SdsConstraint)* + ','? + )? + '}' +; + +interface SdsConstraint extends SdsObject {} + +SdsConstraint returns SdsConstraint: + SdsTypeParameterConstraint +; + +interface SdsTypeParameterConstraint extends SdsConstraint { + leftOperand: @SdsTypeParameter + operator: string + rightOperand: SdsType +} + +SdsTypeParameterConstraint returns SdsTypeParameterConstraint: + leftOperand=[SdsTypeParameter:ID] + operator=SdsTypeParameterConstraintOperator + rightOperand=SdsType +; + +SdsTypeParameterConstraintOperator returns string: + 'sub' | 'super' +; + + +// ----------------------------------------------------------------------------- +// Callables, parameters, and results +// ----------------------------------------------------------------------------- + +interface SdsCallable extends SdsObject { + parameterList: SdsParameterList +} + +interface SdsParameterList extends SdsObject { + parameters: SdsParameter[] +} + +SdsParameterList returns SdsParameterList: + {SdsParameterList} + '(' + ( + parameters+=SdsParameter + (',' parameters+=SdsParameter)* + ','? + )? + ')' +; + +interface SdsLambdaParameterList extends SdsExpression, SdsParameterList {} + +SdsLambdaParameterList returns SdsParameterList: + {SdsLambdaParameterList} + '(' + ( + parameters+=SdsParameter + (',' parameters+=SdsParameter)* + ','? + )? + ')' +; + +interface SdsParameter extends SdsLocalVariable { + variadic: boolean + ^type?: SdsType + defaultValue?: SdsExpression +} + +SdsParameter returns SdsParameter: + annotationCalls+=SdsAnnotationCall* + variadic?='vararg'? + name=ID + (':' ^type=SdsType)? + ('=' defaultValue=SdsExpression)? +; + +interface SdsResultList extends SdsObject { + results: SdsResult[] +} + +SdsResultList returns SdsResultList: + {SdsResultList} '->' results+=SdsResult + | {SdsResultList} '->' '(' (results+=SdsResult (',' results+=SdsResult)* ','? )? ')' +; + +interface SdsAbstractResult extends SdsDeclaration, SdsObject {} + +interface SdsResult extends SdsAbstractResult { + ^type?: SdsType +} + +SdsResult returns SdsResult: + annotationCalls+=SdsAnnotationCall* + name=ID + (':' ^type=SdsType)? +; + + +// ----------------------------------------------------------------------------- +// Statements +// ----------------------------------------------------------------------------- + +interface SdsStatement extends SdsObject {} + +interface SdsBlock extends SdsObject { + statements: SdsStatement[] +} + +SdsBlock returns SdsBlock: + {SdsBlock} '{' statements+=SdsStatement* '}' +; + +SdsStatement returns SdsStatement: + SdsAssignment + | SdsExpressionStatement +; + +interface SdsAssignment extends SdsStatement { + assigneeList?: SdsAssigneeList + expression?: SdsExpression +} + +SdsAssignment returns SdsAssignment: + assigneeList=SdsAssigneeList '=' expression=SdsExpression ';' +; + +interface SdsAssigneeList extends SdsObject { + assignees: SdsAssignee[] +} + +SdsAssigneeList returns SdsAssigneeList: + assignees+=SdsAssignee (',' assignees+=SdsAssignee )* ','? +; + +interface SdsAssignee extends SdsObject {} + +interface SdsPlaceholder extends SdsAssignee, SdsLocalVariable {} + +interface SdsWildcard extends SdsAssignee {} + +interface SdsYield extends SdsAssignee { + result?: @SdsResult +} + +SdsAssignee returns SdsAssignee: + {SdsPlaceholder} 'val' name=ID + | {SdsWildcard} '_' + | {SdsYield} 'yield' result=[SdsResult:ID] +; + +interface SdsExpressionStatement extends SdsStatement { + expression: SdsExpression +} + +SdsExpressionStatement returns SdsExpressionStatement: + expression=SdsExpression ';' +; + + +// ----------------------------------------------------------------------------- +// Expressions +// ----------------------------------------------------------------------------- + +interface SdsExpression extends SdsObject {} + +SdsExpression returns SdsExpression: + SdsLambda | SdsOrExpression +; + +interface SdsLambda extends SdsCallable, SdsExpression {} + +interface SdsBlockLambda extends SdsLambda { + body: SdsBlock +} + +interface SdsExpressionLambda extends SdsLambda { + result: SdsExpression +} + +SdsLambda returns SdsExpression: + SdsLambdaParameterList + ( + {SdsBlockLambda.parameterList=current} body=SdsBlockLambdaBlock + | {SdsExpressionLambda.parameterList=current} '->' result=SdsExpression + ) +; + +SdsBlockLambdaBlock returns SdsBlock: + {SdsBlock} '{' statements+=SdsBlockLambdaStatement* '}' +; + +SdsBlockLambdaStatement returns SdsStatement: + SdsBlockLambdaAssignment | SdsExpressionStatement +; + +SdsBlockLambdaAssignment returns SdsAssignment: + assigneeList=SdsBlockLambdaAssigneeList '=' expression=SdsExpression ';' +; + +SdsBlockLambdaAssigneeList returns SdsAssigneeList: + assignees+=SdsBlockLambdaAssignee (',' assignees+=SdsBlockLambdaAssignee )* ','? +; + +interface SdsBlockLambdaResult extends SdsAssignee, SdsAbstractResult {} + +SdsBlockLambdaAssignee returns SdsAssignee: + {SdsWildcard} '_' + | {SdsPlaceholder} 'val' name=ID + | {SdsBlockLambdaResult} 'yield' name=ID +; + +interface SdsInfixOperation extends SdsExpression { + leftOperand: SdsExpression + operator: string + rightOperand: SdsExpression +} + +interface SdsPrefixOperation extends SdsExpression { + operand: SdsExpression + operator: string +} + +SdsOrExpression returns SdsExpression: + SdsAndExpression + ( + {SdsInfixOperation.leftOperand=current} + operator='or' + rightOperand=SdsAndExpression + )* +; + +SdsAndExpression returns SdsExpression: + SdsNotExpression + ( + {SdsInfixOperation.leftOperand=current} + operator='and' + rightOperand=SdsNotExpression + )* +; + +SdsNotExpression returns SdsExpression: + {SdsPrefixOperation} operator='not' operand=SdsNotExpression + | SdsEqualityExpression +; + +SdsEqualityExpression returns SdsExpression: + SdsComparisonExpression + ( + {SdsInfixOperation.leftOperand=current} + operator=SdsEqualityOperator + rightOperand=SdsComparisonExpression + )? +; + +SdsEqualityOperator returns string: + '==' | '!=' | '===' | '!==' +; + +SdsComparisonExpression returns SdsExpression: + SdsAdditiveExpression + ( + {SdsInfixOperation.leftOperand=current} + operator=SdsComparisonOperator + rightOperand=SdsAdditiveExpression + )? +; + +SdsComparisonOperator returns string: + LESS_THAN | '<=' | '>=' | '>' +; + +SdsAdditiveExpression returns SdsExpression: + SdsMultiplicativeExpression + ( + {SdsInfixOperation.leftOperand=current} + operator=SdsAdditiveOperator + rightOperand=SdsMultiplicativeExpression + )* +; + +SdsAdditiveOperator returns string: + '+' | '-' +; + +SdsMultiplicativeExpression returns SdsExpression: + SdsElvisExpression + ( + {SdsInfixOperation.leftOperand=current} + operator=SdsMultiplicativeOperator + rightOperand=SdsElvisExpression + )* +; + +SdsMultiplicativeOperator returns string: + '*' | '/' +; + +SdsElvisExpression returns SdsExpression: + SdsUnaryOperation + ( + {SdsInfixOperation.leftOperand=current} + operator='?:' + rightOperand=SdsUnaryOperation + )* +; + +SdsUnaryOperation returns SdsExpression: + {SdsPrefixOperation} operator='-' operand=SdsUnaryOperation + | SdsChainedExpression +; + +interface SdsChainedExpression extends SdsExpression { + receiver: SdsExpression +} + +interface SdsCall extends SdsAbstractCall, SdsChainedExpression { + typeArgumentList?: SdsTypeArgumentList +} + +interface SdsIndexedAccess extends SdsChainedExpression { + index: SdsExpression +} + +interface SdsMemberAccess extends SdsChainedExpression { + nullSafe: boolean + member: SdsReference +} + +SdsChainedExpression returns SdsExpression: + SdsPrimaryExpression + ( + {SdsCall.receiver=current} + typeArgumentList=SdsCallTypeArgumentList? + argumentList=SdsCallArgumentList + + | {SdsIndexedAccess.receiver=current} + '[' index=SdsExpression ']' + + | {SdsMemberAccess.receiver=current} + (nullSafe?='?')? + '.' + member=SdsReference* + )* +; + +interface SdsArgumentList extends SdsObject { + arguments: SdsArgument[] +} + +SdsCallArgumentList returns SdsArgumentList: + {SdsArgumentList} + '(' + ( + arguments+=SdsCallArgument + (',' arguments+=SdsCallArgument)* + ','? + )? + ')' +; + +interface SdsArgument extends SdsExpression { + parameter?: @SdsParameter + value: SdsExpression +} + +SdsCallArgument returns SdsArgument: + (parameter=[SdsParameter:ID] '=')? value=SdsExpression +; + +SdsPrimaryExpression returns SdsExpression: + SdsLiteral + | SdsParenthesizedExpression + | SdsReference + | SdsTemplateString +; + +interface SdsLiteral extends SdsExpression {} + +SdsLiteral returns SdsLiteral: + SdsBoolean + | SdsFloat + | SdsInt + | SdsNull + | SdsString +; + +interface SdsBoolean extends SdsLiteral { + value: boolean +} + +SdsBoolean returns SdsBoolean: + value?='true' + | {SdsBoolean} 'false' +; + +interface SdsNumber extends SdsLiteral, SdsExpression {} + +interface SdsFloat extends SdsNumber { + value: number +} + +SdsFloat returns SdsFloat: + value=FLOAT +; + +interface SdsInt extends SdsNumber { + value: number +} + +SdsInt returns SdsInt: + value=INT +; + +interface SdsNull extends SdsLiteral {} + +SdsNull returns SdsNull: + {SdsNull} 'null' +; + +interface SdsString extends SdsLiteral { + value: string +} + +SdsString returns SdsString: + value=STRING +; + +interface SdsReference extends SdsExpression { + declaration?: @SdsDeclaration +} + +SdsReference returns SdsReference: + declaration=[SdsDeclaration:ID] +; + +interface SdsParenthesizedExpression extends SdsExpression { + expression: SdsExpression +} + +SdsParenthesizedExpression returns SdsParenthesizedExpression: + '(' expression=SdsExpression ')' +; + +interface SdsTemplateString extends SdsExpression { + expressions: SdsExpression[] +} + +SdsTemplateString returns SdsTemplateString: + expressions+=SdsTemplateStringStart + expressions+=SdsExpression? + (expressions+=SdsTemplateStringInner expressions+=SdsExpression?)* + expressions+=SdsTemplateStringEnd +; + +interface SdsTemplateStringPart extends SdsExpression, SdsLiteral { + value: string +} + +interface SdsTemplateStringStart extends SdsTemplateStringPart {} + +SdsTemplateStringStart returns SdsExpression: + {SdsTemplateStringStart} + value=TEMPLATE_STRING_START +; + +interface SdsTemplateStringInner extends SdsTemplateStringPart {} + +SdsTemplateStringInner returns SdsExpression: + {SdsTemplateStringInner} + value=TEMPLATE_STRING_INNER +; + +interface SdsTemplateStringEnd extends SdsTemplateStringPart {} + +SdsTemplateStringEnd returns SdsExpression: + {SdsTemplateStringEnd} + value=TEMPLATE_STRING_END +; + + +// ----------------------------------------------------------------------------- +// Types +// ----------------------------------------------------------------------------- + +interface SdsType extends SdsObject {} + +interface SdsNamedTypeDeclaration extends SdsDeclaration, SdsObject {} + +interface SdsMemberType extends SdsType { + member: SdsNamedType + receiver: SdsType +} + +SdsType returns SdsType: + SdsPrimaryType ({SdsMemberType.receiver=current} '.' member=SdsNamedType)* +; + +SdsPrimaryType returns SdsType: + SdsCallableType + | SdsNamedType + | SdsUnionType +; + +interface SdsCallableType extends SdsCallable, SdsType { + resultList: SdsResultList +} + +SdsCallableType returns SdsCallableType: + parameterList=SdsParameterList + resultList=SdsResultList +; + +interface SdsNamedType extends SdsType { + declaration: @SdsNamedTypeDeclaration + typeArgumentList?: SdsTypeArgumentList + nullable: boolean +} + +SdsNamedType returns SdsNamedType: + declaration=[SdsNamedTypeDeclaration:ID] + typeArgumentList=SdsTypeArgumentList? + (nullable?='?' )? +; + +interface SdsUnionType extends SdsType { + typeArgumentList: SdsTypeArgumentList +} + +SdsUnionType returns SdsUnionType: + 'union' typeArgumentList=SdsUnionTypeArgumentList +; + +SdsUnionTypeArgumentList returns SdsTypeArgumentList: + {SdsTypeArgumentList} + (LESS_THAN | CALL_TYPE_ARGUMENT_LIST_START) + ( + typeArguments+=SdsUnionTypeArgument + (',' typeArguments+=SdsUnionTypeArgument)* + ','? + )? + '>' +; + +SdsUnionTypeArgument returns SdsTypeArgument: + value=SdsUnionTypeArgumentValue +; + +SdsUnionTypeArgumentValue returns SdsTypeArgumentValue: + {SdsTypeProjection} ^type=SdsType +; + +SdsParentType returns SdsType: + SdsNamedType ({SdsMemberType.receiver=current} '.' member=SdsNamedType)* +; + +interface SdsTypeParameterList extends SdsObject { + typeParameters: SdsTypeParameter[] +} + +SdsTypeParameterList returns SdsTypeParameterList: + {SdsTypeParameterList} + (LESS_THAN | CALL_TYPE_ARGUMENT_LIST_START) + ( + typeParameters+=SdsTypeParameter + (',' typeParameters+=SdsTypeParameter)* + ','? + )? + '>' +; + +interface SdsTypeParameter extends SdsNamedTypeDeclaration { + variance?: string +} + +SdsTypeParameter returns SdsTypeParameter: + annotationCalls+=SdsAnnotationCall* + variance=SdsTypeParameterVariance? + name=ID +; + +SdsTypeParameterVariance returns string: + 'in' | 'out' +; + +interface SdsTypeArgumentList extends SdsObject { + typeArguments: SdsTypeArgument[] +} + +SdsTypeArgumentList returns SdsTypeArgumentList: + {SdsTypeArgumentList} + (LESS_THAN | CALL_TYPE_ARGUMENT_LIST_START) + (typeArguments+=SdsTypeArgument (',' typeArguments+=SdsTypeArgument)* ','? )? + '>' +; + +SdsCallTypeArgumentList returns SdsTypeArgumentList: + {SdsTypeArgumentList} + CALL_TYPE_ARGUMENT_LIST_START + (typeArguments+=SdsTypeArgument (',' typeArguments+=SdsTypeArgument)* ','? )? + '>' +; + +interface SdsTypeArgument extends SdsObject { + typeParameter?: @SdsTypeParameter + value: SdsTypeArgumentValue +} + +SdsTypeArgument returns SdsTypeArgument: + (typeParameter=[SdsTypeParameter:ID] '=' )? + value=SdsTypeArgumentValue +; + +interface SdsTypeArgumentValue extends SdsObject {} + +interface SdsStarProjection extends SdsTypeArgumentValue {} + +interface SdsTypeProjection extends SdsTypeArgumentValue { + variance?: string + ^type: SdsType +} + +SdsTypeArgumentValue returns SdsTypeArgumentValue: + {SdsStarProjection} '*' + | {SdsTypeProjection} variance=SdsTypeParameterVariance? ^type=SdsType +; + + +// ----------------------------------------------------------------------------- +// Schemas +// ----------------------------------------------------------------------------- + +interface SdsSchema extends SdsModuleMember { + columnList: SdsColumnList +} + +fragment SdsSchemaFragment: + 'schema' + name=ID + columnList=SdsColumnList +; + +interface SdsColumnList extends SdsObject { + columns: SdsColumn[] +} + +SdsColumnList returns SdsColumnList: + {SdsColumnList} '{' (columns+=SdsColumn (',' columns+=SdsColumn )* ','? )? '}' +; + +interface SdsColumn extends SdsObject { + columnName: SdsString + columnType: SdsType +} + +SdsColumn returns SdsColumn: + columnName=SdsString ":" columnType=SdsType +; + + +// ----------------------------------------------------------------------------- +// Terminals +// ----------------------------------------------------------------------------- + +terminal ID returns string: IDENTIFIER | '`' IDENTIFIER '`'; +terminal fragment IDENTIFIER: /[_a-zA-Z][_a-zA-Z0-9]*/; + +terminal FLOAT returns number + : DECIMAL_DIGIT+ '.' DECIMAL_DIGIT+ FLOAT_EXPONENT? + | DECIMAL_DIGIT+ FLOAT_EXPONENT; +terminal fragment DECIMAL_DIGIT: /[0-9]/; +terminal fragment FLOAT_EXPONENT: ('e' | 'E' )('+' | '-' )? DECIMAL_DIGIT+; +terminal INT returns number: DECIMAL_DIGIT+; +terminal STRING returns string: STRING_START STRING_TEXT* STRING_END; +terminal fragment STRING_START: STRING_DELIMITER; +terminal fragment STRING_END: '{'? STRING_DELIMITER; +terminal fragment STRING_DELIMITER: '"'; +terminal fragment STRING_TEXT + : '{'? ESCAPE_SEQUENCE + | /{?[^\\"{]/ +; +terminal fragment ESCAPE_SEQUENCE: '\\' .; +terminal fragment TEMPLATE_EXPRESSION_START: '{{'; +terminal fragment TEMPLATE_EXPRESSION_END: '}}'; +terminal TEMPLATE_STRING_START returns string: STRING_START STRING_TEXT* TEMPLATE_EXPRESSION_START; +terminal TEMPLATE_STRING_INNER returns string: TEMPLATE_EXPRESSION_END STRING_TEXT* TEMPLATE_EXPRESSION_START; +terminal TEMPLATE_STRING_END returns string: TEMPLATE_EXPRESSION_END STRING_TEXT* STRING_END; + +// Resolves the ambiguity between the less than operator (<) and the start of a type argument list of a call (<). +// See also: https://github.com/langium/langium/discussions/921#discussioncomment-4943180 +terminal CALL_TYPE_ARGUMENT_LIST_START: + '<' + (?= + /\s*/ + ( '*' // Star projection as positional type argument + | 'in' // Contravariant type projection as positional type argument + | 'out' // Covariant type projection as positional type argument + | 'union' // Invariant union type as positional type argument + | '>' // Empty type argument list + | ID /\s*/ + ( '=' // Named type argument + | ('.' /\s*/ ID /\s*/)* (',' | '>') // Invariant type projection as positional type argument + ) + ) + ) +; +terminal LESS_THAN: + '<' +; + +hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//; +hidden terminal SL_COMMENT: /\/\/[^\n\r]*/; +hidden terminal TEST_MARKER: /[»«]/; +hidden terminal WS: /\s+/; diff --git a/DSL/src/language-server/helpers/astShortcuts.ts b/DSL/src/language-server/helpers/astShortcuts.ts new file mode 100644 index 000000000..6301f9a46 --- /dev/null +++ b/DSL/src/language-server/helpers/astShortcuts.ts @@ -0,0 +1,26 @@ +// SdsAbstractDeclaration -------------------------------------------------------------------------- +import { + isSdsDeclaration, + SdsAnnotatedObject, + SdsAnnotationCall, + SdsClass, + SdsObject, + SdsTypeArgument, + SdsTypeArgumentList, +} from '../generated/ast'; + +export const annotationCallsOrEmpty = function (node: SdsAnnotatedObject): SdsAnnotationCall[] { + if (isSdsDeclaration(node)) { + return node?.annotationCallList?.annotationCalls ?? node?.annotationCalls ?? []; + } else { + return node?.annotationCalls ?? []; + } +}; + +export const classMembersOrEmpty = function (node: SdsClass): SdsObject[] { + return node.body?.members ?? []; +}; + +export const typeArgumentsOrEmpty = function (node: SdsTypeArgumentList | undefined): SdsTypeArgument[] { + return node?.typeArguments ?? []; +}; diff --git a/DSL-langium/src/language-server/main.ts b/DSL/src/language-server/main.ts similarity index 97% rename from DSL-langium/src/language-server/main.ts rename to DSL/src/language-server/main.ts index 787e6b18b..2669ef6ef 100644 --- a/DSL-langium/src/language-server/main.ts +++ b/DSL/src/language-server/main.ts @@ -7,6 +7,7 @@ import { createSafeDsServices } from './safe-ds-module'; const connection = createConnection(ProposedFeatures.all); // Inject the shared services and language-specific services +// @ts-ignore const { shared } = createSafeDsServices({ connection, ...NodeFileSystem }); // Start the language server with the shared services diff --git a/DSL-langium/src/language-server/safe-ds-module.ts b/DSL/src/language-server/safe-ds-module.ts similarity index 94% rename from DSL-langium/src/language-server/safe-ds-module.ts rename to DSL/src/language-server/safe-ds-module.ts index 744db53b2..9c69eef26 100644 --- a/DSL-langium/src/language-server/safe-ds-module.ts +++ b/DSL/src/language-server/safe-ds-module.ts @@ -10,6 +10,7 @@ import { } from 'langium'; import { SafeDsGeneratedModule, SafeDsGeneratedSharedModule } from './generated/module'; import { SafeDsValidator, registerValidationChecks } from './validation/safe-ds-validator'; +import { SafeDSFormatter } from './formatting/safe-ds-formatter'; /** * Declaration of custom services - add your own service classes here. @@ -32,6 +33,9 @@ export type SafeDsServices = LangiumServices & SafeDsAddedServices; * selected services, while the custom services must be fully specified. */ export const SafeDsModule: Module = { + lsp: { + Formatter: () => new SafeDSFormatter(), + }, validation: { SafeDsValidator: () => new SafeDsValidator(), }, diff --git a/DSL-langium/src/language-server/validation/safe-ds-validator.ts b/DSL/src/language-server/validation/safe-ds-validator.ts similarity index 100% rename from DSL-langium/src/language-server/validation/safe-ds-validator.ts rename to DSL/src/language-server/validation/safe-ds-validator.ts diff --git a/DSL/syntaxes/safe-ds.tmLanguage.json b/DSL/syntaxes/safe-ds.tmLanguage.json new file mode 100644 index 000000000..44789e2b4 --- /dev/null +++ b/DSL/syntaxes/safe-ds.tmLanguage.json @@ -0,0 +1,78 @@ +{ + "name": "safe-ds", + "scopeName": "source.safe-ds", + "fileTypes": [ + ".sdspipe", + ".sdsstub", + ".sdstest" + ], + "patterns": [ + { + "include": "#comments" + }, + { + "name": "keyword.control.safe-ds", + "match": "\\b(and|annotation|as|attr|class|enum|false|fun|import|in|internal|not|null|or|out|package|pipeline|private|schema|segment|static|sub|super|true|union|val|vararg|where|yield)\\b" + }, + { + "name": "string.quoted.double.safe-ds", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "include": "#string-character-escape" + } + ] + } + ], + "repository": { + "comments": { + "patterns": [ + { + "name": "comment.block.safe-ds", + "begin": "/\\*", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.safe-ds" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.safe-ds" + } + } + }, + { + "begin": "//", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.safe-ds" + } + }, + "end": "(?=$)", + "name": "comment.line.safe-ds" + }, + { + "name": "comment.block.safe-ds", + "begin": "[»«]", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.safe-ds" + } + }, + "end": "[»«]", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.safe-ds" + } + } + } + ] + }, + "string-character-escape": { + "name": "constant.character.escape.safe-ds", + "match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\\{[0-9A-Fa-f]+\\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)" + } + } +} diff --git a/DSL/tests/formatting/testFormatter.test.ts b/DSL/tests/formatting/testFormatter.test.ts new file mode 100644 index 000000000..fa6df4463 --- /dev/null +++ b/DSL/tests/formatting/testFormatter.test.ts @@ -0,0 +1,93 @@ +import { createSafeDsServices } from '../../src/language-server/safe-ds-module'; +import { expectFormatting, validationHelper } from 'langium/test'; +import { describe, it } from 'vitest'; +import { EmptyFileSystem } from 'langium'; +import { listTestResources, resolvePathRelativeToResources } from '../helpers/testResources'; +import path from 'path'; +import fs from 'fs'; +import { Diagnostic } from 'vscode-languageserver-types'; + +const services = createSafeDsServices({ ...EmptyFileSystem }).SafeDs; +const separator = '// -----------------------------------------------------------------------------'; + +describe('formatter', async () => { + it.each(await createFormatterTest())('$testName', async (test) => { + if (test.error) { + throw test.error; + } + + await expectFormatting(services)({ + before: test.originalCode, + after: test.expectedFormattedCode, + }); + }); +}); + +const createFormatterTest = async (): Promise => { + const testCases = listTestResources('formatting').map(async (pathRelativeToResources): Promise => { + const absolutePath = resolvePathRelativeToResources(path.join('formatting', pathRelativeToResources)); + const program = fs.readFileSync(absolutePath).toString(); + const parts = program.split(separator); + + // Must contain exactly one separator + if (parts.length !== 2) { + return { + testName: `INVALID TEST FILE [${pathRelativeToResources}]`, + originalCode: '', + expectedFormattedCode: '', + error: new SeparatorError(parts.length - 1), + }; + } + + // Original code must not contain syntax errors + const originalCode = normalizeLineBreaks(parts[0]).trimEnd(); + const expectedFormattedCode = normalizeLineBreaks(parts[1]).trim(); + + const validationResult = await validationHelper(services)(parts[0]); + const syntaxErrors = validationResult.diagnostics.filter( + (d) => d.severity === 1 && (d.code === 'lexing-error' || d.code === 'parsing-error'), + ); + + if (syntaxErrors.length > 0) { + return { + testName: `INVALID TEST FILE [${pathRelativeToResources}]`, + originalCode, + expectedFormattedCode, + error: new SyntaxErrorsInOriginalCodeError(syntaxErrors), + }; + } + + return { + testName: `${pathRelativeToResources} should be formatted correctly`, + originalCode, + expectedFormattedCode, + }; + }); + + return Promise.all(testCases); +}; + +const normalizeLineBreaks = (code: string): string => { + return code.replace(/\r\n?/gu, '\n'); +}; + +interface FormatterTest { + testName: string; + originalCode: string; + expectedFormattedCode: string; + error?: Error; +} + +class SeparatorError extends Error { + constructor(readonly number_of_separators: number) { + super(`Expected exactly one separator but found ${number_of_separators}.`); + } +} + +class SyntaxErrorsInOriginalCodeError extends Error { + constructor(readonly syntaxErrors: Diagnostic[]) { + const syntaxErrorsAsString = syntaxErrors.map((e) => `- ${e.message}`).join(`\n`); + + super(`Original code has syntax errors:\n${syntaxErrorsAsString}`); + } +} diff --git a/DSL/tests/grammar/testGrammar.test.ts b/DSL/tests/grammar/testGrammar.test.ts new file mode 100644 index 000000000..eb14cc879 --- /dev/null +++ b/DSL/tests/grammar/testGrammar.test.ts @@ -0,0 +1,124 @@ +import { listTestResources, resolvePathRelativeToResources } from '../helpers/testResources'; +import { describe, it } from 'vitest'; +import { NoCommentsError } from '../helpers/testChecks'; +import fs from 'fs'; +import { findTestComments } from '../helpers/testComments'; +import path from 'path'; +import { createSafeDsServices } from '../../src/language-server/safe-ds-module'; +import { NodeFileSystem } from 'langium/node'; +import { URI } from 'vscode-uri'; +import { AssertionError } from 'assert'; + +const services = createSafeDsServices(NodeFileSystem).SafeDs; + +describe('grammar', () => { + it.each(createGrammarTests())('$testName', async (test) => { + if (test.error) { + throw test.error; + } + + const document = services.shared.workspace.LangiumDocuments.getOrCreateDocument(URI.file(test.absolutePath)); + await services.shared.workspace.DocumentBuilder.build([document], { validationChecks: 'all' }); + + const diagnostics = document.diagnostics; + if (!diagnostics) { + throw new Error('No diagnostics found'); + } + + const syntaxErrors = diagnostics.filter( + (d) => d.severity === 1 && (d.code === 'lexing-error' || d.code === 'parsing-error'), + ); + + if (test.expectedResult === 'syntax_error') { + if (syntaxErrors.length === 0) { + throw new AssertionError({ + message: 'Expected syntax errors but found none.', + actual: syntaxErrors, + expected: [], + }); + } + } + + if (test.expectedResult === 'no_syntax_error') { + if (syntaxErrors.length > 0) { + throw new AssertionError({ + message: 'Expected no syntax errors but found some.', + actual: syntaxErrors, + expected: [], + }); + } + } + }); +}); + +const createGrammarTests = (): GrammarTest[] => { + return listTestResources('grammar').map((pathRelativeToResources): GrammarTest => { + const absolutePath = resolvePathRelativeToResources(path.join('grammar', pathRelativeToResources)); + const program = fs.readFileSync(absolutePath).toString(); + const comments = findTestComments(program); + + // Must contain at least one comment + if (comments.length === 0) { + return { + absolutePath, + expectedResult: 'invalid', + testName: `INVALID TEST FILE [${pathRelativeToResources}]`, + error: new NoCommentsError(), + }; + } + + // Must contain no more than one comment + if (comments.length > 1) { + return { + absolutePath, + expectedResult: 'invalid', + testName: `INVALID TEST FILE [${pathRelativeToResources}]`, + error: new MultipleCommentsError(comments), + }; + } + + const comment = comments[0]; + + // Must contain a valid comment + if (comment !== 'syntax_error' && comment !== 'no_syntax_error') { + return { + absolutePath, + expectedResult: 'invalid', + testName: `INVALID TEST FILE [${pathRelativeToResources}]`, + error: new InvalidCommentError(comment), + }; + } + + let testName: string; + if (comment === 'syntax_error') { + testName = `[${pathRelativeToResources}] should have syntax errors`; + } else { + testName = `[${pathRelativeToResources}] should not have syntax errors`; + } + + return { + absolutePath, + expectedResult: comment, + testName, + }; + }); +}; + +interface GrammarTest { + absolutePath: string; + expectedResult: 'syntax_error' | 'no_syntax_error' | 'invalid'; + testName: string; + error?: Error; +} + +class MultipleCommentsError extends Error { + constructor(readonly comments: string[]) { + super(`Found multiple test comments (grammar tests expect only one): ${comments}`); + } +} + +class InvalidCommentError extends Error { + constructor(readonly comment: string) { + super(`Invalid test comment (valid values are 'syntax_error' and 'no_syntax_error'): ${comment}`); + } +} diff --git a/DSL-langium/tests/helpers/testChecks.test.ts b/DSL/tests/helpers/testChecks.test.ts similarity index 100% rename from DSL-langium/tests/helpers/testChecks.test.ts rename to DSL/tests/helpers/testChecks.test.ts diff --git a/DSL-langium/tests/helpers/testChecks.ts b/DSL/tests/helpers/testChecks.ts similarity index 98% rename from DSL-langium/tests/helpers/testChecks.ts rename to DSL/tests/helpers/testChecks.ts index 9272fef6d..8b2b904d7 100644 --- a/DSL-langium/tests/helpers/testChecks.ts +++ b/DSL/tests/helpers/testChecks.ts @@ -34,7 +34,7 @@ export const findTestChecks = (program: string): Result { + it('should yield all Safe-DS files in a directory that are not skipped', () => { + const result = listTestResources('helpers/listTestResources') + .map((path) => path.replace(/\\/gu, '/')) + .sort(); + const expected = [ + 'pipeline file.sdspipe', + 'stub file.sdsstub', + 'test file.sdstest', + 'nested/pipeline file.sdspipe', + 'nested/stub file.sdsstub', + 'nested/test file.sdstest', + ].sort(); + expect(result).toStrictEqual(expected); + }); +}); diff --git a/DSL/tests/helpers/testResources.ts b/DSL/tests/helpers/testResources.ts new file mode 100644 index 000000000..3805e3a11 --- /dev/null +++ b/DSL/tests/helpers/testResources.ts @@ -0,0 +1,39 @@ +import path from 'path'; +import { globSync } from 'glob'; +import { + PIPELINE_FILE_EXTENSION, + STUB_FILE_EXTENSION, + TEST_FILE_EXTENSION, +} from '../../src/language-server/constant/fileExtensions'; + +const resourcesPath = path.join(__dirname, '..', 'resources'); + +/** + * Resolves the given path relative to `tests/resources/`. + * + * @param pathRelativeToResources The path relative to `tests/resources/`. + * @return The resolved absolute path. + */ +export const resolvePathRelativeToResources = (pathRelativeToResources: string) => { + return path.join(resourcesPath, pathRelativeToResources); +}; + +/** + * Lists all Safe-DS files in the given directory relative to `tests/resources/` except those that have a name starting + * with 'skip'. + * + * @param pathRelativeToResources The root directory relative to `tests/resources/`. + * @return Paths to the Safe-DS files relative to `pathRelativeToResources`. + */ +export const listTestResources = (pathRelativeToResources: string): string[] => { + const fileExtensions = [PIPELINE_FILE_EXTENSION, STUB_FILE_EXTENSION, TEST_FILE_EXTENSION]; + const pattern = `**/*.{${fileExtensions.join(',')}}`; + const cwd = resolvePathRelativeToResources(pathRelativeToResources); + + return globSync(pattern, { cwd, nodir: true }).filter(isNotSkipped); +}; + +const isNotSkipped = (pathRelativeToResources: string) => { + const segments = pathRelativeToResources.split(path.sep); + return !segments.some((segment) => segment.startsWith('skip')); +}; diff --git a/DSL/tests/resources/formatting/comments/before declarations.sdstest b/DSL/tests/resources/formatting/comments/before declarations.sdstest new file mode 100644 index 000000000..48f6b4814 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before declarations.sdstest @@ -0,0 +1,8 @@ +// test + +class C + +// ----------------------------------------------------------------------------- + +// test +class C diff --git a/DSL/tests/resources/formatting/comments/before imports.sdstest b/DSL/tests/resources/formatting/comments/before imports.sdstest new file mode 100644 index 000000000..e3f919432 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before imports.sdstest @@ -0,0 +1,8 @@ +// test + +import test + +// ----------------------------------------------------------------------------- + +// test +import test diff --git a/DSL/tests/resources/formatting/comments/before module annotations.sdstest b/DSL/tests/resources/formatting/comments/before module annotations.sdstest new file mode 100644 index 000000000..df48ef4d6 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before module annotations.sdstest @@ -0,0 +1,8 @@ +// test + +@Annotation + +// ----------------------------------------------------------------------------- + +// test +@Annotation diff --git a/DSL/tests/resources/formatting/comments/before module name.sdstest b/DSL/tests/resources/formatting/comments/before module name.sdstest new file mode 100644 index 000000000..375fe08f7 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before module name.sdstest @@ -0,0 +1,8 @@ +// test + +package test + +// ----------------------------------------------------------------------------- + +// test +package test diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest new file mode 100644 index 000000000..6d69262d6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest @@ -0,0 +1,11 @@ +@A( + f(), + 2 +) + +// ----------------------------------------------------------------------------- + +@A( + f(), + 2 +) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list.sdstest new file mode 100644 index 000000000..f4a31456b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list.sdstest @@ -0,0 +1,8 @@ +@A( f() , 2 ) + +// ----------------------------------------------------------------------------- + +@A( + f(), + 2 +) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/empty argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/empty argument list.sdstest new file mode 100644 index 000000000..0b066997a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/empty argument list.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( ) + +// ----------------------------------------------------------------------------- + +@Annotation() diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/long argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/long argument list.sdstest new file mode 100644 index 000000000..a6d92ecd0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/long argument list.sdstest @@ -0,0 +1,10 @@ +@A( 1 , 2 , 3 , 4 ) + +// ----------------------------------------------------------------------------- + +@A( + 1, + 2, + 3, + 4 +) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/multiple arguments.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/multiple arguments.sdstest new file mode 100644 index 000000000..1806ee099 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/multiple arguments.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( 1 , a = 2 ) + +// ----------------------------------------------------------------------------- + +@Annotation(1, a = 2) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/named argument.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/named argument.sdstest new file mode 100644 index 000000000..f04f337b9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/named argument.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( b = 2 ) + +// ----------------------------------------------------------------------------- + +@Annotation(b = 2) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/no argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/no argument list.sdstest new file mode 100644 index 000000000..8c92de681 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/no argument list.sdstest @@ -0,0 +1,5 @@ +@ Annotation + +// ----------------------------------------------------------------------------- + +@Annotation diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/positional argument.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/positional argument.sdstest new file mode 100644 index 000000000..f747c346c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/positional argument.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( 1 ) + +// ----------------------------------------------------------------------------- + +@Annotation(1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/annotations/annotation call.sdstest new file mode 100644 index 000000000..a385b814e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/annotation call.sdstest @@ -0,0 +1,12 @@ +package test + +@Annotation + +annotation MyAnnotation + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +annotation MyAnnotation diff --git a/DSL/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..d597db58e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +annotation A( + a: A.B, + b: Int +) + +// ----------------------------------------------------------------------------- + +annotation A( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list.sdstest new file mode 100644 index 000000000..f7628dd84 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list.sdstest @@ -0,0 +1,8 @@ +annotation A( a: A.B , b: Int ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/empty parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/empty parameter list.sdstest new file mode 100644 index 000000000..394e945c2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/empty parameter list.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation() diff --git a/DSL/tests/resources/formatting/declarations/annotations/full.sdstest b/DSL/tests/resources/formatting/declarations/annotations/full.sdstest new file mode 100644 index 000000000..2db8cb0cc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/full.sdstest @@ -0,0 +1,29 @@ +package test + +@Annotation1 + +@Annotation2 + + annotation MyAnnotation ( + @Annotation3 a : Int , + vararg b : Int = 3 + ) +where { + T2 super Number , + T3 sub Number + } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation1 +@Annotation2 +annotation MyAnnotation( + @Annotation3 + a: Int, + vararg b: Int = 3 +) where { + T2 super Number, + T3 sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/long parameter list.sdstest new file mode 100644 index 000000000..066329102 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/long parameter list.sdstest @@ -0,0 +1,10 @@ +annotation A( a: Int , b: Int , c: Int , d: Int ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: Int, + b: Int, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest new file mode 100644 index 000000000..d853a481c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest @@ -0,0 +1,33 @@ +annotation MyAnnotation ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/no parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/no parameter list.sdstest new file mode 100644 index 000000000..0de8ec591 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/no parameter list.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation diff --git a/DSL/tests/resources/formatting/declarations/annotations/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with multiple constraints.sdstest new file mode 100644 index 000000000..f0d5b0688 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with multiple constraints.sdstest @@ -0,0 +1,12 @@ +annotation MyAnnotation where { + T sub Number , + + S super Number + } + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with sub constraint.sdstest new file mode 100644 index 000000000..c9de91be8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with sub constraint.sdstest @@ -0,0 +1,9 @@ +annotation MyAnnotation where { + T sub Number + } + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation where { + T sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with super constraint.sdstest new file mode 100644 index 000000000..c5cb246ba --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with super constraint.sdstest @@ -0,0 +1,9 @@ +annotation MyAnnotation where { + T super Number + } + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation where { + T super Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed optional parameter.sdstest new file mode 100644 index 000000000..d7f259be5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed required parameter.sdstest new file mode 100644 index 000000000..0d855efdc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a : Int ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a: Int) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..d4d79500c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest new file mode 100644 index 000000000..789d7b355 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a : Int ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a: Int) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped optional parameter.sdstest new file mode 100644 index 000000000..c9a973832 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped required parameter.sdstest new file mode 100644 index 000000000..f622292c7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..423b92fef --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..998951649 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a) diff --git a/DSL/tests/resources/formatting/declarations/classes/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/annotated type parameter.sdstest new file mode 100644 index 000000000..803898a6b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/annotated type parameter.sdstest @@ -0,0 +1,8 @@ +class MyClass < @Annotation T > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + T +> diff --git a/DSL/tests/resources/formatting/declarations/classes/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/annotation call.sdstest new file mode 100644 index 000000000..692ab4668 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation class MyClass + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/annotated.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/annotated.sdstest new file mode 100644 index 000000000..af1e2dad3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/annotated.sdstest @@ -0,0 +1,10 @@ +class MyClass { + @Annotation attr a +} + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + attr a +} diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/no type.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/no type.sdstest new file mode 100644 index 000000000..6a01b4578 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/no type.sdstest @@ -0,0 +1,9 @@ +class MyClass { + attr a +} + +// ----------------------------------------------------------------------------- + +class MyClass { + attr a +} diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/static.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/static.sdstest new file mode 100644 index 000000000..c5b44b3df --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/static.sdstest @@ -0,0 +1,9 @@ +class MyClass { + static attr a : Int +} + +// ----------------------------------------------------------------------------- + +class MyClass { + static attr a: Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/with type.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/with type.sdstest new file mode 100644 index 000000000..7e5a6ec5c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/with type.sdstest @@ -0,0 +1,9 @@ +class MyClass { + attr a : Int +} + +// ----------------------------------------------------------------------------- + +class MyClass { + attr a: Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..311595c15 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +class C( + a: A.B, + b: Int +) + +// ----------------------------------------------------------------------------- + +class C( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/classes/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/complex parameter list.sdstest new file mode 100644 index 000000000..9023c5ec2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/complex parameter list.sdstest @@ -0,0 +1,8 @@ +class C( a: A.B , b: Int ) + +// ----------------------------------------------------------------------------- + +class C( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..fde132974 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +class MyClass < @Annotation in T > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + in T +> diff --git a/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter.sdstest new file mode 100644 index 000000000..1d6efc467 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass < in T > + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..4e4d6949c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +class MyClass < @Annotation out T > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + out T +> diff --git a/DSL/tests/resources/formatting/declarations/classes/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter.sdstest new file mode 100644 index 000000000..43febd0f9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass < out T > + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/empty body.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty body.sdstest new file mode 100644 index 000000000..aa8773209 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty body.sdstest @@ -0,0 +1,5 @@ +class MyClass { } + +// ----------------------------------------------------------------------------- + +class MyClass {} diff --git a/DSL/tests/resources/formatting/declarations/classes/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty constraint list.sdstest new file mode 100644 index 000000000..cc46fbac7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty constraint list.sdstest @@ -0,0 +1,5 @@ +class MyClass where { } + +// ----------------------------------------------------------------------------- + +class MyClass where {} diff --git a/DSL/tests/resources/formatting/declarations/classes/empty parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty parameter list.sdstest new file mode 100644 index 000000000..a26e2fce8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty parameter list.sdstest @@ -0,0 +1,5 @@ +class MyClass ( ) + +// ----------------------------------------------------------------------------- + +class MyClass() diff --git a/DSL/tests/resources/formatting/declarations/classes/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty type parameter list.sdstest new file mode 100644 index 000000000..ddd2f5d9b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty type parameter list.sdstest @@ -0,0 +1,5 @@ +class MyClass < > + +// ----------------------------------------------------------------------------- + +class MyClass<> diff --git a/DSL/tests/resources/formatting/declarations/classes/full body.sdstest b/DSL/tests/resources/formatting/declarations/classes/full body.sdstest new file mode 100644 index 000000000..1b1ce7205 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/full body.sdstest @@ -0,0 +1,65 @@ +class MyClass { + + @Annotation + + static attr a: Int + + + attr b: String + + + @Annotation + + class InnerClass { + + @Annotation + + fun h() + + + @Annotation + + attr c: Int + + } + + + @Annotation + + enum E {} + + + @Annotation + + static fun f() + + + fun g() + + } + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + static attr a: Int + + attr b: String + + @Annotation + class InnerClass { + @Annotation + fun h() + + @Annotation + attr c: Int + } + + @Annotation + enum E {} + + @Annotation + static fun f() + + fun g() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/invariant type parameter.sdstest new file mode 100644 index 000000000..99534b071 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/invariant type parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass < T > + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/long parameter list.sdstest new file mode 100644 index 000000000..e34baf9e1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/long parameter list.sdstest @@ -0,0 +1,10 @@ +class C( a: Int , b: Int , c: Int , d: Int ) + +// ----------------------------------------------------------------------------- + +class C( + a: Int, + b: Int, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest new file mode 100644 index 000000000..9082a2494 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +class C< + K, + V, + X, + Y +> + +// ----------------------------------------------------------------------------- + +class C< + K, + V, + X, + Y +> diff --git a/DSL/tests/resources/formatting/declarations/classes/long type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/long type parameter list.sdstest new file mode 100644 index 000000000..83dc16b67 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/long type parameter list.sdstest @@ -0,0 +1,10 @@ +class C< K , V , X , Y > + +// ----------------------------------------------------------------------------- + +class C< + K, + V, + X, + Y +> diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/annotated type parameter.sdstest new file mode 100644 index 000000000..b965067aa --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/annotated type parameter.sdstest @@ -0,0 +1,12 @@ +class MyClass { + fun myFunction < @Annotation T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + T + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/annotation call.sdstest new file mode 100644 index 000000000..156742cf9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/annotation call.sdstest @@ -0,0 +1,10 @@ +class MyClass { + @Annotation fun myFunction ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..d3049b416 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyClass { + fun myFunction < @Annotation in T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + in T + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter.sdstest new file mode 100644 index 000000000..b0672b049 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < in T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..a31c7e82f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyClass { + fun myFunction < @Annotation out T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + out T + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter.sdstest new file mode 100644 index 000000000..77fb88dfe --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < out T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/empty constraint list.sdstest new file mode 100644 index 000000000..1ca500b04 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/empty constraint list.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) where { } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/empty type parameter list.sdstest new file mode 100644 index 000000000..3775b18ab --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/empty type parameter list.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction<>() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/invariant type parameter.sdstest new file mode 100644 index 000000000..049ac65d1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/invariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest new file mode 100644 index 000000000..712dec1e3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest @@ -0,0 +1,36 @@ +class MyClass { + fun myFunction ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/multiple results.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/multiple results.sdstest new file mode 100644 index 000000000..5afbbde82 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/multiple results.sdstest @@ -0,0 +1,23 @@ +class MyClass { + fun myFunction ( ) -> ( + @Annotation a , + + b , + + c : Int , + + d : Int + ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> ( + @Annotation + a, + b, + c: Int, + d: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/multiple type parameters.sdstest new file mode 100644 index 000000000..02ee93eda --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/multiple type parameters.sdstest @@ -0,0 +1,14 @@ +class MyClass { + fun myFunction < @Annotation T , in S , out U > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + T, + in S, + out U + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/no parameters and no results.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/no parameters and no results.sdstest new file mode 100644 index 000000000..adcf16397 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/no parameters and no results.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/no results (explicit).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/no results (explicit).sdstest new file mode 100644 index 000000000..0a7b35fe6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/no results (explicit).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> () +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (in parentheses).sdstest new file mode 100644 index 000000000..a7bec63c3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (in parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> (a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (no parentheses).sdstest new file mode 100644 index 000000000..d2afc17f6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (no parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> a : Int +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> a: Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..390f3c867 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (no parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> a +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> a +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (with parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..0f85cec7e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (with parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> ( a ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> (a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/static.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/static.sdstest new file mode 100644 index 000000000..f51223011 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/static.sdstest @@ -0,0 +1,9 @@ +class MyClass { + static fun myFunction ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + static fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with multiple constraints.sdstest new file mode 100644 index 000000000..a589fa28a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with multiple constraints.sdstest @@ -0,0 +1,17 @@ +class MyClass { + fun myFunction ( ) where { + + T sub Number , + + S super Number + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with sub constraint.sdstest new file mode 100644 index 000000000..1013e15e0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with sub constraint.sdstest @@ -0,0 +1,13 @@ +class MyClass { + fun myFunction ( ) where { + T sub Number + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where { + T sub Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with super constraint.sdstest new file mode 100644 index 000000000..60ef8bc03 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with super constraint.sdstest @@ -0,0 +1,14 @@ +class MyClass { + fun myFunction ( ) where { + + T super Number + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where { + T super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed optional parameter.sdstest new file mode 100644 index 000000000..bf987f163 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed required parameter.sdstest new file mode 100644 index 000000000..9613eddcd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..b938bdbae --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest new file mode 100644 index 000000000..c13cb60dd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped optional parameter.sdstest new file mode 100644 index 000000000..b2be955d6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped required parameter.sdstest new file mode 100644 index 000000000..32af588d5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..80670436e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..1c90825bd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/minimal.sdstest b/DSL/tests/resources/formatting/declarations/classes/minimal.sdstest new file mode 100644 index 000000000..99f3e1846 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/minimal.sdstest @@ -0,0 +1,5 @@ +class MyClass + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/multiple parameters.sdstest new file mode 100644 index 000000000..04a9448d7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/multiple parameters.sdstest @@ -0,0 +1,33 @@ +class MyClass ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) + +// ----------------------------------------------------------------------------- + +class MyClass( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/formatting/declarations/classes/multiple parent types.sdstest b/DSL/tests/resources/formatting/declarations/classes/multiple parent types.sdstest new file mode 100644 index 000000000..cf14b00bf --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/multiple parent types.sdstest @@ -0,0 +1,5 @@ +class MyClass sub Int , Number + +// ----------------------------------------------------------------------------- + +class MyClass sub Int, Number diff --git a/DSL/tests/resources/formatting/declarations/classes/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/multiple type parameters.sdstest new file mode 100644 index 000000000..a68e1227d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/multiple type parameters.sdstest @@ -0,0 +1,10 @@ +class MyClass < @Annotation T , in S , out U > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + T, + in S, + out U +> diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotated type parameter.sdstest new file mode 100644 index 000000000..07498409a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotated type parameter.sdstest @@ -0,0 +1,12 @@ +class MyOuterClass { + class MyClass < @Annotation T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + T + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotation call.sdstest new file mode 100644 index 000000000..5cdb77ded --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotation call.sdstest @@ -0,0 +1,10 @@ +class MyOuterClass { + @Annotation class MyClass +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + @Annotation + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..2ed3d7123 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyOuterClass { + class MyClass < @Annotation in T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + in T + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter.sdstest new file mode 100644 index 000000000..b008b22de --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < in T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..a7be42a8a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyOuterClass { + class MyClass < @Annotation out T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + out T + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter.sdstest new file mode 100644 index 000000000..97d72dd17 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < out T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty body.sdstest new file mode 100644 index 000000000..be3dd1235 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty body.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass { } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty constraint list.sdstest new file mode 100644 index 000000000..509de9aac --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty constraint list.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass where { } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty parameter list.sdstest new file mode 100644 index 000000000..c6b4acdc5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty parameter list.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty type parameter list.sdstest new file mode 100644 index 000000000..14f98b903 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty type parameter list.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass<> +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/invariant type parameter.sdstest new file mode 100644 index 000000000..fcfc30c45 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/invariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/minimal.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/minimal.sdstest new file mode 100644 index 000000000..603263048 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/minimal.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest new file mode 100644 index 000000000..5518f008e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest @@ -0,0 +1,37 @@ +class MyOuterClass { + class MyClass ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parent types.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parent types.sdstest new file mode 100644 index 000000000..4974c5740 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parent types.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass sub Int , Number +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass sub Int, Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple type parameters.sdstest new file mode 100644 index 000000000..0fd48754e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple type parameters.sdstest @@ -0,0 +1,14 @@ +class MyOuterClass { + class MyClass < @Annotation T , in S , out U > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + T, + in S, + out U + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/parent type.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/parent type.sdstest new file mode 100644 index 000000000..6245987b1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/parent type.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass sub Int +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass sub Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with multiple constraints.sdstest new file mode 100644 index 000000000..969f28c88 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with multiple constraints.sdstest @@ -0,0 +1,18 @@ +class MyOuterClass { + class MyClass where { + + T sub Number , + + S super Number + + } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with sub constraint.sdstest new file mode 100644 index 000000000..a4f41215b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with sub constraint.sdstest @@ -0,0 +1,13 @@ +class MyOuterClass { + class MyClass where { + T sub Number + } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where { + T sub Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with super constraint.sdstest new file mode 100644 index 000000000..affc2aba1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with super constraint.sdstest @@ -0,0 +1,13 @@ +class MyOuterClass { + class MyClass where { + T super Number + } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where { + T super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed optional parameter.sdstest new file mode 100644 index 000000000..4e602819a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed required parameter.sdstest new file mode 100644 index 000000000..67059b584 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..4f8362e1a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest new file mode 100644 index 000000000..9096c9df5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped optional parameter.sdstest new file mode 100644 index 000000000..dd6142d9f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped required parameter.sdstest new file mode 100644 index 000000000..e2ca23f40 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..417253885 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..a4f040167 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/annotation call.sdstest new file mode 100644 index 000000000..74eaf7b60 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/annotation call.sdstest @@ -0,0 +1,10 @@ +class MyClass { + @Annotation enum MyEnum +} + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + enum MyEnum +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/empty body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/empty body.sdstest new file mode 100644 index 000000000..821a0f32b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/empty body.sdstest @@ -0,0 +1,9 @@ +class MyClass { + enum MyEnum { } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/no body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/no body.sdstest new file mode 100644 index 000000000..3ba95b00e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/no body.sdstest @@ -0,0 +1,9 @@ +class MyClass { + enum MyEnum +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants in body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants in body.sdstest new file mode 100644 index 000000000..bb39b4aee --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants in body.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotated type parameter.sdstest new file mode 100644 index 000000000..e16c9e40c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotated type parameter.sdstest @@ -0,0 +1,16 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + T + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotation call.sdstest new file mode 100644 index 000000000..182bae7fa --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotation call.sdstest @@ -0,0 +1,14 @@ +class MyClass { + enum MyEnum { + @Annotation MyEnumVariant + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + @Annotation + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..a43fcb568 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,16 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation in T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + in T + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter.sdstest new file mode 100644 index 000000000..bc6026aa1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < in T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..b0ba9f682 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter with annotation call.sdstest @@ -0,0 +1,16 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation out T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + out T + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter.sdstest new file mode 100644 index 000000000..e405ad122 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < out T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/empty type parameter list.sdstest new file mode 100644 index 000000000..78e3dcdc6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/empty type parameter list.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant<> + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/invariant type parameter.sdstest new file mode 100644 index 000000000..bd77cccc6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/invariant type parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest new file mode 100644 index 000000000..9b6dfe9f6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest @@ -0,0 +1,40 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple type parameters.sdstest new file mode 100644 index 000000000..05dfd5c69 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple type parameters.sdstest @@ -0,0 +1,18 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation T , in S , out U > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + T, + in S, + out U + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/no parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/no parameter list.sdstest new file mode 100644 index 000000000..0c08692a3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/no parameter list.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with multiple constraints.sdstest new file mode 100644 index 000000000..aecf34a93 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with multiple constraints.sdstest @@ -0,0 +1,19 @@ +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number , + S super Number + } + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number, + S super Number + } + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with sub constraint.sdstest new file mode 100644 index 000000000..73e974902 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with sub constraint.sdstest @@ -0,0 +1,17 @@ +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number + } + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number + } + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with super constraint.sdstest new file mode 100644 index 000000000..622a6ff99 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with super constraint.sdstest @@ -0,0 +1,17 @@ +class MyClass { + enum MyEnum { + MyEnumVariant where { + T super Number + } + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T super Number + } + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed optional parameter.sdstest new file mode 100644 index 000000000..9b1c03acb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed optional parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a : Int = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a: Int = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed required parameter.sdstest new file mode 100644 index 000000000..8a18e134f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed required parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a : Int ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a: Int) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a2208dcb3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a : Int = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a: Int = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest new file mode 100644 index 000000000..0545dc7fa --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a : Int ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a: Int) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped optional parameter.sdstest new file mode 100644 index 000000000..fe43730f9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped optional parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped required parameter.sdstest new file mode 100644 index 000000000..f42ef72a0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped required parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..7a808b7c7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..6a6973ac4 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/one parent type.sdstest b/DSL/tests/resources/formatting/declarations/classes/one parent type.sdstest new file mode 100644 index 000000000..edea5b0de --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/one parent type.sdstest @@ -0,0 +1,5 @@ +class MyClass sub Int + +// ----------------------------------------------------------------------------- + +class MyClass sub Int diff --git a/DSL/tests/resources/formatting/declarations/classes/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/with multiple constraints.sdstest new file mode 100644 index 000000000..c804bba16 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with multiple constraints.sdstest @@ -0,0 +1,14 @@ +class MyClass where { + + T sub Number , + + S super Number + + } + +// ----------------------------------------------------------------------------- + +class MyClass where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/with sub constraint.sdstest new file mode 100644 index 000000000..717b1af28 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with sub constraint.sdstest @@ -0,0 +1,9 @@ +class MyClass where { + T sub Number + } + +// ----------------------------------------------------------------------------- + +class MyClass where { + T sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/with super constraint.sdstest new file mode 100644 index 000000000..67725a957 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with super constraint.sdstest @@ -0,0 +1,9 @@ +class MyClass where { + T super Number + } + +// ----------------------------------------------------------------------------- + +class MyClass where { + T super Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed optional parameter.sdstest new file mode 100644 index 000000000..498e4353d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed required parameter.sdstest new file mode 100644 index 000000000..82e69d627 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a : Int ) + +// ----------------------------------------------------------------------------- + +class MyClass(a: Int) diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a05a5eae6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest new file mode 100644 index 000000000..1df3e13ca --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a : Int ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a: Int) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped optional parameter.sdstest new file mode 100644 index 000000000..87ae661e8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(a = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped required parameter.sdstest new file mode 100644 index 000000000..1ac2b0b22 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a ) + +// ----------------------------------------------------------------------------- + +class MyClass(a) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..742ca1d20 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..de5cbea73 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a) diff --git a/DSL/tests/resources/formatting/declarations/enums/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/annotation call.sdstest new file mode 100644 index 000000000..2dc1c9171 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation enum MyEnum + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +enum MyEnum diff --git a/DSL/tests/resources/formatting/declarations/enums/empty body.sdstest b/DSL/tests/resources/formatting/declarations/enums/empty body.sdstest new file mode 100644 index 000000000..660dfbc95 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/empty body.sdstest @@ -0,0 +1,5 @@ +enum MyEnum { } + +// ----------------------------------------------------------------------------- + +enum MyEnum {} diff --git a/DSL/tests/resources/formatting/declarations/enums/full body.sdstest b/DSL/tests/resources/formatting/declarations/enums/full body.sdstest new file mode 100644 index 000000000..0140234fb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/full body.sdstest @@ -0,0 +1,27 @@ +enum MyEnum { + + @Annotation + + MyEnumVariant1 + + + MyEnumVariant2 + + + @Annotation + + MyEnumVariant3 + + } + +// ----------------------------------------------------------------------------- + +enum MyEnum { + @Annotation + MyEnumVariant1 + + MyEnumVariant2 + + @Annotation + MyEnumVariant3 +} diff --git a/DSL/tests/resources/formatting/declarations/enums/no body.sdstest b/DSL/tests/resources/formatting/declarations/enums/no body.sdstest new file mode 100644 index 000000000..a3465e9cf --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/no body.sdstest @@ -0,0 +1,5 @@ +enum MyEnum + +// ----------------------------------------------------------------------------- + +enum MyEnum diff --git a/DSL/tests/resources/formatting/declarations/enums/variants in body.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants in body.sdstest new file mode 100644 index 000000000..c285ed2f4 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants in body.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant + } + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/annotated type parameter.sdstest new file mode 100644 index 000000000..e044ce70e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/annotated type parameter.sdstest @@ -0,0 +1,12 @@ +enum MyEnum { + MyEnumVariant < @Annotation T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + T + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/annotation call.sdstest new file mode 100644 index 000000000..6b066b798 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/annotation call.sdstest @@ -0,0 +1,10 @@ +enum MyEnum { + @Annotation MyEnumVariant +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + @Annotation + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..1552b4e76 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +enum E { + A( + a: A.B, + b: Int + ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: A.B, + b: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list.sdstest new file mode 100644 index 000000000..585fff906 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list.sdstest @@ -0,0 +1,12 @@ +enum E { + A( a: A.B , b: Int ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: A.B, + b: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..2fc767b57 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +enum MyEnum { + MyEnumVariant < @Annotation in T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + in T + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter.sdstest new file mode 100644 index 000000000..1c8a3553e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < in T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..ad529a158 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +enum MyEnum { + MyEnumVariant < @Annotation out T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + out T + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter.sdstest new file mode 100644 index 000000000..d059c09fc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < out T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/empty type parameter list.sdstest new file mode 100644 index 000000000..25578d9e6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/empty type parameter list.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant<> +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/invariant type parameter.sdstest new file mode 100644 index 000000000..c90eaf89b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/invariant type parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/long parameter list.sdstest new file mode 100644 index 000000000..a27994544 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/long parameter list.sdstest @@ -0,0 +1,14 @@ +enum E { + A( a: Int , b: Int , c: Int , d: Int ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: Int, + b: Int, + c: Int, + d: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest new file mode 100644 index 000000000..f4f44b314 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest @@ -0,0 +1,19 @@ +enum E { + A< + K, + V, + X, + Y + > +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + K, + V, + X, + Y + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list.sdstest new file mode 100644 index 000000000..78fc5760f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list.sdstest @@ -0,0 +1,14 @@ +enum E { + A< K , V , X , Y > +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + K, + V, + X, + Y + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest new file mode 100644 index 000000000..da483aa5a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest @@ -0,0 +1,37 @@ +enum MyEnum { + MyEnumVariant ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/multiple type parameters.sdstest new file mode 100644 index 000000000..5d5cd27ac --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/multiple type parameters.sdstest @@ -0,0 +1,14 @@ +enum MyEnum { + MyEnumVariant < @Annotation T , in S , out U > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + T, + in S, + out U + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/no parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/no parameter list.sdstest new file mode 100644 index 000000000..d55b4c602 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/no parameter list.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with multiple constraints.sdstest new file mode 100644 index 000000000..ee8eca3fe --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with multiple constraints.sdstest @@ -0,0 +1,18 @@ +enum MyEnum { + MyEnumVariant where { + + T sub Number , + + S super Number + + } +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with sub constraint.sdstest new file mode 100644 index 000000000..fff7e5244 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with sub constraint.sdstest @@ -0,0 +1,13 @@ +enum MyEnum { + MyEnumVariant where { + T sub Number + } +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant where { + T sub Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with super constraint.sdstest new file mode 100644 index 000000000..abc4c75a2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with super constraint.sdstest @@ -0,0 +1,13 @@ +enum MyEnum { + MyEnumVariant where { + T super Number + } +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant where { + T super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed optional parameter.sdstest new file mode 100644 index 000000000..d7efefaa9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed required parameter.sdstest new file mode 100644 index 000000000..60e8652fb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a0ec0c970 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( vararg a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest new file mode 100644 index 000000000..e61188a82 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( vararg a : Int ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped optional parameter.sdstest new file mode 100644 index 000000000..e361d229d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped required parameter.sdstest new file mode 100644 index 000000000..f163e978f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..6d4fa2a96 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant (vararg a = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..0eb53e36a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( vararg a ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a) +} diff --git a/DSL/tests/resources/formatting/declarations/functions/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/annotated type parameter.sdstest new file mode 100644 index 000000000..30704d78d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/annotated type parameter.sdstest @@ -0,0 +1,8 @@ +fun myFunction < @Annotation T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + T +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/functions/annotation call.sdstest new file mode 100644 index 000000000..a71836c3a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation fun myFunction ( ) + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..7b7db9fd3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +fun f( + a: A.B, + b: Int +) + +// ----------------------------------------------------------------------------- + +fun f( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/complex parameter list.sdstest new file mode 100644 index 000000000..3c27aa52b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex parameter list.sdstest @@ -0,0 +1,8 @@ +fun f( a: A.B , b: Int ) + +// ----------------------------------------------------------------------------- + +fun f( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest new file mode 100644 index 000000000..f3328934b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest @@ -0,0 +1,11 @@ +fun f() -> ( + x: A.B, + y: Int +) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: A.B, + y: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/complex result list.sdstest b/DSL/tests/resources/formatting/declarations/functions/complex result list.sdstest new file mode 100644 index 000000000..8108296b5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex result list.sdstest @@ -0,0 +1,8 @@ +fun f() -> ( x: A.B , y: Int ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: A.B, + y: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..d6e8b37b3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +fun myFunction < @Annotation in T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + in T +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter.sdstest new file mode 100644 index 000000000..a02ea971d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction < in T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..ba691458a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +fun myFunction < @Annotation out T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + out T +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter.sdstest new file mode 100644 index 000000000..0b8b00b53 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction < out T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/functions/empty constraint list.sdstest new file mode 100644 index 000000000..a2d6bee0a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/empty constraint list.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) where { } + +// ----------------------------------------------------------------------------- + +fun myFunction() where {} diff --git a/DSL/tests/resources/formatting/declarations/functions/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/empty type parameter list.sdstest new file mode 100644 index 000000000..0d045ebf7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/empty type parameter list.sdstest @@ -0,0 +1,5 @@ +fun myFunction < > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction<>() diff --git a/DSL/tests/resources/formatting/declarations/functions/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/invariant type parameter.sdstest new file mode 100644 index 000000000..4a7c6dd89 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/invariant type parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction < T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/long parameter list.sdstest new file mode 100644 index 000000000..de6e2a7da --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long parameter list.sdstest @@ -0,0 +1,10 @@ +fun f( a: Int , b: Int , c: Int , d: Int ) + +// ----------------------------------------------------------------------------- + +fun f( + a: Int, + b: Int, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/long result list.sdstest b/DSL/tests/resources/formatting/declarations/functions/long result list.sdstest new file mode 100644 index 000000000..0bffa7df9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long result list.sdstest @@ -0,0 +1,10 @@ +fun f() -> ( x: Int , y: Int , a: Int , b: Int ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: Int, + y: Int, + a: Int, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest new file mode 100644 index 000000000..bd0d55562 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +fun f< + K, + V, + X, + Y +>() + +// ----------------------------------------------------------------------------- + +fun f< + K, + V, + X, + Y +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/long type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/long type parameter list.sdstest new file mode 100644 index 000000000..72648532a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long type parameter list.sdstest @@ -0,0 +1,10 @@ +fun f< K , V , X , Y >() + +// ----------------------------------------------------------------------------- + +fun f< + K, + V, + X, + Y +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/functions/multiple parameters.sdstest new file mode 100644 index 000000000..b605bc789 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/multiple parameters.sdstest @@ -0,0 +1,32 @@ +fun myFunction ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) + +// ----------------------------------------------------------------------------- + +fun myFunction( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/formatting/declarations/functions/multiple results.sdstest b/DSL/tests/resources/formatting/declarations/functions/multiple results.sdstest new file mode 100644 index 000000000..f1dcf6c22 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/multiple results.sdstest @@ -0,0 +1,20 @@ +fun myFunction ( ) -> ( + + @Annotation a , + + b , + + c : Int , + + d : Int + ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> ( + @Annotation + a, + b, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/functions/multiple type parameters.sdstest new file mode 100644 index 000000000..4c4c4869c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/multiple type parameters.sdstest @@ -0,0 +1,10 @@ +fun myFunction < @Annotation T , in S , out U > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + T, + in S, + out U +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/no parameters and no results.sdstest b/DSL/tests/resources/formatting/declarations/functions/no parameters and no results.sdstest new file mode 100644 index 000000000..1d31063fc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/no parameters and no results.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/no results (explicit).sdstest b/DSL/tests/resources/formatting/declarations/functions/no results (explicit).sdstest new file mode 100644 index 000000000..dd682801e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/no results (explicit).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> () diff --git a/DSL/tests/resources/formatting/declarations/functions/one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one typed result (in parentheses).sdstest new file mode 100644 index 000000000..ab4b5849f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one typed result (in parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> ( a : Int ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> (a: Int) diff --git a/DSL/tests/resources/formatting/declarations/functions/one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one typed result (no parentheses).sdstest new file mode 100644 index 000000000..64ebd576e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one typed result (no parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> a : Int + +// ----------------------------------------------------------------------------- + +fun myFunction() -> a: Int diff --git a/DSL/tests/resources/formatting/declarations/functions/one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..a7d782649 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one untyped result (no parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> a + +// ----------------------------------------------------------------------------- + +fun myFunction() -> a diff --git a/DSL/tests/resources/formatting/declarations/functions/one untyped result (with parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..b957b9ea5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one untyped result (with parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> ( a ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> (a) diff --git a/DSL/tests/resources/formatting/declarations/functions/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/functions/with multiple constraints.sdstest new file mode 100644 index 000000000..5663a7805 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with multiple constraints.sdstest @@ -0,0 +1,13 @@ +fun myFunction ( ) where { + T sub Number , + + S super Number + + } + +// ----------------------------------------------------------------------------- + +fun myFunction() where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/formatting/declarations/functions/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/functions/with sub constraint.sdstest new file mode 100644 index 000000000..434cacbff --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with sub constraint.sdstest @@ -0,0 +1,9 @@ +fun myFunction ( ) where { + T sub Number + } + +// ----------------------------------------------------------------------------- + +fun myFunction() where { + T sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/functions/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/functions/with super constraint.sdstest new file mode 100644 index 000000000..562c4796a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with super constraint.sdstest @@ -0,0 +1,9 @@ +fun myFunction ( ) where { + T super Number + } + +// ----------------------------------------------------------------------------- + +fun myFunction() where { + T super Number +} diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed optional parameter.sdstest new file mode 100644 index 000000000..320e2d42f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed required parameter.sdstest new file mode 100644 index 000000000..22d946074 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a : Int ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a: Int) diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..2c5b6b9a7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest new file mode 100644 index 000000000..e2ed6cffb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a : Int ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a: Int) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped optional parameter.sdstest new file mode 100644 index 000000000..5878f16cd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped required parameter.sdstest new file mode 100644 index 000000000..e92311144 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..c88ff43de --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..3d6fae2c5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a) diff --git a/DSL/tests/resources/formatting/declarations/pipelines/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/pipelines/annotation call.sdstest new file mode 100644 index 000000000..285b24295 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/pipelines/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation pipeline myPipeline { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +pipeline myPipeline {} diff --git a/DSL/tests/resources/formatting/declarations/pipelines/empty body.sdstest b/DSL/tests/resources/formatting/declarations/pipelines/empty body.sdstest new file mode 100644 index 000000000..57fb66cab --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/pipelines/empty body.sdstest @@ -0,0 +1,5 @@ +pipeline myPipeline { } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline {} diff --git a/DSL/tests/resources/formatting/declarations/pipelines/statements in body.sdstest b/DSL/tests/resources/formatting/declarations/pipelines/statements in body.sdstest new file mode 100644 index 000000000..6970f53fd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/pipelines/statements in body.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + val a = 1 ; + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + val a = 1; +} diff --git a/DSL/tests/resources/formatting/declarations/segments/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/segments/annotation call.sdstest new file mode 100644 index 000000000..6af46de14 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..105f30c51 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +segment s( + a: A.B, + b: Int +) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: A.B, + b: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/segments/complex parameter list.sdstest new file mode 100644 index 000000000..9e5065bca --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex parameter list.sdstest @@ -0,0 +1,8 @@ +segment s( a: A.B , b: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: A.B, + b: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest new file mode 100644 index 000000000..b91176007 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest @@ -0,0 +1,11 @@ +segment s() -> ( + x: A.B, + y: Int +) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: A.B, + y: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex result list.sdstest b/DSL/tests/resources/formatting/declarations/segments/complex result list.sdstest new file mode 100644 index 000000000..312c5ea41 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex result list.sdstest @@ -0,0 +1,8 @@ +segment s() -> ( x: A.B , y: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: A.B, + y: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/internal segment with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/segments/internal segment with annotation call.sdstest new file mode 100644 index 000000000..9f8b3c0d2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/internal segment with annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation internal segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +internal segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/internal segment.sdstest b/DSL/tests/resources/formatting/declarations/segments/internal segment.sdstest new file mode 100644 index 000000000..09ff8895c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/internal segment.sdstest @@ -0,0 +1,5 @@ +internal segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +internal segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/segments/long parameter list.sdstest new file mode 100644 index 000000000..565f47937 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/long parameter list.sdstest @@ -0,0 +1,10 @@ +segment s( a: Int , b: Int , c: Int , d: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: Int, + b: Int, + c: Int, + d: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/long result list.sdstest b/DSL/tests/resources/formatting/declarations/segments/long result list.sdstest new file mode 100644 index 000000000..97d846e55 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/long result list.sdstest @@ -0,0 +1,10 @@ +segment s() -> ( x: Int , y: Int , a: Int , b: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: Int, + y: Int, + a: Int, + b: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/segments/multiple parameters.sdstest new file mode 100644 index 000000000..a6ab6484b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/multiple parameters.sdstest @@ -0,0 +1,32 @@ +segment mySegment ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/multiple results.sdstest b/DSL/tests/resources/formatting/declarations/segments/multiple results.sdstest new file mode 100644 index 000000000..9755df46c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/multiple results.sdstest @@ -0,0 +1,20 @@ +segment mySegment ( ) -> ( + + @Annotation a , + + b , + + c : Int , + + d : Int + ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> ( + @Annotation + a, + b, + c: Int, + d: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/no parameters and no results and empty body.sdstest b/DSL/tests/resources/formatting/declarations/segments/no parameters and no results and empty body.sdstest new file mode 100644 index 000000000..edf487027 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/no parameters and no results and empty body.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/no results (explicit).sdstest b/DSL/tests/resources/formatting/declarations/segments/no results (explicit).sdstest new file mode 100644 index 000000000..dee2ed60c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/no results (explicit).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> ( ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> () {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one typed result (in parentheses).sdstest new file mode 100644 index 000000000..39e77c006 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one typed result (in parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> ( a : Int ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> (a: Int) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one typed result (no parentheses).sdstest new file mode 100644 index 000000000..82099ddcd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one typed result (no parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> a : Int { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> a: Int {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..44f98d7ab --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one untyped result (no parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> a { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> a {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one untyped result (with parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..59ca26b2f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one untyped result (with parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> ( a ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> (a) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/private segment with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/segments/private segment with annotation call.sdstest new file mode 100644 index 000000000..e8abab52d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/private segment with annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation private segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +private segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/private segment.sdstest b/DSL/tests/resources/formatting/declarations/segments/private segment.sdstest new file mode 100644 index 000000000..077937c9e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/private segment.sdstest @@ -0,0 +1,5 @@ +private segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +private segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/statements in body.sdstest b/DSL/tests/resources/formatting/declarations/segments/statements in body.sdstest new file mode 100644 index 000000000..c1ccc34a0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/statements in body.sdstest @@ -0,0 +1,9 @@ +private segment mySegment ( ) { + val a = 1; + } + +// ----------------------------------------------------------------------------- + +private segment mySegment() { + val a = 1; +} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed optional parameter.sdstest new file mode 100644 index 000000000..af4508400 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a : Int = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a: Int = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed required parameter.sdstest new file mode 100644 index 000000000..0d437d58b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a : Int ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a: Int) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..51cff7374 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a : Int = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a: Int = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest new file mode 100644 index 000000000..69ef43188 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a : Int ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a: Int) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped optional parameter.sdstest new file mode 100644 index 000000000..2bce54284 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped required parameter.sdstest new file mode 100644 index 000000000..ea0eae063 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..0ee3cffd8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..111740490 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a) {} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/addition.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/addition.sdstest new file mode 100644 index 000000000..7e411eca9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/addition.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 + 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 + 2; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/complex example.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/complex example.sdstest new file mode 100644 index 000000000..0ca040486 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/complex example.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( 1 + 2 ) * - 3 / ( 1 - 4 ) + 5; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (1 + 2) * -3 / (1 - 4) + 5; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/division.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/division.sdstest new file mode 100644 index 000000000..a53dbe7e6 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/division.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 / 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 / 2; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/multiplication.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/multiplication.sdstest new file mode 100644 index 000000000..021a2ed15 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/multiplication.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 * 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 * 2; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/negation.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/negation.sdstest new file mode 100644 index 000000000..ef14ab5c7 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/negation.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + - 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + -1; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/subtraction.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/subtraction.sdstest new file mode 100644 index 000000000..57f2c8b71 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/subtraction.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 - 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 - 2; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..f0af1ad3a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +pipeline p { + ( + a: A.B, + b: Int + ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list.sdstest new file mode 100644 index 000000000..19b5d9d0d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list.sdstest @@ -0,0 +1,12 @@ +pipeline p { + ( a: A.B , b: Int ){}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/filled body.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/filled body.sdstest new file mode 100644 index 000000000..640c812ce --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/filled body.sdstest @@ -0,0 +1,13 @@ +pipeline myPipeline { + ( ) { + val a = 1 ; + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + val a = 1; + }; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/long parameter list.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/long parameter list.sdstest new file mode 100644 index 000000000..a68c125b8 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/long parameter list.sdstest @@ -0,0 +1,14 @@ +pipeline p { + ( a: Int , b: Int , c: Int , d: Int ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest new file mode 100644 index 000000000..4c0f151e9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest @@ -0,0 +1,36 @@ +pipeline myPipeline { + ( + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/no parameters and empty body.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/no parameters and empty body.sdstest new file mode 100644 index 000000000..2e0c08ffc --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/no parameters and empty body.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed optional parameter.sdstest new file mode 100644 index 000000000..c37e4bf97 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed required parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed required parameter.sdstest new file mode 100644 index 000000000..7eb4216c5 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..9d2adadea --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest new file mode 100644 index 000000000..2c6111a39 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped optional parameter.sdstest new file mode 100644 index 000000000..b045d39aa --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped required parameter.sdstest new file mode 100644 index 000000000..8ecee2933 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..fa0340f01 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..65b5c91fe --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest b/DSL/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest new file mode 100644 index 000000000..bf4f30fce --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest @@ -0,0 +1,15 @@ +pipeline p { + f( + f(), + 2 + ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + f(), + 2 + ); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/complex argument list.sdstest b/DSL/tests/resources/formatting/expressions/calls/complex argument list.sdstest new file mode 100644 index 000000000..d34dfe563 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/complex argument list.sdstest @@ -0,0 +1,12 @@ +pipeline p { + f( f() , 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + f(), + 2 + ); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/complex call.sdstest b/DSL/tests/resources/formatting/expressions/calls/complex call.sdstest new file mode 100644 index 000000000..7b50db792 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/complex call.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < * , in Number , out Number , T = Number > ( 1 , b = 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f<*, in Number, out Number, T = Number>(1, b = 2); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest new file mode 100644 index 000000000..d429c4fd9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < in Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/covariant type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/covariant type argument.sdstest new file mode 100644 index 000000000..755fcfe8d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/covariant type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < out Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest b/DSL/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest new file mode 100644 index 000000000..62ad87be7 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f<>(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/long argument list.sdstest b/DSL/tests/resources/formatting/expressions/calls/long argument list.sdstest new file mode 100644 index 000000000..38b8c4b9e --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/long argument list.sdstest @@ -0,0 +1,14 @@ +pipeline p { + f( 1 , 2 , 3 , 4 ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + 1, + 2, + 3, + 4 + ); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/named argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/named argument.sdstest new file mode 100644 index 000000000..3e727f761 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/named argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f ( b = 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(b = 2); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/named type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/named type argument.sdstest new file mode 100644 index 000000000..80d0f3be5 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/named type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < T = Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest b/DSL/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest new file mode 100644 index 000000000..d89d28d64 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < T = List < S > > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f>(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest b/DSL/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest new file mode 100644 index 000000000..a8f90d697 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/positional argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/positional argument.sdstest new file mode 100644 index 000000000..c4234d45e --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/positional argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f ( 1 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(1); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/positional type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/positional type argument.sdstest new file mode 100644 index 000000000..8eb1593ca --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/positional type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest b/DSL/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest new file mode 100644 index 000000000..d30be06a3 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest @@ -0,0 +1,41 @@ +pipeline myPipeline { + /* + * Once Langium supports LL(*) parsing, this should work. + * + * For now, we can either parse + * - f>() or + * - a < f() + * but not both. + * + * The problem is that the parser can't decide with finite lookahead whether + * the first < is the start of a type argument list or the operator of a + * comparison expression. + * + * We decided to only support the second case for now. The first case leads + * to a syntax error. To work around this, you can use the following syntax: + * - f>() + */ + f>(); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + /* + * Once Langium supports LL(*) parsing, this should work. + * + * For now, we can either parse + * - f>() or + * - a < f() + * but not both. + * + * The problem is that the parser can't decide with finite lookahead whether + * the first < is the start of a type argument list or the operator of a + * comparison expression. + * + * We decided to only support the second case for now. The first case leads + * to a syntax error. To work around this, you can use the following syntax: + * - f>() + */ + f>(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/star projection.sdstest b/DSL/tests/resources/formatting/expressions/calls/star projection.sdstest new file mode 100644 index 000000000..0ed8577a9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/star projection.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < * > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f<*>(); +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/greater than or equal.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/greater than or equal.sdstest new file mode 100644 index 000000000..5f952a88d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/greater than or equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 >= 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 >= 2; +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/greater than.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/greater than.sdstest new file mode 100644 index 000000000..acb064dff --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/greater than.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 > 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 > 2; +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/less than or equal.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/less than or equal.sdstest new file mode 100644 index 000000000..8ddfe3d26 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/less than or equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 <= 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 <= 2; +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest new file mode 100644 index 000000000..a22882b23 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 < a(); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 < a(); +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/less than.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/less than.sdstest new file mode 100644 index 000000000..2445c4b40 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/less than.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 < 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 < 2; +} diff --git a/DSL/tests/resources/formatting/expressions/complex chained expression.sdstest b/DSL/tests/resources/formatting/expressions/complex chained expression.sdstest new file mode 100644 index 000000000..a1ade93ee --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/complex chained expression.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a . member ? . f ( ) [ 1 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a.member?.f()[1]; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/equal.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/equal.sdstest new file mode 100644 index 000000000..23abb29b1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 == 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 == 2; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/identical.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/identical.sdstest new file mode 100644 index 000000000..f6514e25d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/identical.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 === 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 === 2; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/not equal.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/not equal.sdstest new file mode 100644 index 000000000..2b3c90e0a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/not equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 != 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 != 2; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/not identical.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/not identical.sdstest new file mode 100644 index 000000000..286e60291 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/not identical.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 !== 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 !== 2; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..3bf86f912 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +pipeline p { + ( + a: A.B, + b: Int + ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list.sdstest new file mode 100644 index 000000000..7f08ddc55 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list.sdstest @@ -0,0 +1,12 @@ +pipeline p { + ( a: A.B , b: Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/long parameter list.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/long parameter list.sdstest new file mode 100644 index 000000000..fe3417ba9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/long parameter list.sdstest @@ -0,0 +1,14 @@ +pipeline p { + ( a: Int , b: Int , c: Int , d: Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest new file mode 100644 index 000000000..b47c9d17e --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest @@ -0,0 +1,37 @@ +pipeline myPipeline { + ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) -> 4; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) -> 4; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/no parameters.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/no parameters.sdstest new file mode 100644 index 000000000..527e3e390 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/no parameters.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed optional parameter.sdstest new file mode 100644 index 000000000..dc1040435 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed required parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed required parameter.sdstest new file mode 100644 index 000000000..42b89fa79 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..b0ad6f272 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest new file mode 100644 index 000000000..17e57f8bc --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped optional parameter.sdstest new file mode 100644 index 000000000..4b7e8022c --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped required parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped required parameter.sdstest new file mode 100644 index 000000000..750140cd2 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..91c5a9b78 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest new file mode 100644 index 000000000..ae0c6e22b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/indexed accesses/literal index.sdstest b/DSL/tests/resources/formatting/expressions/indexed accesses/literal index.sdstest new file mode 100644 index 000000000..04025cfb0 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/indexed accesses/literal index.sdstest @@ -0,0 +1,9 @@ +pipeline test { + a [ 1 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline test { + a[1]; +} diff --git a/DSL/tests/resources/formatting/expressions/indexed accesses/reference index.sdstest b/DSL/tests/resources/formatting/expressions/indexed accesses/reference index.sdstest new file mode 100644 index 000000000..37f9b1407 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/indexed accesses/reference index.sdstest @@ -0,0 +1,9 @@ +pipeline test { + a [ b ]; +} + +// ----------------------------------------------------------------------------- + +pipeline test { + a[b]; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/false.sdstest b/DSL/tests/resources/formatting/expressions/literals/false.sdstest new file mode 100644 index 000000000..8c6cf3fd7 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/false.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + false; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + false; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/float/basic example.sdstest b/DSL/tests/resources/formatting/expressions/literals/float/basic example.sdstest new file mode 100644 index 000000000..1419b4982 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/float/basic example.sdstest @@ -0,0 +1,25 @@ +pipeline myPipeline { + 1.2; + 1e10; + 1e+10; + 1e-10; + 1.2e2; + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1.2; + 1e10; + 1e+10; + 1e-10; + 1.2e2; + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with lowercase e.sdstest b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with lowercase e.sdstest new file mode 100644 index 000000000..186fb3839 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with lowercase e.sdstest @@ -0,0 +1,15 @@ +pipeline myPipeline { + 1e10; + 1e+10; + 1e-10; + 1.2e2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1e10; + 1e+10; + 1e-10; + 1.2e2; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with uppercase e.sdstest b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with uppercase e.sdstest new file mode 100644 index 000000000..879a2538b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with uppercase e.sdstest @@ -0,0 +1,15 @@ +pipeline myPipeline { + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/int/leading zero.sdstest b/DSL/tests/resources/formatting/expressions/literals/int/leading zero.sdstest new file mode 100644 index 000000000..f057e8966 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/int/leading zero.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 01; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 01; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/int/multiple digits.sdstest b/DSL/tests/resources/formatting/expressions/literals/int/multiple digits.sdstest new file mode 100644 index 000000000..a68739c25 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/int/multiple digits.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1234567890; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1234567890; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/int/one digit.sdstest b/DSL/tests/resources/formatting/expressions/literals/int/one digit.sdstest new file mode 100644 index 000000000..497f4c12a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/int/one digit.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/null.sdstest b/DSL/tests/resources/formatting/expressions/literals/null.sdstest new file mode 100644 index 000000000..3407a6af1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/null.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + null; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + null; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/basic content.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/basic content.sdstest new file mode 100644 index 000000000..94a0a5fe1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/basic content.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "myString"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "myString"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/closing template expression delimiter.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/closing template expression delimiter.sdstest new file mode 100644 index 000000000..fa870d84b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/closing template expression delimiter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "}}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "}}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/curly braces separated by space.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/curly braces separated by space.sdstest new file mode 100644 index 000000000..ee0f4f4b8 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/curly braces separated by space.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{ {"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{ {"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/empty template expression.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/empty template expression.sdstest new file mode 100644 index 000000000..ca55879dd --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/empty template expression.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{{ }}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{{ }}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/empty.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/empty.sdstest new file mode 100644 index 000000000..eb036b803 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/empty.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ""; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ""; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/escaped curly brace.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/escaped curly brace.sdstest new file mode 100644 index 000000000..235321a04 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/escaped curly brace.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "\{{"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "\{{"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/multiple lines.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/multiple lines.sdstest new file mode 100644 index 000000000..070e3bfeb --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/multiple lines.sdstest @@ -0,0 +1,17 @@ +pipeline myPipeline { + " + multi + line + string + "; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + " + multi + line + string + "; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/newline escape sequence.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/newline escape sequence.sdstest new file mode 100644 index 000000000..abb639863 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/newline escape sequence.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "\n"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "\n"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/single curly brace.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/single curly brace.sdstest new file mode 100644 index 000000000..4e3a0fa36 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/single curly brace.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/single quote.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/single quote.sdstest new file mode 100644 index 000000000..710cd6a04 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/single quote.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "'"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "'"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/template string with basic expression.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/template string with basic expression.sdstest new file mode 100644 index 000000000..d8f58815a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/template string with basic expression.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{{ 1 }}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{{ 1 }}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/template string with two expressions.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/template string with two expressions.sdstest new file mode 100644 index 000000000..36fba2cf1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/template string with two expressions.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{{ 1 }} {{ 2 }}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{{ 1 }} {{ 2 }}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/unicode escape sequence.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/unicode escape sequence.sdstest new file mode 100644 index 000000000..3aa4313b0 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/unicode escape sequence.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "\u000c"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "\u000c"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/true.sdstest b/DSL/tests/resources/formatting/expressions/literals/true.sdstest new file mode 100644 index 000000000..b9138ad5b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/true.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/complex example.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/complex example.sdstest new file mode 100644 index 000000000..cc04409e1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/complex example.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + not true and false or true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + not true and false or true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/conjunction.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/conjunction.sdstest new file mode 100644 index 000000000..69d9a9ebf --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/conjunction.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + false and true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + false and true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/disjunction.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/disjunction.sdstest new file mode 100644 index 000000000..84ecb6558 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/disjunction.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + true or true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + true or true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/negation.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/negation.sdstest new file mode 100644 index 000000000..41a736c35 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/negation.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + not true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + not true; +} diff --git a/DSL/tests/resources/formatting/expressions/member accesses/not nullable.sdstest b/DSL/tests/resources/formatting/expressions/member accesses/not nullable.sdstest new file mode 100644 index 000000000..e2a09dbd2 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/member accesses/not nullable.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a . member; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a.member; +} diff --git a/DSL/tests/resources/formatting/expressions/member accesses/nullable.sdstest b/DSL/tests/resources/formatting/expressions/member accesses/nullable.sdstest new file mode 100644 index 000000000..a7a86ad12 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/member accesses/nullable.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a ? . member; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a?.member; +} diff --git a/DSL/tests/resources/formatting/expressions/parenthesized expressions/nested.sdstest b/DSL/tests/resources/formatting/expressions/parenthesized expressions/nested.sdstest new file mode 100644 index 000000000..87550654b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/parenthesized expressions/nested.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( ( 1 + 2 ) ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ((1 + 2)); +} diff --git a/DSL/tests/resources/formatting/expressions/parenthesized expressions/one level.sdstest b/DSL/tests/resources/formatting/expressions/parenthesized expressions/one level.sdstest new file mode 100644 index 000000000..c277e146f --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/parenthesized expressions/one level.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( 1 + 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (1 + 2); +} diff --git a/DSL/tests/resources/formatting/expressions/reference.sdstest b/DSL/tests/resources/formatting/expressions/reference.sdstest new file mode 100644 index 000000000..62fad2d65 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/reference.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a; +} diff --git a/DSL/tests/resources/formatting/modules/annotation call and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and declaration.sdstest new file mode 100644 index 000000000..a9aafef79 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and declaration.sdstest @@ -0,0 +1,11 @@ + +@Annotation1 + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and import and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and import and declaration.sdstest new file mode 100644 index 000000000..2667a5e11 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and import and declaration.sdstest @@ -0,0 +1,16 @@ + +@Annotation1 + + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and import.sdstest b/DSL/tests/resources/formatting/modules/annotation call and import.sdstest new file mode 100644 index 000000000..ab9fca0f1 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and import.sdstest @@ -0,0 +1,11 @@ + +@Annotation1 + + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +@Annotation1 + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name and declaration.sdstest new file mode 100644 index 000000000..b3473cf4f --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name and declaration.sdstest @@ -0,0 +1,16 @@ + +@Annotation1 + + +package myPackage + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name and import and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name and import and declaration.sdstest new file mode 100644 index 000000000..55441b8bf --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name and import and declaration.sdstest @@ -0,0 +1,21 @@ + +@Annotation1 + + +package myPackage + + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name and import.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name and import.sdstest new file mode 100644 index 000000000..ea40f8d3e --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name and import.sdstest @@ -0,0 +1,16 @@ + +@Annotation1 + + +package myPackage + + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name.sdstest new file mode 100644 index 000000000..c2e552b60 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name.sdstest @@ -0,0 +1,11 @@ + +@Annotation1 + + +package myPackage + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage diff --git a/DSL/tests/resources/formatting/modules/annotation call.sdstest b/DSL/tests/resources/formatting/modules/annotation call.sdstest new file mode 100644 index 000000000..ba2bf9361 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call.sdstest @@ -0,0 +1,6 @@ + +@Annotation1 + +// ----------------------------------------------------------------------------- + +@Annotation1 diff --git a/DSL/tests/resources/formatting/modules/annotation calls and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and declarations.sdstest new file mode 100644 index 000000000..4cf4f4086 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and declarations.sdstest @@ -0,0 +1,19 @@ + +@Annotation1 + +@Annotation2 + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and imports and declarations.sdstest new file mode 100644 index 000000000..bce326581 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and imports and declarations.sdstest @@ -0,0 +1,30 @@ + +@Annotation1 + +@Annotation2 + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and imports.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and imports.sdstest new file mode 100644 index 000000000..25697f1ee --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and imports.sdstest @@ -0,0 +1,20 @@ + +@Annotation1 + +@Annotation2 + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name and declarations.sdstest new file mode 100644 index 000000000..fa0f1b5b8 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name and declarations.sdstest @@ -0,0 +1,24 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name and imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports and declarations.sdstest new file mode 100644 index 000000000..864e1d890 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports and declarations.sdstest @@ -0,0 +1,35 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name and imports.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports.sdstest new file mode 100644 index 000000000..ee0919194 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports.sdstest @@ -0,0 +1,25 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name.sdstest new file mode 100644 index 000000000..d06688d34 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name.sdstest @@ -0,0 +1,14 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage diff --git a/DSL/tests/resources/formatting/modules/annotation calls.sdstest b/DSL/tests/resources/formatting/modules/annotation calls.sdstest new file mode 100644 index 000000000..875e804be --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls.sdstest @@ -0,0 +1,9 @@ + +@Annotation1 + +@Annotation2 + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 diff --git a/DSL/tests/resources/formatting/modules/declaration.sdstest b/DSL/tests/resources/formatting/modules/declaration.sdstest new file mode 100644 index 000000000..d0cb6c93f --- /dev/null +++ b/DSL/tests/resources/formatting/modules/declaration.sdstest @@ -0,0 +1,6 @@ + +class C + +// ----------------------------------------------------------------------------- + +class C diff --git a/DSL/tests/resources/formatting/modules/declarations.sdstest b/DSL/tests/resources/formatting/modules/declarations.sdstest new file mode 100644 index 000000000..b35b30a38 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/declarations.sdstest @@ -0,0 +1,11 @@ + +class C + + +class D + +// ----------------------------------------------------------------------------- + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/empty.sdstest b/DSL/tests/resources/formatting/modules/empty.sdstest new file mode 100644 index 000000000..2acf4e336 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/empty.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +// ----------------------------------------------------------------------------- + +// $TEST$ no_syntax_error diff --git a/DSL/tests/resources/formatting/modules/full.sdstest b/DSL/tests/resources/formatting/modules/full.sdstest new file mode 100644 index 000000000..2ee8e0626 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/full.sdstest @@ -0,0 +1,102 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +@Annotation1 + +@Annotation2 + +annotation A + + +@Annotation1 + +@Annotation2 + +class C + + +@Annotation1 + +@Annotation2 + +enum E {} + + +@Annotation1 + +@Annotation2 + +fun f() + + +@Annotation1 + +@Annotation2 + +pipeline p {} + + +@Annotation1 + +@Annotation2 + +segment s() {} + + +@Annotation1 + +@Annotation2 + +schema S {} + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +@Annotation1 +@Annotation2 +annotation A + +@Annotation1 +@Annotation2 +class C + +@Annotation1 +@Annotation2 +enum E {} + +@Annotation1 +@Annotation2 +fun f() + +@Annotation1 +@Annotation2 +pipeline p {} + +@Annotation1 +@Annotation2 +segment s() {} + +@Annotation1 +@Annotation2 +schema S {} diff --git a/DSL/tests/resources/formatting/modules/import and declaration.sdstest b/DSL/tests/resources/formatting/modules/import and declaration.sdstest new file mode 100644 index 000000000..9699a087c --- /dev/null +++ b/DSL/tests/resources/formatting/modules/import and declaration.sdstest @@ -0,0 +1,11 @@ + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/import.sdstest b/DSL/tests/resources/formatting/modules/import.sdstest new file mode 100644 index 000000000..14c49da8b --- /dev/null +++ b/DSL/tests/resources/formatting/modules/import.sdstest @@ -0,0 +1,6 @@ + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/imports and declarations.sdstest new file mode 100644 index 000000000..32e4f01fe --- /dev/null +++ b/DSL/tests/resources/formatting/modules/imports and declarations.sdstest @@ -0,0 +1,22 @@ + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/imports.sdstest b/DSL/tests/resources/formatting/modules/imports.sdstest new file mode 100644 index 000000000..419960c3f --- /dev/null +++ b/DSL/tests/resources/formatting/modules/imports.sdstest @@ -0,0 +1,12 @@ + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/package name and declaration.sdstest b/DSL/tests/resources/formatting/modules/package name and declaration.sdstest new file mode 100644 index 000000000..66fccfb48 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and declaration.sdstest @@ -0,0 +1,11 @@ + +package myPackage + + +class C + +// ----------------------------------------------------------------------------- + +package myPackage + +class C diff --git a/DSL/tests/resources/formatting/modules/package name and declarations.sdstest b/DSL/tests/resources/formatting/modules/package name and declarations.sdstest new file mode 100644 index 000000000..b12ede61e --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and declarations.sdstest @@ -0,0 +1,16 @@ + +package myPackage + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +package myPackage + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/package name and import and declaration.sdstest b/DSL/tests/resources/formatting/modules/package name and import and declaration.sdstest new file mode 100644 index 000000000..1ec659baf --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and import and declaration.sdstest @@ -0,0 +1,16 @@ + +package myPackage + + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/package name and import.sdstest b/DSL/tests/resources/formatting/modules/package name and import.sdstest new file mode 100644 index 000000000..0a6982a88 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and import.sdstest @@ -0,0 +1,11 @@ + +package myPackage + + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/package name and imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/package name and imports and declarations.sdstest new file mode 100644 index 000000000..85bdca3a1 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and imports and declarations.sdstest @@ -0,0 +1,26 @@ +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/package name and imports.sdstest b/DSL/tests/resources/formatting/modules/package name and imports.sdstest new file mode 100644 index 000000000..03bb11054 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and imports.sdstest @@ -0,0 +1,17 @@ + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/package name.sdstest b/DSL/tests/resources/formatting/modules/package name.sdstest new file mode 100644 index 000000000..b2f23bf37 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name.sdstest @@ -0,0 +1,6 @@ + +package myPackage + +// ----------------------------------------------------------------------------- + +package myPackage diff --git a/DSL/tests/resources/formatting/schema/annotationCall.sdstest b/DSL/tests/resources/formatting/schema/annotationCall.sdstest new file mode 100644 index 000000000..0870a5553 --- /dev/null +++ b/DSL/tests/resources/formatting/schema/annotationCall.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation schema MySchema { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +schema MySchema {} diff --git a/DSL/tests/resources/formatting/schema/empty schema.sdstest b/DSL/tests/resources/formatting/schema/empty schema.sdstest new file mode 100644 index 000000000..5a0689a3b --- /dev/null +++ b/DSL/tests/resources/formatting/schema/empty schema.sdstest @@ -0,0 +1,5 @@ +schema MySchema { } + +// ----------------------------------------------------------------------------- + +schema MySchema {} diff --git a/DSL/tests/resources/formatting/schema/one column.sdstest b/DSL/tests/resources/formatting/schema/one column.sdstest new file mode 100644 index 000000000..fb9a45b6f --- /dev/null +++ b/DSL/tests/resources/formatting/schema/one column.sdstest @@ -0,0 +1,9 @@ +schema MySchema { + "column1" : Int + } + +// ----------------------------------------------------------------------------- + +schema MySchema { + "column1": Int +} diff --git a/DSL/tests/resources/formatting/schema/two columns.sdstest b/DSL/tests/resources/formatting/schema/two columns.sdstest new file mode 100644 index 000000000..ff79b0674 --- /dev/null +++ b/DSL/tests/resources/formatting/schema/two columns.sdstest @@ -0,0 +1,13 @@ +schema MySchema { + + "column1" : Int , + + "column2" : String + } + +// ----------------------------------------------------------------------------- + +schema MySchema { + "column1": Int, + "column2": String +} diff --git a/DSL/tests/resources/formatting/statements/assignments/in block lambda.sdstest b/DSL/tests/resources/formatting/statements/assignments/in block lambda.sdstest new file mode 100644 index 000000000..6c131b15b --- /dev/null +++ b/DSL/tests/resources/formatting/statements/assignments/in block lambda.sdstest @@ -0,0 +1,15 @@ +pipeline myPipeline { + () { + val a = 0 ; + val a , _ , yield b = call() ; + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + val a = 0; + val a, _, yield b = call(); + }; +} diff --git a/DSL/tests/resources/formatting/statements/assignments/in pipeline.sdstest b/DSL/tests/resources/formatting/statements/assignments/in pipeline.sdstest new file mode 100644 index 000000000..c0fcc6099 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/assignments/in pipeline.sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + val a = 0 ; + val a , _ , yield b = call() ; + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + val a = 0; + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/statements/assignments/in segment.sdstest b/DSL/tests/resources/formatting/statements/assignments/in segment.sdstest new file mode 100644 index 000000000..10cf1440b --- /dev/null +++ b/DSL/tests/resources/formatting/statements/assignments/in segment.sdstest @@ -0,0 +1,11 @@ +segment mySegment() { + val a = 0 ; + val a , _ , yield b = call() ; + } + +// ----------------------------------------------------------------------------- + +segment mySegment() { + val a = 0; + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/statements/expression statements/in block lambda.sdstest b/DSL/tests/resources/formatting/statements/expression statements/in block lambda.sdstest new file mode 100644 index 000000000..625725d3a --- /dev/null +++ b/DSL/tests/resources/formatting/statements/expression statements/in block lambda.sdstest @@ -0,0 +1,13 @@ +pipeline myPipeline { + () { + call() ; + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + call(); + }; +} diff --git a/DSL/tests/resources/formatting/statements/expression statements/in pipeline.sdstest b/DSL/tests/resources/formatting/statements/expression statements/in pipeline.sdstest new file mode 100644 index 000000000..3163f8172 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/expression statements/in pipeline.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + call() ; + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + call(); +} diff --git a/DSL/tests/resources/formatting/statements/expression statements/in segment.sdstest b/DSL/tests/resources/formatting/statements/expression statements/in segment.sdstest new file mode 100644 index 000000000..1e362798d --- /dev/null +++ b/DSL/tests/resources/formatting/statements/expression statements/in segment.sdstest @@ -0,0 +1,9 @@ +segment mySegment() { + call() ; +} + +// ----------------------------------------------------------------------------- + +segment mySegment() { + call(); +} diff --git a/DSL/tests/resources/formatting/statements/flexible new lines/in block lambda.sdstest b/DSL/tests/resources/formatting/statements/flexible new lines/in block lambda.sdstest new file mode 100644 index 000000000..650daa99e --- /dev/null +++ b/DSL/tests/resources/formatting/statements/flexible new lines/in block lambda.sdstest @@ -0,0 +1,20 @@ +pipeline myPipeline { + () { + + val a = 0 ; + + val a , _ , yield b = call() ; + + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + + val a = 0; + + val a, _, yield b = call(); + }; +} diff --git a/DSL/tests/resources/formatting/statements/flexible new lines/in pipeline.sdstest b/DSL/tests/resources/formatting/statements/flexible new lines/in pipeline.sdstest new file mode 100644 index 000000000..8b7384544 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/flexible new lines/in pipeline.sdstest @@ -0,0 +1,16 @@ +pipeline myPipeline { + + val a = 0 ; + + val a , _ , yield b = call() ; + + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + + val a = 0; + + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/statements/flexible new lines/in segment.sdstest b/DSL/tests/resources/formatting/statements/flexible new lines/in segment.sdstest new file mode 100644 index 000000000..76bd75c71 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/flexible new lines/in segment.sdstest @@ -0,0 +1,16 @@ +segment mySegment() { + + val a = 0 ; + + val a , _ , yield b = call() ; + + } + +// ----------------------------------------------------------------------------- + +segment mySegment() { + + val a = 0; + + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (complex).sdstest new file mode 100644 index 000000000..ac01c901b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (complex).sdstest @@ -0,0 +1,8 @@ +@A(f() , 2 , ) + +// ----------------------------------------------------------------------------- + +@A( + f(), + 2, +) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (long).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (long).sdstest new file mode 100644 index 000000000..f64182ffa --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (long).sdstest @@ -0,0 +1,10 @@ +@A(1 , 2 , 3 , 4 , ) + +// ----------------------------------------------------------------------------- + +@A( + 1, + 2, + 3, + 4, +) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest new file mode 100644 index 000000000..073b2004f --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest @@ -0,0 +1,5 @@ +@A(1, 2,) + +// ----------------------------------------------------------------------------- + +@A(1, 2,) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call.sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call.sdstest new file mode 100644 index 000000000..de6693cd4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call.sdstest @@ -0,0 +1,5 @@ +@A(1 , 2 , ) + +// ----------------------------------------------------------------------------- + +@A(1, 2,) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call (complex).sdstest new file mode 100644 index 000000000..3e03439ff --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call (complex).sdstest @@ -0,0 +1,12 @@ +pipeline p { + f(f() , 2 , ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + f(), + 2, + ); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call (long).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call (long).sdstest new file mode 100644 index 000000000..dcb67ee49 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call (long).sdstest @@ -0,0 +1,14 @@ +pipeline p { + f(1 , 2 , 3 , 4 , ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + 1, + 2, + 3, + 4, + ); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest new file mode 100644 index 000000000..32c925f9a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(1, 2,); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(1, 2,); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call.sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call.sdstest new file mode 100644 index 000000000..c7a0b4059 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call.sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(1 , 2 , ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(1, 2,); +} diff --git a/DSL/tests/resources/formatting/trailing commas/assignee list of assignment in block lambda.sdstest b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment in block lambda.sdstest new file mode 100644 index 000000000..06d540949 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment in block lambda.sdstest @@ -0,0 +1,13 @@ +pipeline p { + () { + val a , val b , = f(); + }; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + () { + val a, val b, = f(); + }; +} diff --git a/DSL/tests/resources/formatting/trailing commas/assignee list of assignment.sdstest b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment.sdstest new file mode 100644 index 000000000..8a96454f5 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment.sdstest @@ -0,0 +1,9 @@ +pipeline p { + val a , val b , = f(); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + val a, val b, = f(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/column list of schema.sdstest b/DSL/tests/resources/formatting/trailing commas/column list of schema.sdstest new file mode 100644 index 000000000..a1e22dc97 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/column list of schema.sdstest @@ -0,0 +1,11 @@ +schema MySchemaWithTrailingComma { + "column1" : Int , + "column2" : String , + } + +// ----------------------------------------------------------------------------- + +schema MySchemaWithTrailingComma { + "column1": Int, + "column2": String, +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of annotation.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of annotation.sdstest new file mode 100644 index 000000000..688bbadc4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of annotation.sdstest @@ -0,0 +1,11 @@ +annotation A where { + T sub Any , + T super Int , + } + +// ----------------------------------------------------------------------------- + +annotation A where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of class.sdstest new file mode 100644 index 000000000..049700527 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of class.sdstest @@ -0,0 +1,11 @@ +class C where { + T sub Any , + T super Int , + } + +// ----------------------------------------------------------------------------- + +class C where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of enum variant.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of enum variant.sdstest new file mode 100644 index 000000000..9119d4e3d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of enum variant.sdstest @@ -0,0 +1,15 @@ +enum E { + A where { + T sub Any , + T super Int , + } +} + +// ----------------------------------------------------------------------------- + +enum E { + A where { + T sub Any, + T super Int, + } +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of function.sdstest new file mode 100644 index 000000000..59e36e1b7 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of function.sdstest @@ -0,0 +1,11 @@ +fun f() where { + T sub Any , + T super Int , + } + +// ----------------------------------------------------------------------------- + +fun f() where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (complex).sdstest new file mode 100644 index 000000000..6dccd04e5 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (complex).sdstest @@ -0,0 +1,8 @@ +annotation A(a: A.B , b: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: A.B, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (long).sdstest new file mode 100644 index 000000000..ed2c59cb6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (long).sdstest @@ -0,0 +1,10 @@ +annotation A(a: Int , b: Int , c: Int , d: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: Int, + b: Int, + c: Int, + d: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest new file mode 100644 index 000000000..c1f7357d5 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest @@ -0,0 +1,5 @@ +annotation A(a: Int, b: Int,) + +// ----------------------------------------------------------------------------- + +annotation A(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (with annotation).sdstest new file mode 100644 index 000000000..ecf5740c1 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (with annotation).sdstest @@ -0,0 +1,9 @@ +annotation A(@Annotation a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A( + @Annotation + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation.sdstest new file mode 100644 index 000000000..b1a4ece00 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation.sdstest @@ -0,0 +1,5 @@ +annotation A(a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (complex).sdstest new file mode 100644 index 000000000..6866a86d9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (complex).sdstest @@ -0,0 +1,12 @@ +pipeline p { + (a: A.B , b: Int , ){}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int, + ) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (long).sdstest new file mode 100644 index 000000000..84eee0439 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (long).sdstest @@ -0,0 +1,14 @@ +pipeline p { + (a: Int , b: Int , c: Int , d: Int , ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int, + ) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest new file mode 100644 index 000000000..60c557af2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first, second,) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (with annotation).sdstest new file mode 100644 index 000000000..66f19f9ff --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (with annotation).sdstest @@ -0,0 +1,13 @@ +pipeline p { + (@Annotation a: Int , b: Int , ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + @Annotation + a: Int, + b: Int, + ) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda.sdstest new file mode 100644 index 000000000..bdfa93249 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda.sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first , second , ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (complex).sdstest new file mode 100644 index 000000000..428c48c1e --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (complex).sdstest @@ -0,0 +1,12 @@ +segment s( + f: (a: A.B , b: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: A.B, + b: Int, + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (long).sdstest new file mode 100644 index 000000000..334943780 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (long).sdstest @@ -0,0 +1,14 @@ +segment s( + f: (a: Int , b: Int , c: Int , d: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: Int, + b: Int, + c: Int, + d: Int, + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest new file mode 100644 index 000000000..27e465733 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest @@ -0,0 +1,9 @@ +segment s( + f: (x: Int, y: Int,) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: (x: Int, y: Int,) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (with annotation).sdstest new file mode 100644 index 000000000..68af11066 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (with annotation).sdstest @@ -0,0 +1,13 @@ +segment s( + f: (@Annotation a: Int , b: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + @Annotation + a: Int, + b: Int, + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type.sdstest new file mode 100644 index 000000000..d546c2292 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: (x: Int , y: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: (x: Int, y: Int,) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (complex).sdstest new file mode 100644 index 000000000..507457eb4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (complex).sdstest @@ -0,0 +1,8 @@ +class C(a: A.B , b: Int , ) + +// ----------------------------------------------------------------------------- + +class C( + a: A.B, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (long).sdstest new file mode 100644 index 000000000..184a9a2ba --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (long).sdstest @@ -0,0 +1,10 @@ +class C(a: Int , b: Int , c: Int , d: Int , ) + +// ----------------------------------------------------------------------------- + +class C( + a: Int, + b: Int, + c: Int, + d: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest new file mode 100644 index 000000000..e9450d923 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest @@ -0,0 +1,5 @@ +class C(a: Int, b: Int,) + +// ----------------------------------------------------------------------------- + +class C(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (with annotation).sdstest new file mode 100644 index 000000000..5bdb796c7 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (with annotation).sdstest @@ -0,0 +1,9 @@ +class C(@Annotation a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +class C( + @Annotation + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class.sdstest new file mode 100644 index 000000000..42908183c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class.sdstest @@ -0,0 +1,5 @@ +class C(a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +class C(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (complex).sdstest new file mode 100644 index 000000000..bcae9764a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (complex).sdstest @@ -0,0 +1,12 @@ +enum E { + A(a: A.B , b: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: A.B, + b: Int, + ) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (long).sdstest new file mode 100644 index 000000000..b313a9558 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (long).sdstest @@ -0,0 +1,14 @@ +enum E { + A(a: Int , b: Int , c: Int , d: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: Int, + b: Int, + c: Int, + d: Int, + ) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest new file mode 100644 index 000000000..b4e40c6b6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest @@ -0,0 +1,9 @@ +enum E { + A(a: Int, b: Int,) +} + +// ----------------------------------------------------------------------------- + +enum E { + A(a: Int, b: Int,) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (with annotation).sdstest new file mode 100644 index 000000000..58496e85d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (with annotation).sdstest @@ -0,0 +1,13 @@ +enum E { + A(@Annotation a: Int , b: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + @Annotation + a: Int, + b: Int, + ) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant.sdstest new file mode 100644 index 000000000..c09fd65b9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant.sdstest @@ -0,0 +1,9 @@ +enum E { + A(a: Int , b: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A(a: Int, b: Int,) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (complex).sdstest new file mode 100644 index 000000000..7c7a05e8b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (complex).sdstest @@ -0,0 +1,12 @@ +pipeline p { + (a: A.B , b: Int , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int, + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (long).sdstest new file mode 100644 index 000000000..9eb0b6977 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (long).sdstest @@ -0,0 +1,14 @@ +pipeline p { + (a: Int , b: Int , c: Int , d: Int , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int, + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest new file mode 100644 index 000000000..9a9cc4825 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first, second,) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (with annotation).sdstest new file mode 100644 index 000000000..c296f492a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (with annotation).sdstest @@ -0,0 +1,13 @@ +pipeline p { + (@Annotation a: Int , b: Int , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + @Annotation + a: Int, + b: Int, + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda.sdstest new file mode 100644 index 000000000..a6d19261e --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda.sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first , second , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (complex).sdstest new file mode 100644 index 000000000..86dc4df2d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (complex).sdstest @@ -0,0 +1,8 @@ +fun f(a: A.B , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f( + a: A.B, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (long).sdstest new file mode 100644 index 000000000..c51b2d7c0 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (long).sdstest @@ -0,0 +1,10 @@ +fun f(a: Int , b: Int , c: Int , d: Int , ) + +// ----------------------------------------------------------------------------- + +fun f( + a: Int, + b: Int, + c: Int, + d: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest new file mode 100644 index 000000000..094ebfb17 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest @@ -0,0 +1,5 @@ +fun f(a: Int, b: Int,) + +// ----------------------------------------------------------------------------- + +fun f(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (with annotation).sdstest new file mode 100644 index 000000000..e5711472f --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (with annotation).sdstest @@ -0,0 +1,9 @@ +fun f(@Annotation a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f( + @Annotation + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function.sdstest new file mode 100644 index 000000000..be4f8e33f --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function.sdstest @@ -0,0 +1,5 @@ +fun f(a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (complex).sdstest new file mode 100644 index 000000000..c17890192 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (complex).sdstest @@ -0,0 +1,8 @@ +segment s(a: A.B , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: A.B, + b: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (long).sdstest new file mode 100644 index 000000000..49407f811 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (long).sdstest @@ -0,0 +1,10 @@ +segment s(a: Int , b: Int , c: Int , d: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: Int, + b: Int, + c: Int, + d: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest new file mode 100644 index 000000000..50846c18c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest @@ -0,0 +1,5 @@ +segment s(a: Int, b: Int,) {} + +// ----------------------------------------------------------------------------- + +segment s(a: Int, b: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (with annotation).sdstest new file mode 100644 index 000000000..562e88312 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (with annotation).sdstest @@ -0,0 +1,9 @@ +segment s(@Annotation a: Int , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s( + @Annotation + a: Int, + b: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment.sdstest new file mode 100644 index 000000000..d54279f27 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment.sdstest @@ -0,0 +1,5 @@ +segment s(a: Int , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s(a: Int, b: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parent type list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/parent type list of class.sdstest new file mode 100644 index 000000000..548bce999 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parent type list of class.sdstest @@ -0,0 +1,5 @@ +class C sub D , E , {} + +// ----------------------------------------------------------------------------- + +class C sub D, E, {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (complex).sdstest new file mode 100644 index 000000000..bf97ef7d4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (complex).sdstest @@ -0,0 +1,12 @@ +segment s( + f: () -> (x: A.B , y: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: A.B, + y: Int, + ) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (long).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (long).sdstest new file mode 100644 index 000000000..5d6ac81a9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (long).sdstest @@ -0,0 +1,14 @@ +segment s( + f: () -> (x: Int , y: Int , a: Int , b: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: Int, + y: Int, + a: Int, + b: Int, + ) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest new file mode 100644 index 000000000..529a56f3b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest @@ -0,0 +1,9 @@ +segment s( + f: () -> (x: Int, y: Int,) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> (x: Int, y: Int,) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (with annotation).sdstest new file mode 100644 index 000000000..ce274a107 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (with annotation).sdstest @@ -0,0 +1,13 @@ +segment s( + f: () -> (@Annotation x: Int , y: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + @Annotation + x: Int, + y: Int, + ) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type.sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type.sdstest new file mode 100644 index 000000000..c0f2822e2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: () -> (x: Int , y: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> (x: Int, y: Int,) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (complex).sdstest new file mode 100644 index 000000000..e3df3a4a6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (complex).sdstest @@ -0,0 +1,8 @@ +fun f() -> (x: A.B , y: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: A.B, + y: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (long).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (long).sdstest new file mode 100644 index 000000000..aad0f52a1 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (long).sdstest @@ -0,0 +1,10 @@ +fun f() -> (x: Int , y: Int , a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: Int, + y: Int, + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest new file mode 100644 index 000000000..919b400d6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest @@ -0,0 +1,5 @@ +fun f() -> (first: Int, second: Int,) + +// ----------------------------------------------------------------------------- + +fun f() -> (first: Int, second: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (with annotation).sdstest new file mode 100644 index 000000000..a7922ce4a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (with annotation).sdstest @@ -0,0 +1,9 @@ +fun f() -> (@Annotation x: Int , y: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + @Annotation + x: Int, + y: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function.sdstest new file mode 100644 index 000000000..4f38d6dcb --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function.sdstest @@ -0,0 +1,5 @@ +fun f() -> (first: Int , second: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> (first: Int, second: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (complex).sdstest new file mode 100644 index 000000000..b0d72246c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (complex).sdstest @@ -0,0 +1,8 @@ +segment s() -> (x: A.B , y: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: A.B, + y: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (long).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (long).sdstest new file mode 100644 index 000000000..4ff55165c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (long).sdstest @@ -0,0 +1,10 @@ +segment s() -> (x: Int , y: Int , a: Int , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: Int, + y: Int, + a: Int, + b: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest new file mode 100644 index 000000000..42646bfc2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest @@ -0,0 +1,5 @@ +segment s() -> (first: Int, second: Int,) {} + +// ----------------------------------------------------------------------------- + +segment s() -> (first: Int, second: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (with annotation).sdstest new file mode 100644 index 000000000..e35e5c8f0 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (with annotation).sdstest @@ -0,0 +1,9 @@ +segment s() -> (@Annotation x: Int , y: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + @Annotation + x: Int, + y: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment.sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment.sdstest new file mode 100644 index 000000000..2f92b8c23 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment.sdstest @@ -0,0 +1,5 @@ +segment s() -> (first: Int , second: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> (first: Int, second: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest new file mode 100644 index 000000000..ede5ed5e2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of call.sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of call.sdstest new file mode 100644 index 000000000..1364593ec --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of call.sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of named type.sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of named type.sdstest new file mode 100644 index 000000000..bb34ddc33 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of named type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: Type +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: Type +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of union type.sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of union type.sdstest new file mode 100644 index 000000000..75b5f27c3 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of union type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: union +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: union +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class (long).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (long).sdstest new file mode 100644 index 000000000..0de4c7272 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (long).sdstest @@ -0,0 +1,10 @@ +class C + +// ----------------------------------------------------------------------------- + +class C< + K, + V, + X, + Y, +> diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest new file mode 100644 index 000000000..ef0e962a3 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest @@ -0,0 +1,5 @@ +class C + +// ----------------------------------------------------------------------------- + +class C diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (with annotation).sdstest new file mode 100644 index 000000000..44e9b2db1 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (with annotation).sdstest @@ -0,0 +1,9 @@ +class C<@Annotation K , V , > + +// ----------------------------------------------------------------------------- + +class C< + @Annotation + K, + V, +> diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class.sdstest new file mode 100644 index 000000000..a82487c6d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class.sdstest @@ -0,0 +1,5 @@ +class C + +// ----------------------------------------------------------------------------- + +class C diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (long).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (long).sdstest new file mode 100644 index 000000000..88a49c0c9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (long).sdstest @@ -0,0 +1,14 @@ +enum E { + A +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + K, + V, + X, + Y, + > +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest new file mode 100644 index 000000000..46d78026d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest @@ -0,0 +1,9 @@ +enum E { + A +} + +// ----------------------------------------------------------------------------- + +enum E { + A +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (with annotation).sdstest new file mode 100644 index 000000000..77c7ebe73 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (with annotation).sdstest @@ -0,0 +1,13 @@ +enum E { + A<@Annotation K , V , > +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + @Annotation + K, + V, + > +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant.sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant.sdstest new file mode 100644 index 000000000..0b83fbb40 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant.sdstest @@ -0,0 +1,9 @@ +enum E { + A +} + +// ----------------------------------------------------------------------------- + +enum E { + A +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function (long).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (long).sdstest new file mode 100644 index 000000000..019809b1b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (long).sdstest @@ -0,0 +1,10 @@ +fun f() + +// ----------------------------------------------------------------------------- + +fun f< + K, + V, + X, + Y, +>() diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest new file mode 100644 index 000000000..58cc04190 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest @@ -0,0 +1,5 @@ +fun f() + +// ----------------------------------------------------------------------------- + +fun f() diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (with annotation).sdstest new file mode 100644 index 000000000..83d95a2d6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (with annotation).sdstest @@ -0,0 +1,9 @@ +fun f<@Annotation K , V , >() + +// ----------------------------------------------------------------------------- + +fun f< + @Annotation + K, + V, +>() diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function.sdstest new file mode 100644 index 000000000..1120f5121 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function.sdstest @@ -0,0 +1,5 @@ +fun f() + +// ----------------------------------------------------------------------------- + +fun f() diff --git a/DSL/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..b6762571b --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest @@ -0,0 +1,16 @@ +segment s( + f: ( + a: A.B, + b: Int + ) -> () +) {} + + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: A.B, + b: Int + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with complex parameter list.sdstest b/DSL/tests/resources/formatting/types/callable types/with complex parameter list.sdstest new file mode 100644 index 000000000..6d03adefb --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex parameter list.sdstest @@ -0,0 +1,12 @@ +segment s( + f: ( a: A.B , b: Int ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: A.B, + b: Int + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest b/DSL/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest new file mode 100644 index 000000000..a3965cf66 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest @@ -0,0 +1,15 @@ +segment s( + f: () -> ( + x: A.B, + y: Int + ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: A.B, + y: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with complex result list.sdstest b/DSL/tests/resources/formatting/types/callable types/with complex result list.sdstest new file mode 100644 index 000000000..8622e3b1d --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex result list.sdstest @@ -0,0 +1,12 @@ +segment s( + f: () -> ( x: A.B , y: Int ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: A.B, + y: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with long parameter list.sdstest b/DSL/tests/resources/formatting/types/callable types/with long parameter list.sdstest new file mode 100644 index 000000000..0494c077b --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with long parameter list.sdstest @@ -0,0 +1,14 @@ +segment s( + f: ( a: Int , b: Int , c: Int , d: Int ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: Int, + b: Int, + c: Int, + d: Int + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with long result list.sdstest b/DSL/tests/resources/formatting/types/callable types/with long result list.sdstest new file mode 100644 index 000000000..742b41b13 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with long result list.sdstest @@ -0,0 +1,14 @@ +segment s( + f: () -> ( x: Int , y: Int , a: Int , b: Int ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: Int, + y: Int, + a: Int, + b: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with multiple parameters.sdstest b/DSL/tests/resources/formatting/types/callable types/with multiple parameters.sdstest new file mode 100644 index 000000000..e48bda244 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with multiple parameters.sdstest @@ -0,0 +1,37 @@ +segment mySegment( + f: ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: ( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with multiple results.sdstest b/DSL/tests/resources/formatting/types/callable types/with multiple results.sdstest new file mode 100644 index 000000000..4d3d9d323 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with multiple results.sdstest @@ -0,0 +1,20 @@ +segment mySegment( + f: ( ) -> ( + @Annotation a , + b , + c : Int , + d : Int + ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> ( + @Annotation + a, + b, + c: Int, + d: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one typed parameter.sdstest b/DSL/tests/resources/formatting/types/callable types/with one typed parameter.sdstest new file mode 100644 index 000000000..b6bd6dfea --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one typed parameter.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( param : Int ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: (param: Int) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one typed result (in parentheses).sdstest new file mode 100644 index 000000000..90b959f5c --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one typed result (in parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> ( result : Int ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> (result: Int) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one typed result (no parentheses).sdstest new file mode 100644 index 000000000..4ed503955 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one typed result (no parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> result : Int +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> result: Int +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one untyped parameter.sdstest b/DSL/tests/resources/formatting/types/callable types/with one untyped parameter.sdstest new file mode 100644 index 000000000..9694b039d --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one untyped parameter.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( param ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: (param) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one untyped result (in parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one untyped result (in parentheses).sdstest new file mode 100644 index 000000000..e70161c60 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one untyped result (in parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> ( result ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> (result) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..a0341b6c6 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one untyped result (no parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> result +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> result +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/without parameters or results.sdstest b/DSL/tests/resources/formatting/types/callable types/without parameters or results.sdstest new file mode 100644 index 000000000..cf40016d6 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/without parameters or results.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> () +) {} diff --git a/DSL/tests/resources/formatting/types/member types/long complex chain.sdstest b/DSL/tests/resources/formatting/types/member types/long complex chain.sdstest new file mode 100644 index 000000000..755bcf1df --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/long complex chain.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < > . MiddleClass < C , D > ? . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union<>.MiddleClass?.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (not nullable).sdstest new file mode 100644 index 000000000..cabc86476 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: ( ) -> ( ) . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: () -> ().InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (nullable).sdstest new file mode 100644 index 000000000..ee3526f1c --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: ( ) -> ( ) . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: () -> ().InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (not nullable).sdstest new file mode 100644 index 000000000..0533da552 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (nullable).sdstest new file mode 100644 index 000000000..c5bcfcda7 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass.InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (not nullable).sdstest new file mode 100644 index 000000000..d00fe49e5 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass ? . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass?.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (nullable).sdstest new file mode 100644 index 000000000..c5bcfcda7 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass.InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (union) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (not nullable).sdstest new file mode 100644 index 000000000..8d71c4f5f --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < > . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union<>.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (union) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (nullable).sdstest new file mode 100644 index 000000000..9c91c4b40 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < > . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union<>.InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/named types/no type arguments and not nullable.sdstest b/DSL/tests/resources/formatting/types/named types/no type arguments and not nullable.sdstest new file mode 100644 index 000000000..b67a6f346 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/no type arguments and not nullable.sdstest @@ -0,0 +1,5 @@ +segment mySegment(x: Int) {} + +// ----------------------------------------------------------------------------- + +segment mySegment(x: Int) {} diff --git a/DSL/tests/resources/formatting/types/named types/no type arguments and nullable.sdstest b/DSL/tests/resources/formatting/types/named types/no type arguments and nullable.sdstest new file mode 100644 index 000000000..aeb316775 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/no type arguments and nullable.sdstest @@ -0,0 +1,5 @@ +segment mySegment(x: Int ?) {} + +// ----------------------------------------------------------------------------- + +segment mySegment(x: Int?) {} diff --git a/DSL/tests/resources/formatting/types/named types/type argument and nullable.sdstest b/DSL/tests/resources/formatting/types/named types/type argument and nullable.sdstest new file mode 100644 index 000000000..306c15d72 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/type argument and nullable.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: Int < * , in Number , out Number , T = Number > ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: Int<*, in Number, out Number, T = Number>? +) {} diff --git a/DSL/tests/resources/formatting/types/named types/type arguments and not nullable.sdstest b/DSL/tests/resources/formatting/types/named types/type arguments and not nullable.sdstest new file mode 100644 index 000000000..93adc76b3 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/type arguments and not nullable.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: Int < * , in Number , out Number , T = Number> +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: Int<*, in Number, out Number, T = Number> +) {} diff --git a/DSL/tests/resources/formatting/types/union types/empty.sdstest b/DSL/tests/resources/formatting/types/union types/empty.sdstest new file mode 100644 index 000000000..c8bdf7bb3 --- /dev/null +++ b/DSL/tests/resources/formatting/types/union types/empty.sdstest @@ -0,0 +1,5 @@ +segment mySegment(x: union < >) {} + +// ----------------------------------------------------------------------------- + +segment mySegment(x: union<>) {} diff --git a/DSL/tests/resources/formatting/types/union types/nested.sdstest b/DSL/tests/resources/formatting/types/union types/nested.sdstest new file mode 100644 index 000000000..850c44b69 --- /dev/null +++ b/DSL/tests/resources/formatting/types/union types/nested.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < union < > > +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union> +) {} diff --git a/DSL/tests/resources/formatting/types/union types/with type arguments.sdstest b/DSL/tests/resources/formatting/types/union types/with type arguments.sdstest new file mode 100644 index 000000000..d9a68fa6e --- /dev/null +++ b/DSL/tests/resources/formatting/types/union types/with type arguments.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < Int , String > +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union +) {} diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/bad-unclosed argument list.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/bad-unclosed argument list.sdstest new file mode 100644 index 000000000..8e537c4ca --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotation calls/bad-unclosed argument list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +@Annotation( diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-empty argument list.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-empty argument list.sdstest new file mode 100644 index 000000000..af0cf4067 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-empty argument list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +@Annotation() diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-multiple arguments.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-multiple arguments.sdstest new file mode 100644 index 000000000..7c510cf61 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-multiple arguments.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +@Annotation(1, a = 2) diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-named argument.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-named argument.sdstest new file mode 100644 index 000000000..ba1993365 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-named argument.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +@Annotation(b = 2) diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-no argument list.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-no argument list.sdstest new file mode 100644 index 000000000..b0f0c5981 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-no argument list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +@Annotation diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-positional argument.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-positional argument.sdstest new file mode 100644 index 000000000..319c6983c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-positional argument.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +@Annotation(1) diff --git a/DSL/tests/resources/grammar/declarations/annotations/bad-unclosed constraint list.sdstest b/DSL/tests/resources/grammar/declarations/annotations/bad-unclosed constraint list.sdstest new file mode 100644 index 000000000..4116a938e --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/bad-unclosed constraint list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +annotation MyAnnotation where { diff --git a/DSL/tests/resources/grammar/declarations/annotations/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/annotations/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..ec0beccfc --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/bad-unclosed parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +annotation MyAnnotation( diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-annotation call.sdstest new file mode 100644 index 000000000..d867f6cbf --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +annotation MyAnnotation diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-empty parameter list.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-empty parameter list.sdstest new file mode 100644 index 000000000..54d35f274 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-empty parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation() diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-multiple parameters.sdstest new file mode 100644 index 000000000..81899746c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-multiple parameters.sdstest @@ -0,0 +1,12 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-no parameter list.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-no parameter list.sdstest new file mode 100644 index 000000000..a4a5a34d0 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-no parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with multiple constraints.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with multiple constraints.sdstest new file mode 100644 index 000000000..3ef08442f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with multiple constraints.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with sub constraint.sdstest new file mode 100644 index 000000000..a58135efb --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with sub constraint.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation where { + T sub Number +} diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with super constraint.sdstest new file mode 100644 index 000000000..cc9f5c23d --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with super constraint.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation where { + T super Number +} diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..3e6928b3f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with typed optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(a: Int = 1) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with typed required parameter.sdstest new file mode 100644 index 000000000..e3942d821 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with typed required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(a: Int) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..ae66c5f43 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(vararg a: Int = 1) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..4688982bc --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with typed variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(vararg a: Int) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..9ba50ee54 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(a = 1) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..d060c811d --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(a) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..c25497dbb --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(vararg a = 1) diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..9b68704d3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with untyped variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +annotation MyAnnotation(vararg a) diff --git a/DSL/tests/resources/grammar/declarations/classes/attributes/good-annotated.sdstest b/DSL/tests/resources/grammar/declarations/classes/attributes/good-annotated.sdstest new file mode 100644 index 000000000..11ebf0fcf --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/attributes/good-annotated.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + @Annotation attr a +} diff --git a/DSL/tests/resources/grammar/declarations/classes/attributes/good-no type.sdstest b/DSL/tests/resources/grammar/declarations/classes/attributes/good-no type.sdstest new file mode 100644 index 000000000..1b6832792 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/attributes/good-no type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + attr a +} diff --git a/DSL/tests/resources/grammar/declarations/classes/attributes/good-static.sdstest b/DSL/tests/resources/grammar/declarations/classes/attributes/good-static.sdstest new file mode 100644 index 000000000..c256ad517 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/attributes/good-static.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + static attr a: Int +} diff --git a/DSL/tests/resources/grammar/declarations/classes/attributes/good-with type.sdstest b/DSL/tests/resources/grammar/declarations/classes/attributes/good-with type.sdstest new file mode 100644 index 000000000..8c5eaa374 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/attributes/good-with type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + attr a: Int +} diff --git a/DSL/tests/resources/grammar/declarations/classes/bad-empty parent type list.sdstest b/DSL/tests/resources/grammar/declarations/classes/bad-empty parent type list.sdstest new file mode 100644 index 000000000..a4bb256c3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/bad-empty parent type list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class MyClass sub diff --git a/DSL/tests/resources/grammar/declarations/classes/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed body.sdstest new file mode 100644 index 000000000..87b9a8c44 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class MyClass { diff --git a/DSL/tests/resources/grammar/declarations/classes/bad-unclosed constraint list.sdstest b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed constraint list.sdstest new file mode 100644 index 000000000..bb2ac2a47 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed constraint list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class MyClass where { diff --git a/DSL/tests/resources/grammar/declarations/classes/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..63fd5d814 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class MyClass( diff --git a/DSL/tests/resources/grammar/declarations/classes/bad-unclosed type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed type parameter list.sdstest new file mode 100644 index 000000000..a86d4586b --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/bad-unclosed type parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class MyClass< diff --git a/DSL/tests/resources/grammar/declarations/classes/good-annotated type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-annotated type parameter.sdstest new file mode 100644 index 000000000..0b2a242b4 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-annotated type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass<@Annotation T> diff --git a/DSL/tests/resources/grammar/declarations/classes/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-annotation call.sdstest new file mode 100644 index 000000000..c86c9b5b8 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +class MyClass diff --git a/DSL/tests/resources/grammar/declarations/classes/good-contravariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-contravariant type parameter.sdstest new file mode 100644 index 000000000..b542c6574 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-contravariant type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass diff --git a/DSL/tests/resources/grammar/declarations/classes/good-covariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-covariant type parameter.sdstest new file mode 100644 index 000000000..3a50b5d43 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-covariant type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass diff --git a/DSL/tests/resources/grammar/declarations/classes/good-empty body.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-empty body.sdstest new file mode 100644 index 000000000..4576be592 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-empty body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass {} diff --git a/DSL/tests/resources/grammar/declarations/classes/good-empty constraint list.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-empty constraint list.sdstest new file mode 100644 index 000000000..982a5c1a6 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-empty constraint list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass where {} diff --git a/DSL/tests/resources/grammar/declarations/classes/good-empty parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-empty parameter list.sdstest new file mode 100644 index 000000000..fe7486081 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-empty parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass() diff --git a/DSL/tests/resources/grammar/declarations/classes/good-empty type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-empty type parameter list.sdstest new file mode 100644 index 000000000..a06a28939 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-empty type parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass<> diff --git a/DSL/tests/resources/grammar/declarations/classes/good-invariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-invariant type parameter.sdstest new file mode 100644 index 000000000..28d268077 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-invariant type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass diff --git a/DSL/tests/resources/grammar/declarations/classes/good-minimal.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-minimal.sdstest new file mode 100644 index 000000000..0b2a10039 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-minimal.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass diff --git a/DSL/tests/resources/grammar/declarations/classes/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-multiple parameters.sdstest new file mode 100644 index 000000000..0378c142c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-multiple parameters.sdstest @@ -0,0 +1,12 @@ +// $TEST$ no_syntax_error + +class MyClass( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-multiple parent types.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-multiple parent types.sdstest new file mode 100644 index 000000000..0c1a84602 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-multiple parent types.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass sub Int, Number diff --git a/DSL/tests/resources/grammar/declarations/classes/good-multiple type parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-multiple type parameters.sdstest new file mode 100644 index 000000000..f70d8cfc9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-multiple type parameters.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass<@Annotation T, in S, out U> diff --git a/DSL/tests/resources/grammar/declarations/classes/good-one parent type.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-one parent type.sdstest new file mode 100644 index 000000000..1231a1b70 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-one parent type.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass sub Int diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with multiple constraints.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with multiple constraints.sdstest new file mode 100644 index 000000000..70d006db2 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with multiple constraints.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +class MyClass where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with sub constraint.sdstest new file mode 100644 index 000000000..be19fbf57 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with sub constraint.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass where { + T sub Number +} diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with super constraint.sdstest new file mode 100644 index 000000000..644c8ba78 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with super constraint.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass where { + T super Number +} diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..076ed97dc --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with typed optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(a: Int = 1) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with typed required parameter.sdstest new file mode 100644 index 000000000..3785d50c5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with typed required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(a: Int) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..7d80bbf85 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(vararg a: Int = 1) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..d8d9493ee --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with typed variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(vararg a: Int) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..9a29e763c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with untyped optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(a = 1) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..d02baee9a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with untyped required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(a) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..9e9ee04b3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(vararg a = 1) diff --git a/DSL/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..5335427be --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/good-with untyped variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class MyClass(vararg a) diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/bad-missing parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/bad-missing parameter list.sdstest new file mode 100644 index 000000000..498a632f5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/bad-missing parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyClass { + fun myFunction +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed constraint list.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed constraint list.sdstest new file mode 100644 index 000000000..0eaeeff59 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed constraint list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyClass { + fun myFunction() where { +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..637b8a4f8 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyClass { + fun myFunction( +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed type parameter list.sdstest new file mode 100644 index 000000000..7b277e40f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/bad-unclosed type parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyClass { + fun myFunction<() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-annotated type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-annotated type parameter.sdstest new file mode 100644 index 000000000..ef477d564 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-annotated type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction<@Annotation T>() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-annotation call.sdstest new file mode 100644 index 000000000..facc23d9f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +class MyClass { + @Annotation + fun myFunction() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-contravariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-contravariant type parameter.sdstest new file mode 100644 index 000000000..07271cf21 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-contravariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-covariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-covariant type parameter.sdstest new file mode 100644 index 000000000..fe603d14c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-covariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-empty constraint list.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-empty constraint list.sdstest new file mode 100644 index 000000000..0ef8b4736 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-empty constraint list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() where {} +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-empty type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-empty type parameter list.sdstest new file mode 100644 index 000000000..bb9ef8be8 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-empty type parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction<>() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-invariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-invariant type parameter.sdstest new file mode 100644 index 000000000..42bbab079 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-invariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple parameters.sdstest new file mode 100644 index 000000000..2e94b1976 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple parameters.sdstest @@ -0,0 +1,14 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple results.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple results.sdstest new file mode 100644 index 000000000..654eba343 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple results.sdstest @@ -0,0 +1,10 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() -> ( + @Annotation a, + b, + c: Int, + d: Int + ) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple type parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple type parameters.sdstest new file mode 100644 index 000000000..e032ddda5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-multiple type parameters.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction<@Annotation T, in S, out U>() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-no parameters and no results.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-no parameters and no results.sdstest new file mode 100644 index 000000000..0a0ea9b6a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-no parameters and no results.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-no results (explicit).sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-no results (explicit).sdstest new file mode 100644 index 000000000..d0ae9f569 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-no results (explicit).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() -> () +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-one typed result (in parentheses).sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-one typed result (in parentheses).sdstest new file mode 100644 index 000000000..aa436229a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-one typed result (in parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() -> (a: Int) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-one typed result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-one typed result (no parentheses).sdstest new file mode 100644 index 000000000..997a429ae --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-one typed result (no parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() -> a: Int +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-one untyped result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..75dc6dd31 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-one untyped result (no parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() -> a +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-one untyped result (with parentheses).sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..a9b8e054c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-one untyped result (with parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() -> (a) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-static.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-static.sdstest new file mode 100644 index 000000000..cd54cd70c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-static.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + static fun myFunction() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with multiple constraints.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with multiple constraints.sdstest new file mode 100644 index 000000000..547148a72 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with multiple constraints.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with sub constraint.sdstest new file mode 100644 index 000000000..556ef38a4 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with sub constraint.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() where { + T sub Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with super constraint.sdstest new file mode 100644 index 000000000..d204b1865 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with super constraint.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction() where { + T super Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..d9cda4c57 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(a: Int = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed required parameter.sdstest new file mode 100644 index 000000000..69ecf9bf5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(a: Int) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..0eaa6ae59 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..88cb12bb0 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(vararg a: Int) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..38ab3d3e9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(a = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..4fb35f804 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(a) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..0db9826d1 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(vararg a = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..94936d712 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/methods/good-with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + fun myFunction(vararg a) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-empty parent type list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-empty parent type list.sdstest new file mode 100644 index 000000000..0a05ec67e --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-empty parent type list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyOuterClass { + class MyClass sub +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed body.sdstest new file mode 100644 index 000000000..f4152d904 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyOuterClass { + class MyClass { +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed constraint list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed constraint list.sdstest new file mode 100644 index 000000000..82070763b --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed constraint list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyOuterClass { + class MyClass where { +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..5c7008153 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyOuterClass { + class MyClass( +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed type parameter list.sdstest new file mode 100644 index 000000000..43f00552d --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/bad-unclosed type parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyOuterClass { + class MyClass< +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-annotated type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-annotated type parameter.sdstest new file mode 100644 index 000000000..bf7b50f2b --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-annotated type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass<@Annotation T> +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-annotation call.sdstest new file mode 100644 index 000000000..78b0330b8 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + @Annotation + class MyClass +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-contravariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-contravariant type parameter.sdstest new file mode 100644 index 000000000..e6312b2cd --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-contravariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-covariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-covariant type parameter.sdstest new file mode 100644 index 000000000..6dcfbd6ae --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-covariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty body.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty body.sdstest new file mode 100644 index 000000000..ba9f55304 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass {} +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty constraint list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty constraint list.sdstest new file mode 100644 index 000000000..d5ed6c64f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty constraint list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass where {} +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty parameter list.sdstest new file mode 100644 index 000000000..62bdbc2d6 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass() +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty type parameter list.sdstest new file mode 100644 index 000000000..a6389af26 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-empty type parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass<> +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-invariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-invariant type parameter.sdstest new file mode 100644 index 000000000..c1909abee --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-invariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-minimal.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-minimal.sdstest new file mode 100644 index 000000000..f090b40bd --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-minimal.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple parameters.sdstest new file mode 100644 index 000000000..d1cf4eec3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple parameters.sdstest @@ -0,0 +1,14 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple parent types.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple parent types.sdstest new file mode 100644 index 000000000..c13836076 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple parent types.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass sub Int, Number +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple type parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple type parameters.sdstest new file mode 100644 index 000000000..1cb975c4b --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-multiple type parameters.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass<@Annotation T, in S, out U> +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-parent type.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-parent type.sdstest new file mode 100644 index 000000000..c5add9856 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-parent type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass sub Int +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with multiple constraints.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with multiple constraints.sdstest new file mode 100644 index 000000000..29dd0ba8c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with multiple constraints.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with sub constraint.sdstest new file mode 100644 index 000000000..16548247c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with sub constraint.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass where { + T sub Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with super constraint.sdstest new file mode 100644 index 000000000..1303a7b3f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with super constraint.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass where { + T super Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..053c531cd --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(a: Int = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed required parameter.sdstest new file mode 100644 index 000000000..dbe860885 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(a: Int) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..6ef626686 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..e3a4c7d43 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(vararg a: Int) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..852ff8b44 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(a = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..1b111ca92 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(a) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..744fd22fd --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(vararg a = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..8f0f9cb64 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested classes/good-with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyOuterClass { + class MyClass(vararg a) +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/bad-unclosed body.sdstest new file mode 100644 index 000000000..3d49bba54 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/bad-unclosed body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class MyClass { + enum MyEnum { +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-annotation call.sdstest new file mode 100644 index 000000000..a2b634af3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +class MyClass { + @Annotation + enum MyEnum +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/good-empty body.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-empty body.sdstest new file mode 100644 index 000000000..d228e3133 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-empty body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum {} +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/good-no body.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-no body.sdstest new file mode 100644 index 000000000..5056f93e1 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-no body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/good-variants in body.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-variants in body.sdstest new file mode 100644 index 000000000..43204381c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/good-variants in body.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed constraint list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed constraint list.sdstest new file mode 100644 index 000000000..8515729dc --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed constraint list.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant where { + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..cb921cd27 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed parameter list.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant( + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed type parameter list.sdstest new file mode 100644 index 000000000..00e45134b --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/bad-unclosed type parameter list.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant< + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-annotated type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-annotated type parameter.sdstest new file mode 100644 index 000000000..05662f2c6 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-annotated type parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant<@Annotation T> + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-annotation call.sdstest new file mode 100644 index 000000000..4a7b9052d --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-annotation call.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + @Annotation + MyEnumVariant + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-contravariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-contravariant type parameter.sdstest new file mode 100644 index 000000000..a59a465f1 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-contravariant type parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-covariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-covariant type parameter.sdstest new file mode 100644 index 000000000..3d78ff8a7 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-covariant type parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-empty type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-empty type parameter list.sdstest new file mode 100644 index 000000000..3a9d6f023 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-empty type parameter list.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant<> + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-invariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-invariant type parameter.sdstest new file mode 100644 index 000000000..a795f912a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-invariant type parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple parameters.sdstest new file mode 100644 index 000000000..d549a77cc --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple parameters.sdstest @@ -0,0 +1,16 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple type parameters.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple type parameters.sdstest new file mode 100644 index 000000000..c82b88cd0 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-multiple type parameters.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant<@Annotation T, in S, out U> + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-no parameter list.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-no parameter list.sdstest new file mode 100644 index 000000000..43204381c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-no parameter list.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with multiple constraints.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with multiple constraints.sdstest new file mode 100644 index 000000000..9cc2772d5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with multiple constraints.sdstest @@ -0,0 +1,10 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number, + S super Number + } + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with sub constraint.sdstest new file mode 100644 index 000000000..719b83b93 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with sub constraint.sdstest @@ -0,0 +1,9 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number + } + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with super constraint.sdstest new file mode 100644 index 000000000..360126ff6 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with super constraint.sdstest @@ -0,0 +1,9 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T super Number + } + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..d52dc47f5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed optional parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(a: Int = 1) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed required parameter.sdstest new file mode 100644 index 000000000..6b69a28fd --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed required parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(a: Int) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a8f9f1f73 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a: Int = 1) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..c2cc62905 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with typed variadic parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a: Int) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..33412265b --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped optional parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(a = 1) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..c35df69f7 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped required parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(a) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..b8ffb4c64 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a = 1) + } +} diff --git a/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..7958d78d4 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/classes/nested enums/variants/good-with untyped variadic parameter.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a) + } +} diff --git a/DSL/tests/resources/grammar/declarations/enums/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/enums/bad-unclosed body.sdstest new file mode 100644 index 000000000..f80c9cee3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/bad-unclosed body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +enum MyEnum { diff --git a/DSL/tests/resources/grammar/declarations/enums/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/enums/good-annotation call.sdstest new file mode 100644 index 000000000..f4e602fe5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +enum MyEnum diff --git a/DSL/tests/resources/grammar/declarations/enums/good-empty body.sdstest b/DSL/tests/resources/grammar/declarations/enums/good-empty body.sdstest new file mode 100644 index 000000000..44b08ebc3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/good-empty body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +enum MyEnum {} diff --git a/DSL/tests/resources/grammar/declarations/enums/good-no body.sdstest b/DSL/tests/resources/grammar/declarations/enums/good-no body.sdstest new file mode 100644 index 000000000..a5b34a99e --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/good-no body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +enum MyEnum diff --git a/DSL/tests/resources/grammar/declarations/enums/good-variants in body.sdstest b/DSL/tests/resources/grammar/declarations/enums/good-variants in body.sdstest new file mode 100644 index 000000000..b12562bc9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/good-variants in body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed constraint list.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed constraint list.sdstest new file mode 100644 index 000000000..69c439741 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed constraint list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +enum MyEnum { + MyEnumVariant where { +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..3dea580f6 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +enum MyEnum { + MyEnumVariant( +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed type parameter list.sdstest new file mode 100644 index 000000000..e3216866a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/bad-unclosed type parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +enum MyEnum { + MyEnumVariant< +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-annotated type parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-annotated type parameter.sdstest new file mode 100644 index 000000000..66d095001 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-annotated type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant<@Annotation T> +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-annotation call.sdstest new file mode 100644 index 000000000..05a3e6a07 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + @Annotation + MyEnumVariant +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-contravariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-contravariant type parameter.sdstest new file mode 100644 index 000000000..dc652ceca --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-contravariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-covariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-covariant type parameter.sdstest new file mode 100644 index 000000000..6e1b2a6f0 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-covariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-empty type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-empty type parameter list.sdstest new file mode 100644 index 000000000..9255ba4ef --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-empty type parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant<> +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-invariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-invariant type parameter.sdstest new file mode 100644 index 000000000..1a2358796 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-invariant type parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-multiple parameters.sdstest new file mode 100644 index 000000000..8a7f2fb10 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-multiple parameters.sdstest @@ -0,0 +1,14 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-multiple type parameters.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-multiple type parameters.sdstest new file mode 100644 index 000000000..3b231db6c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-multiple type parameters.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant<@Annotation T, in S, out U> +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-no parameter list.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-no parameter list.sdstest new file mode 100644 index 000000000..b12562bc9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-no parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with multiple constraints.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with multiple constraints.sdstest new file mode 100644 index 000000000..9032477bb --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with multiple constraints.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with sub constraint.sdstest new file mode 100644 index 000000000..ae6c264ae --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with sub constraint.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant where { + T sub Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with super constraint.sdstest new file mode 100644 index 000000000..3075ab7a3 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with super constraint.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant where { + T super Number + } +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..d96e47e93 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(a: Int = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed required parameter.sdstest new file mode 100644 index 000000000..2ce58b312 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(a: Int) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..8109434ec --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..0fd1a1f6d --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(vararg a: Int) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..9dc984139 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(a = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..39bfc4a5f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(a) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..6cdccf1d2 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(vararg a = 1) +} diff --git a/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..742a3344c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/enums/variants/good-with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum MyEnum { + MyEnumVariant(vararg a) +} diff --git a/DSL/tests/resources/grammar/declarations/functions/bad-missing parameter list.sdstest b/DSL/tests/resources/grammar/declarations/functions/bad-missing parameter list.sdstest new file mode 100644 index 000000000..15819fa89 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/bad-missing parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +fun myFunction diff --git a/DSL/tests/resources/grammar/declarations/functions/bad-unclosed constraint list.sdstest b/DSL/tests/resources/grammar/declarations/functions/bad-unclosed constraint list.sdstest new file mode 100644 index 000000000..fb955879d --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/bad-unclosed constraint list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +fun myFunction() where { diff --git a/DSL/tests/resources/grammar/declarations/functions/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/functions/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..4a6912586 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/bad-unclosed parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +fun myFunction( diff --git a/DSL/tests/resources/grammar/declarations/functions/bad-unclosed type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/functions/bad-unclosed type parameter list.sdstest new file mode 100644 index 000000000..9f4204468 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/bad-unclosed type parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +fun myFunction<() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-annotated type parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-annotated type parameter.sdstest new file mode 100644 index 000000000..40967e527 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-annotated type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction<@Annotation T>() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-annotation call.sdstest new file mode 100644 index 000000000..1fcd9ca3f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +fun myFunction() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-contravariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-contravariant type parameter.sdstest new file mode 100644 index 000000000..180c50e9c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-contravariant type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-covariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-covariant type parameter.sdstest new file mode 100644 index 000000000..c7d1c7e69 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-covariant type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-empty constraint list.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-empty constraint list.sdstest new file mode 100644 index 000000000..faec38e5c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-empty constraint list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() where {} diff --git a/DSL/tests/resources/grammar/declarations/functions/good-empty type parameter list.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-empty type parameter list.sdstest new file mode 100644 index 000000000..912dae7ab --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-empty type parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction<>() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-invariant type parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-invariant type parameter.sdstest new file mode 100644 index 000000000..0bda94713 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-invariant type parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-multiple parameters.sdstest new file mode 100644 index 000000000..b0d409e92 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-multiple parameters.sdstest @@ -0,0 +1,12 @@ +// $TEST$ no_syntax_error + +fun myFunction( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-multiple results.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-multiple results.sdstest new file mode 100644 index 000000000..ebe5fb289 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-multiple results.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +fun myFunction() -> ( + @Annotation a, + b, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-multiple type parameters.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-multiple type parameters.sdstest new file mode 100644 index 000000000..5ea557cec --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-multiple type parameters.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction<@Annotation T, in S, out U>() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-no parameters and no results.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-no parameters and no results.sdstest new file mode 100644 index 000000000..38ac8b664 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-no parameters and no results.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() diff --git a/DSL/tests/resources/grammar/declarations/functions/good-no results (explicit).sdstest b/DSL/tests/resources/grammar/declarations/functions/good-no results (explicit).sdstest new file mode 100644 index 000000000..8a7ee30b0 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-no results (explicit).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() -> () diff --git a/DSL/tests/resources/grammar/declarations/functions/good-one typed result (in parentheses).sdstest b/DSL/tests/resources/grammar/declarations/functions/good-one typed result (in parentheses).sdstest new file mode 100644 index 000000000..932034a2f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-one typed result (in parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() -> (a: Int) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-one typed result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/functions/good-one typed result (no parentheses).sdstest new file mode 100644 index 000000000..c91c991cc --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-one typed result (no parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() -> a: Int diff --git a/DSL/tests/resources/grammar/declarations/functions/good-one untyped result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/functions/good-one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..b32182047 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-one untyped result (no parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() -> a diff --git a/DSL/tests/resources/grammar/declarations/functions/good-one untyped result (with parentheses).sdstest b/DSL/tests/resources/grammar/declarations/functions/good-one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..2333def59 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-one untyped result (with parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction() -> (a) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with multiple constraints.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with multiple constraints.sdstest new file mode 100644 index 000000000..b6c18c2bd --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with multiple constraints.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +fun myFunction() where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with sub constraint.sdstest new file mode 100644 index 000000000..e45cef0ab --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with sub constraint.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +fun myFunction() where { + T sub Number +} diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with super constraint.sdstest new file mode 100644 index 000000000..77356e3be --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with super constraint.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +fun myFunction() where { + T super Number +} diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..b5d6b5d96 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with typed optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(a: Int = 1) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with typed required parameter.sdstest new file mode 100644 index 000000000..9eae45a73 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with typed required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(a: Int) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a5f5d73a7 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(vararg a: Int = 1) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..b7dc315ad --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with typed variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(vararg a: Int) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..5d9eeac48 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with untyped optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(a = 1) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..89bd904fd --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with untyped required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(a) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..2b5a7af3b --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(vararg a = 1) diff --git a/DSL/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..bb49096c5 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/functions/good-with untyped variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun myFunction(vararg a) diff --git a/DSL/tests/resources/grammar/declarations/pipelines/bad-missing body.sdstest b/DSL/tests/resources/grammar/declarations/pipelines/bad-missing body.sdstest new file mode 100644 index 000000000..87b1fa7ec --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/pipelines/bad-missing body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +pipeline myPipeline diff --git a/DSL/tests/resources/grammar/declarations/pipelines/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/pipelines/bad-unclosed body.sdstest new file mode 100644 index 000000000..9710c4c78 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/pipelines/bad-unclosed body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +pipeline myPipeline { diff --git a/DSL/tests/resources/grammar/declarations/pipelines/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/pipelines/good-annotation call.sdstest new file mode 100644 index 000000000..b6c69990a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/pipelines/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +pipeline myPipeline {} diff --git a/DSL/tests/resources/grammar/declarations/pipelines/good-empty body.sdstest b/DSL/tests/resources/grammar/declarations/pipelines/good-empty body.sdstest new file mode 100644 index 000000000..e65f1eb9c --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/pipelines/good-empty body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline {} diff --git a/DSL/tests/resources/grammar/declarations/pipelines/good-statements in body.sdstest b/DSL/tests/resources/grammar/declarations/pipelines/good-statements in body.sdstest new file mode 100644 index 000000000..535617504 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/pipelines/good-statements in body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + val a = 1; +} diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-missing body.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-missing body.sdstest new file mode 100644 index 000000000..e37a29d51 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-missing body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +segment mySegment() diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-missing parameter list.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-missing parameter list.sdstest new file mode 100644 index 000000000..c10c4ad18 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-missing parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +segment mySegment {} diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (internal, private).sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (internal, private).sdstest new file mode 100644 index 000000000..27047c8d9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (internal, private).sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +internal private segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (private, internal).sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (private, internal).sdstest new file mode 100644 index 000000000..797a58dcb --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (private, internal).sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +private internal segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed body.sdstest new file mode 100644 index 000000000..1ba29b8f7 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +segment mySegment() { diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..4312edd16 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed parameter list.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +segment mySegment( {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-annotation call.sdstest new file mode 100644 index 000000000..9d5ef9094 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-internal segment.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-internal segment.sdstest new file mode 100644 index 000000000..974c3aa4a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-internal segment.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +internal segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest new file mode 100644 index 000000000..0b6c721ad --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest @@ -0,0 +1,12 @@ +// $TEST$ no_syntax_error + +segment mySegment( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-multiple results.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-multiple results.sdstest new file mode 100644 index 000000000..e2979aa68 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-multiple results.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> ( + @Annotation a, + b, + c: Int, + d: Int +) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-no parameters and no results and empty body.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-no parameters and no results and empty body.sdstest new file mode 100644 index 000000000..538c2b170 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-no parameters and no results and empty body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-no results (explicit).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-no results (explicit).sdstest new file mode 100644 index 000000000..8a30512c0 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-no results (explicit).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> () {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one typed result (in parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (in parentheses).sdstest new file mode 100644 index 000000000..9a3802129 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (in parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> (a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one typed result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (no parentheses).sdstest new file mode 100644 index 000000000..13940ca85 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (no parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> a: Int {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..f001e7a30 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (no parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> a {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (with parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..dfc4ac345 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (with parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> (a) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-private segment.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-private segment.sdstest new file mode 100644 index 000000000..de021652e --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-private segment.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +private segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-statements in body.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-statements in body.sdstest new file mode 100644 index 000000000..0fcc81aad --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-statements in body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +private segment mySegment() { + val a = 1; +} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..bf2f1eaf9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(a: Int = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed required parameter.sdstest new file mode 100644 index 000000000..a8712ae07 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..4402e600f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a: Int = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..2b844d017 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..43ce98ee4 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(a = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..b7218414e --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(a) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..d784ac69f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..024349109 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a) {} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-addition without left operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-addition without left operator.sdstest new file mode 100644 index 000000000..93c549ea8 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-addition without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + + 2; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-addition without right operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-addition without right operator.sdstest new file mode 100644 index 000000000..8b6e73af0 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-addition without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 +; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-division without left operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-division without left operator.sdstest new file mode 100644 index 000000000..57a90363f --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-division without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + / 2; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-division without right operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-division without right operator.sdstest new file mode 100644 index 000000000..38081c762 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-division without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 /; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-multiplication without left operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-multiplication without left operator.sdstest new file mode 100644 index 000000000..60a5900f5 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-multiplication without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + * 2; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-multiplication without right operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-multiplication without right operator.sdstest new file mode 100644 index 000000000..b62d52f6f --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-multiplication without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 *; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-negation without operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-negation without operator.sdstest new file mode 100644 index 000000000..854267fb1 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-negation without operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + -; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-subtraction without right operator.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-subtraction without right operator.sdstest new file mode 100644 index 000000000..9dd3c100c --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/bad-subtraction without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 -; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/good-addition.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-addition.sdstest new file mode 100644 index 000000000..f273ef1ef --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-addition.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 + 2; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/good-complex example.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-complex example.sdstest new file mode 100644 index 000000000..313f34cb8 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-complex example.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (1 + 2) * -3 / (1 - 4) + 5; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/good-division.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-division.sdstest new file mode 100644 index 000000000..ef34e2fd4 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-division.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 / 2; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/good-multiplication.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-multiplication.sdstest new file mode 100644 index 000000000..e7b1bfb6c --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-multiplication.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 * 2; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/good-negation.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-negation.sdstest new file mode 100644 index 000000000..1974fcb13 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-negation.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + -1; +} diff --git a/DSL/tests/resources/grammar/expressions/arithmetic operators/good-subtraction.sdstest b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-subtraction.sdstest new file mode 100644 index 000000000..7e5f92717 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/arithmetic operators/good-subtraction.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 - 2; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/bad-unclosed body.sdstest new file mode 100644 index 000000000..53e199fd2 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/bad-unclosed body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + () {; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..dd9e7ec5a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/bad-unclosed parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + ( {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-filled body.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-filled body.sdstest new file mode 100644 index 000000000..de33ac714 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-filled body.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + () { + val a = 1; + }; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-multiple parameters.sdstest new file mode 100644 index 000000000..05cf07fd3 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-multiple parameters.sdstest @@ -0,0 +1,14 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + ( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-no parameters and empty body.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-no parameters and empty body.sdstest new file mode 100644 index 000000000..8d1b84daf --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-no parameters and empty body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + () {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..ac6902409 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a: Int = 1) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed required parameter.sdstest new file mode 100644 index 000000000..2ca02bd96 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a: Int) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..eb0a7b515 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a: Int = 1) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..33b75c12f --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a: Int) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..1a2b8116e --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a = 1) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped required parameter.sdstest new file mode 100644 index 000000000..99c8c27ce --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..3ad5cbe9d --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a = 1) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..bc8022588 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/block lambdas/good-with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a) {}; +} diff --git a/DSL/tests/resources/grammar/expressions/calls/bad-unclosed argument list.sdstest b/DSL/tests/resources/grammar/expressions/calls/bad-unclosed argument list.sdstest new file mode 100644 index 000000000..181da1525 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/bad-unclosed argument list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + f(; +} diff --git a/DSL/tests/resources/grammar/expressions/calls/bad-unclosed type argument list.sdstest b/DSL/tests/resources/grammar/expressions/calls/bad-unclosed type argument list.sdstest new file mode 100644 index 000000000..1b23076d3 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/bad-unclosed type argument list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + f<(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-complex call.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-complex call.sdstest new file mode 100644 index 000000000..9ae472078 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-complex call.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f<*, in Number, out Number, T = Number>(1, b = 2); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-contravariant type argument.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-contravariant type argument.sdstest new file mode 100644 index 000000000..3815dcbc4 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-contravariant type argument.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-covariant type argument.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-covariant type argument.sdstest new file mode 100644 index 000000000..24dcd3a17 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-covariant type argument.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-empty type argument list and no arguments.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-empty type argument list and no arguments.sdstest new file mode 100644 index 000000000..2076ae218 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-empty type argument list and no arguments.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f<>(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-named argument.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-named argument.sdstest new file mode 100644 index 000000000..f0e4ce7b8 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-named argument.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f(b = 2); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-named type argument.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-named type argument.sdstest new file mode 100644 index 000000000..82bfb5c62 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-named type argument.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-nested type argument lists (named type argument).sdstest b/DSL/tests/resources/grammar/expressions/calls/good-nested type argument lists (named type argument).sdstest new file mode 100644 index 000000000..7af0b6fd7 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-nested type argument lists (named type argument).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f>(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-no type argument list and no arguments.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-no type argument list and no arguments.sdstest new file mode 100644 index 000000000..6cd2261ba --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-no type argument list and no arguments.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-positional argument.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-positional argument.sdstest new file mode 100644 index 000000000..670902594 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-positional argument.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f(1); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-positional type argument.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-positional type argument.sdstest new file mode 100644 index 000000000..40ea5c0cb --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-positional type argument.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/good-star projection.sdstest b/DSL/tests/resources/grammar/expressions/calls/good-star projection.sdstest new file mode 100644 index 000000000..dd2baa076 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/good-star projection.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + f<*>(); +} diff --git a/DSL/tests/resources/grammar/expressions/calls/skip-nested type argument lists (positional type argument).sdstest b/DSL/tests/resources/grammar/expressions/calls/skip-nested type argument lists (positional type argument).sdstest new file mode 100644 index 000000000..664f152ca --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/calls/skip-nested type argument lists (positional type argument).sdstest @@ -0,0 +1,21 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + /* + * Once Langium supports LL(*) parsing, this should work. + * + * For now, we can either parse + * - f>() or + * - a < f() + * but not both. + * + * The problem is that the parser can't decide with finite lookahead whether + * the first < is the start of a type argument list or the operator of a + * comparison expression. + * + * We decided to only support the second case for now. The first case leads + * to a syntax error. To work around this, you can use the following syntax: + * - f>() + */ + f>(); +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than or equal without left operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than or equal without left operator.sdstest new file mode 100644 index 000000000..0f192c492 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than or equal without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + >= 2; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than or equal without right operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than or equal without right operator.sdstest new file mode 100644 index 000000000..5985c39bc --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than or equal without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 >=; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than without left operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than without left operator.sdstest new file mode 100644 index 000000000..0a66c978b --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + > 2; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than without right operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than without right operator.sdstest new file mode 100644 index 000000000..bb733c942 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-greater than without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 >; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than or equal without left operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than or equal without left operator.sdstest new file mode 100644 index 000000000..7e6d04167 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than or equal without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + <= 2; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than or equal without right operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than or equal without right operator.sdstest new file mode 100644 index 000000000..1beda50d3 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than or equal without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 <=; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than without left operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than without left operator.sdstest new file mode 100644 index 000000000..4fe727927 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + < 2; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than without right operator.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than without right operator.sdstest new file mode 100644 index 000000000..da8a9126c --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/bad-less than without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 <; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/good-greater than or equal.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/good-greater than or equal.sdstest new file mode 100644 index 000000000..b307ff910 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/good-greater than or equal.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 >= 2; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/good-greater than.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/good-greater than.sdstest new file mode 100644 index 000000000..72d16eac6 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/good-greater than.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 > 2; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/good-less than or equal.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/good-less than or equal.sdstest new file mode 100644 index 000000000..27e5caf27 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/good-less than or equal.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 <= 2; +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/good-less than vs. type argument list.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/good-less than vs. type argument list.sdstest new file mode 100644 index 000000000..084283794 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/good-less than vs. type argument list.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + // The start of a type argument list of a call could be confused with the less than operator + 1 < a(); +} diff --git a/DSL/tests/resources/grammar/expressions/comparison operators/good-less than.sdstest b/DSL/tests/resources/grammar/expressions/comparison operators/good-less than.sdstest new file mode 100644 index 000000000..fc782e89a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/comparison operators/good-less than.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 < 2; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-equal without left operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-equal without left operator.sdstest new file mode 100644 index 000000000..6f529e441 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-equal without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + == 2; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-equal without right operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-equal without right operator.sdstest new file mode 100644 index 000000000..37613704c --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-equal without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 ==; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-identical without left operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-identical without left operator.sdstest new file mode 100644 index 000000000..7c15456a2 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-identical without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + === 2; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-identical without right operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-identical without right operator.sdstest new file mode 100644 index 000000000..333baa79c --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-identical without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 ===; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-not equal without left operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-not equal without left operator.sdstest new file mode 100644 index 000000000..c75d3f48d --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-not equal without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + != 2; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-not equal without right operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-not equal without right operator.sdstest new file mode 100644 index 000000000..6fbeaccef --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-not equal without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 !=; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-not identical without left operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-not identical without left operator.sdstest new file mode 100644 index 000000000..2e92a0311 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-not identical without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 !==; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/bad-not identical without right operator.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/bad-not identical without right operator.sdstest new file mode 100644 index 000000000..2e92a0311 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/bad-not identical without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + 1 !==; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/good-equal.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/good-equal.sdstest new file mode 100644 index 000000000..ab6082945 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/good-equal.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 == 2; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/good-identical.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/good-identical.sdstest new file mode 100644 index 000000000..cc17d2bf3 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/good-identical.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 === 2; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/good-not equal.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/good-not equal.sdstest new file mode 100644 index 000000000..66b7ffebc --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/good-not equal.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 != 2; +} diff --git a/DSL/tests/resources/grammar/expressions/equality operators/good-not identical.sdstest b/DSL/tests/resources/grammar/expressions/equality operators/good-not identical.sdstest new file mode 100644 index 000000000..1f8971705 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/equality operators/good-not identical.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1 !== 2; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/bad-missing body.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/bad-missing body.sdstest new file mode 100644 index 000000000..0ab44dbd2 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/bad-missing body.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + () ->; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/bad-unclosed parameter list.sdstest new file mode 100644 index 000000000..c352675a7 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/bad-unclosed parameter list.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + ( -> 1; + + (a, vararg b = 1) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-multiple parameters.sdstest new file mode 100644 index 000000000..a6769ce03 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-multiple parameters.sdstest @@ -0,0 +1,14 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + ( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) -> 4; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-no parameters.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-no parameters.sdstest new file mode 100644 index 000000000..77b37f429 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-no parameters.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + () -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed optional parameter.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed optional parameter.sdstest new file mode 100644 index 000000000..f158ef73e --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a = 1) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed required parameter.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed required parameter.sdstest new file mode 100644 index 000000000..170c340a6 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a: Int) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..eb250c22e --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a: Int = 1) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter.sdstest new file mode 100644 index 000000000..53a771e0a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a: Int) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped optional parameter.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped optional parameter.sdstest new file mode 100644 index 000000000..20a884559 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a: Int = 1) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped required parameter.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped required parameter.sdstest new file mode 100644 index 000000000..d7a26079b --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped required parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (a) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..faa1e28a5 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a = 1) -> 1; +} diff --git a/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter.sdstest new file mode 100644 index 000000000..7bf04b574 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/expression lambdas/good-untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + (vararg a) -> 1; +} diff --git a/DSL-langium/tests/resources/grammar/expressions/chainedExpression.sdstest b/DSL/tests/resources/grammar/expressions/good-complex chained expression.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/expressions/chainedExpression.sdstest rename to DSL/tests/resources/grammar/expressions/good-complex chained expression.sdstest diff --git a/DSL-langium/tests/resources/grammar/expressions/reference.sdstest b/DSL/tests/resources/grammar/expressions/good-reference.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/expressions/reference.sdstest rename to DSL/tests/resources/grammar/expressions/good-reference.sdstest diff --git a/DSL-langium/tests/resources/grammar/expressions/indexedAccess/bad-indexed access without index.sdstest b/DSL/tests/resources/grammar/expressions/indexed accesses/bad-no index.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/expressions/indexedAccess/bad-indexed access without index.sdstest rename to DSL/tests/resources/grammar/expressions/indexed accesses/bad-no index.sdstest diff --git a/DSL/tests/resources/grammar/expressions/indexed accesses/bad-no receiver.sdstest b/DSL/tests/resources/grammar/expressions/indexed accesses/bad-no receiver.sdstest new file mode 100644 index 000000000..54b43fcac --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/indexed accesses/bad-no receiver.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline test { + [1]; +} diff --git a/DSL/tests/resources/grammar/expressions/indexed accesses/bad-unclosed square bracket.sdstest b/DSL/tests/resources/grammar/expressions/indexed accesses/bad-unclosed square bracket.sdstest new file mode 100644 index 000000000..7248c7b52 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/indexed accesses/bad-unclosed square bracket.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline test { + a[1; +} diff --git a/DSL/tests/resources/grammar/expressions/indexed accesses/good-literal index.sdstest b/DSL/tests/resources/grammar/expressions/indexed accesses/good-literal index.sdstest new file mode 100644 index 000000000..ff4ae34be --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/indexed accesses/good-literal index.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline test { + a[1]; +} diff --git a/DSL/tests/resources/grammar/expressions/indexed accesses/good-reference index.sdstest b/DSL/tests/resources/grammar/expressions/indexed accesses/good-reference index.sdstest new file mode 100644 index 000000000..6dafc20c0 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/indexed accesses/good-reference index.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline test { + a[b]; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/float/bad-no digits before dot.sdstest b/DSL/tests/resources/grammar/expressions/literals/float/bad-no digits before dot.sdstest new file mode 100644 index 000000000..ae5accd17 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/float/bad-no digits before dot.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + .2; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/float/good-basic example.sdstest b/DSL/tests/resources/grammar/expressions/literals/float/good-basic example.sdstest new file mode 100644 index 000000000..0a1139efb --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/float/good-basic example.sdstest @@ -0,0 +1,15 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1.2; + + 1e10; + 1e+10; + 1e-10; + 1.2e2; + + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/float/good-scientific notation with lowercase e.sdstest b/DSL/tests/resources/grammar/expressions/literals/float/good-scientific notation with lowercase e.sdstest new file mode 100644 index 000000000..487983bc5 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/float/good-scientific notation with lowercase e.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1e10; + 1e+10; + 1e-10; + 1.2e2; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/float/good-scientific notation with uppercase e.sdstest b/DSL/tests/resources/grammar/expressions/literals/float/good-scientific notation with uppercase e.sdstest new file mode 100644 index 000000000..351d43ce3 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/float/good-scientific notation with uppercase e.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/good-false.sdstest b/DSL/tests/resources/grammar/expressions/literals/good-false.sdstest new file mode 100644 index 000000000..efe0d5868 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/good-false.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + false; +} diff --git a/DSL-langium/tests/resources/grammar/expressions/literals/nullLiteral.sdstest b/DSL/tests/resources/grammar/expressions/literals/good-null.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/expressions/literals/nullLiteral.sdstest rename to DSL/tests/resources/grammar/expressions/literals/good-null.sdstest diff --git a/DSL/tests/resources/grammar/expressions/literals/good-true.sdstest b/DSL/tests/resources/grammar/expressions/literals/good-true.sdstest new file mode 100644 index 000000000..58d436665 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/good-true.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + true; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/int/good-leading zero.sdstest b/DSL/tests/resources/grammar/expressions/literals/int/good-leading zero.sdstest new file mode 100644 index 000000000..c37f760a5 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/int/good-leading zero.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 01; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/int/good-multiple digits.sdstest b/DSL/tests/resources/grammar/expressions/literals/int/good-multiple digits.sdstest new file mode 100644 index 000000000..509aab5b1 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/int/good-multiple digits.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1234567890; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/int/good-one digit.sdstest b/DSL/tests/resources/grammar/expressions/literals/int/good-one digit.sdstest new file mode 100644 index 000000000..9c748058b --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/int/good-one digit.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + 1; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/bad-single quotes as delimiters.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/bad-single quotes as delimiters.sdstest new file mode 100644 index 000000000..8b4551d6f --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/bad-single quotes as delimiters.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + ''; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/bad-template string with invalid expression.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/bad-template string with invalid expression.sdstest new file mode 100644 index 000000000..a34d0a562 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/bad-template string with invalid expression.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + "{{ ??? }}"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/bad-unclosed quote.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/bad-unclosed quote.sdstest new file mode 100644 index 000000000..36f8d4140 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/bad-unclosed quote.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + "; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/bad-unclosed template expression.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/bad-unclosed template expression.sdstest new file mode 100644 index 000000000..6c4e7f084 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/bad-unclosed template expression.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + "{{"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-basic content.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-basic content.sdstest new file mode 100644 index 000000000..79cefed4a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-basic content.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "myString"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-closing template expression delimiter.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-closing template expression delimiter.sdstest new file mode 100644 index 000000000..7f7c2dcae --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-closing template expression delimiter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "}}"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-curly braces separated by space.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-curly braces separated by space.sdstest new file mode 100644 index 000000000..f12997d16 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-curly braces separated by space.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "{ {"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-empty template expression.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-empty template expression.sdstest new file mode 100644 index 000000000..064cfd448 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-empty template expression.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "{{ }}"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-empty.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-empty.sdstest new file mode 100644 index 000000000..dafae1fe5 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-empty.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + ""; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-escaped curly brace.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-escaped curly brace.sdstest new file mode 100644 index 000000000..cd8f0e481 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-escaped curly brace.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "\{{"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-multiple lines.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-multiple lines.sdstest new file mode 100644 index 000000000..64768bc42 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-multiple lines.sdstest @@ -0,0 +1,9 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + " + multi + line + string + "; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-newline escape sequence.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-newline escape sequence.sdstest new file mode 100644 index 000000000..7104ee86b --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-newline escape sequence.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "\n"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-single curly brace.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-single curly brace.sdstest new file mode 100644 index 000000000..f9e7f60d6 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-single curly brace.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "{"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-single quote.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-single quote.sdstest new file mode 100644 index 000000000..ac7a4af3a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-single quote.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "'"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-template string with basic expression.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-template string with basic expression.sdstest new file mode 100644 index 000000000..fc8d3666a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-template string with basic expression.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "{{ 1 }}"; +} diff --git a/DSL/tests/resources/grammar/expressions/literals/string/good-unicode escape sequence.sdstest b/DSL/tests/resources/grammar/expressions/literals/string/good-unicode escape sequence.sdstest new file mode 100644 index 000000000..f808b6940 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/literals/string/good-unicode escape sequence.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + "\u000c"; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/bad-conjunction without left operator.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/bad-conjunction without left operator.sdstest new file mode 100644 index 000000000..c8e3415bc --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/bad-conjunction without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + and true; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/bad-conjunction without right operator.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/bad-conjunction without right operator.sdstest new file mode 100644 index 000000000..3da7f5c06 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/bad-conjunction without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + false and; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/bad-disjunction without left operator.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/bad-disjunction without left operator.sdstest new file mode 100644 index 000000000..677b31b47 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/bad-disjunction without left operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + or true; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/bad-disjunction without right operator.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/bad-disjunction without right operator.sdstest new file mode 100644 index 000000000..13971f94c --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/bad-disjunction without right operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + true or; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/bad-negation without operator.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/bad-negation without operator.sdstest new file mode 100644 index 000000000..854267fb1 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/bad-negation without operator.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + -; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/good-complex example.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/good-complex example.sdstest new file mode 100644 index 000000000..0a12be465 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/good-complex example.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + not true and false or true; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/good-conjunction.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/good-conjunction.sdstest new file mode 100644 index 000000000..89fea66ff --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/good-conjunction.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + false and true; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/good-disjunction.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/good-disjunction.sdstest new file mode 100644 index 000000000..271891b9f --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/good-disjunction.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + true or true; +} diff --git a/DSL/tests/resources/grammar/expressions/logical operations/good-negation.sdstest b/DSL/tests/resources/grammar/expressions/logical operations/good-negation.sdstest new file mode 100644 index 000000000..30790c5de --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/logical operations/good-negation.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + not true; +} diff --git a/DSL/tests/resources/grammar/expressions/member accesses/bad-no receiver.sdstest b/DSL/tests/resources/grammar/expressions/member accesses/bad-no receiver.sdstest new file mode 100644 index 000000000..f21bdfb45 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/member accesses/bad-no receiver.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + .member; +} diff --git a/DSL/tests/resources/grammar/expressions/member accesses/good-not nullable.sdstest b/DSL/tests/resources/grammar/expressions/member accesses/good-not nullable.sdstest new file mode 100644 index 000000000..0143e79a9 --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/member accesses/good-not nullable.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + a.member; +} diff --git a/DSL/tests/resources/grammar/expressions/member accesses/good-nullable.sdstest b/DSL/tests/resources/grammar/expressions/member accesses/good-nullable.sdstest new file mode 100644 index 000000000..1a9b8c15e --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/member accesses/good-nullable.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + a?.member; +} diff --git a/DSL/tests/resources/grammar/expressions/parenthesized expressions/bad-unclosed parenthesis.sdstest b/DSL/tests/resources/grammar/expressions/parenthesized expressions/bad-unclosed parenthesis.sdstest new file mode 100644 index 000000000..96a1dce5a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/parenthesized expressions/bad-unclosed parenthesis.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + (1; +} diff --git a/DSL/tests/resources/grammar/expressions/parenthesized expressions/good-nested.sdstest b/DSL/tests/resources/grammar/expressions/parenthesized expressions/good-nested.sdstest new file mode 100644 index 000000000..5b210c27a --- /dev/null +++ b/DSL/tests/resources/grammar/expressions/parenthesized expressions/good-nested.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + ((1 + 2)); +} diff --git a/DSL-langium/tests/resources/grammar/expressions/parenthesizedExpression.sdstest b/DSL/tests/resources/grammar/expressions/parenthesized expressions/good-one level.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/expressions/parenthesizedExpression.sdstest rename to DSL/tests/resources/grammar/expressions/parenthesized expressions/good-one level.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescaped_.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped _.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescaped_.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped _.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAnd.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped and.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAnd.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped and.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAnnotation.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped annotation.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAnnotation.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped annotation.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAs.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped as.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAs.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped as.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAttr.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped attr.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedAttr.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped attr.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedClass.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped class.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedClass.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped class.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedEnum.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped enum.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedEnum.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped enum.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedFalse.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped false.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedFalse.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped false.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedFun.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped fun.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedFun.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped fun.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedImport.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped import.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedImport.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped import.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedIn.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped in.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedIn.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped in.sdstest diff --git a/DSL/tests/resources/grammar/keywords as names/bad-unescaped internal.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped internal.sdstest new file mode 100644 index 000000000..68b05ffe4 --- /dev/null +++ b/DSL/tests/resources/grammar/keywords as names/bad-unescaped internal.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class internal diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedNot.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped not.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedNot.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped not.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedNull.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped null.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedNull.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped null.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedOr.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped or.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedOr.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped or.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedOut.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped out.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedOut.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped out.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedPackage.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped package.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedPackage.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped package.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedWorkflow.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped pipeline.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedWorkflow.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped pipeline.sdstest diff --git a/DSL/tests/resources/grammar/keywords as names/bad-unescaped private.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped private.sdstest new file mode 100644 index 000000000..f701b4bc9 --- /dev/null +++ b/DSL/tests/resources/grammar/keywords as names/bad-unescaped private.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class private diff --git a/DSL/tests/resources/grammar/keywords as names/bad-unescaped schema.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped schema.sdstest new file mode 100644 index 000000000..bc788c52d --- /dev/null +++ b/DSL/tests/resources/grammar/keywords as names/bad-unescaped schema.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class schema diff --git a/DSL/tests/resources/grammar/keywords as names/bad-unescaped segment.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped segment.sdstest new file mode 100644 index 000000000..5327bb382 --- /dev/null +++ b/DSL/tests/resources/grammar/keywords as names/bad-unescaped segment.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class segment diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedStatic.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped static.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedStatic.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped static.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedSub.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped sub.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedSub.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped sub.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedSuper.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped super.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedSuper.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped super.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedTrue.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped true.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedTrue.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped true.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedUnion.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped union.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedUnion.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped union.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedVal.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped val.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedVal.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped val.sdstest diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedVararg.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped vararg.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedVararg.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped vararg.sdstest diff --git a/DSL/tests/resources/grammar/keywords as names/bad-unescaped where.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped where.sdstest new file mode 100644 index 000000000..4a5a8cf79 --- /dev/null +++ b/DSL/tests/resources/grammar/keywords as names/bad-unescaped where.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +class where diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedYield.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped yield.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/bad-unescapedYield.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped yield.sdstest diff --git a/DSL/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest b/DSL/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest new file mode 100644 index 000000000..5dcc16ee7 --- /dev/null +++ b/DSL/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest @@ -0,0 +1,34 @@ +// $TEST$ no_syntax_error + +class `_` +class `and` +class `annotation` +class `as` +class `attr` +class `class` +class `enum` +class `false` +class `fun` +class `import` +class `in` +class `internal` +class `not` +class `null` +class `or` +class `out` +class `package` +class `pipeline` +class `private` +class `protocol` +class `schema` +class `static` +class `segment` +class `sub` +class `subterm` +class `super` +class `true` +class `union` +class `val` +class `vararg` +class `where` +class `yield` diff --git a/DSL-langium/tests/resources/grammar/keywordsAsNames/good-escapedNonKeyword.sdstest b/DSL/tests/resources/grammar/keywords as names/good-escapedNonKeyword.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/keywordsAsNames/good-escapedNonKeyword.sdstest rename to DSL/tests/resources/grammar/keywords as names/good-escapedNonKeyword.sdstest diff --git a/DSL/tests/resources/grammar/modules/bad-annotation call after declaration.sdstest b/DSL/tests/resources/grammar/modules/bad-annotation call after declaration.sdstest new file mode 100644 index 000000000..32b6ba5f6 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/bad-annotation call after declaration.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class C + +@Annotation1 diff --git a/DSL/tests/resources/grammar/modules/bad-annotation call after import.sdstest b/DSL/tests/resources/grammar/modules/bad-annotation call after import.sdstest new file mode 100644 index 000000000..171deaf7a --- /dev/null +++ b/DSL/tests/resources/grammar/modules/bad-annotation call after import.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +import myPackage.MyClass + +@Annotation1 diff --git a/DSL/tests/resources/grammar/modules/bad-annotation call after package name.sdstest b/DSL/tests/resources/grammar/modules/bad-annotation call after package name.sdstest new file mode 100644 index 000000000..c0f18f3a0 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/bad-annotation call after package name.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +package test + +@Annotation1 diff --git a/DSL/tests/resources/grammar/modules/bad-annotation call between package name and import.sdstest b/DSL/tests/resources/grammar/modules/bad-annotation call between package name and import.sdstest new file mode 100644 index 000000000..3b16ac8c6 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/bad-annotation call between package name and import.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +package test + +@Annotation1 + +import myPackage.MyClass diff --git a/DSL-langium/tests/resources/grammar/compilationUnits/bad-duplicate package.sdstest b/DSL/tests/resources/grammar/modules/bad-duplicate package name.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/compilationUnits/bad-duplicate package.sdstest rename to DSL/tests/resources/grammar/modules/bad-duplicate package name.sdstest diff --git a/DSL/tests/resources/grammar/modules/bad-import after declaration.sdstest b/DSL/tests/resources/grammar/modules/bad-import after declaration.sdstest new file mode 100644 index 000000000..51e0fd341 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/bad-import after declaration.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class C + +import myPackage.MyClass diff --git a/DSL/tests/resources/grammar/modules/bad-package name after declaration.sdstest b/DSL/tests/resources/grammar/modules/bad-package name after declaration.sdstest new file mode 100644 index 000000000..0050a51dc --- /dev/null +++ b/DSL/tests/resources/grammar/modules/bad-package name after declaration.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +class C + +package test diff --git a/DSL-langium/tests/resources/grammar/compilationUnits/bad-import before package.sdstest b/DSL/tests/resources/grammar/modules/bad-package name after import.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/compilationUnits/bad-import before package.sdstest rename to DSL/tests/resources/grammar/modules/bad-package name after import.sdstest diff --git a/DSL/tests/resources/grammar/modules/good-annotation call and declaration.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call and declaration.sdstest new file mode 100644 index 000000000..4ad22173c --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call and declaration.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +@Annotation1 + +class C diff --git a/DSL/tests/resources/grammar/modules/good-annotation call and import and declaration.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call and import and declaration.sdstest new file mode 100644 index 000000000..271777165 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call and import and declaration.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +@Annotation1 + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/grammar/modules/good-annotation call and import.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call and import.sdstest new file mode 100644 index 000000000..bb565d674 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call and import.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +@Annotation1 + +import myPackage.MyClass diff --git a/DSL/tests/resources/grammar/modules/good-annotation call and package name and declaration.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call and package name and declaration.sdstest new file mode 100644 index 000000000..bcdd8aca4 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call and package name and declaration.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +@Annotation1 + +package myPackage + +class C diff --git a/DSL/tests/resources/grammar/modules/good-annotation call and package name and import and declaration.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call and package name and import and declaration.sdstest new file mode 100644 index 000000000..9dcb538ba --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call and package name and import and declaration.sdstest @@ -0,0 +1,9 @@ +// $TEST$ no_syntax_error + +@Annotation1 + +package myPackage + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/grammar/modules/good-annotation call and package name and import.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call and package name and import.sdstest new file mode 100644 index 000000000..95a2c504e --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call and package name and import.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +@Annotation1 + +package myPackage + +import myPackage.MyClass diff --git a/DSL/tests/resources/grammar/modules/good-annotation call and package name.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call and package name.sdstest new file mode 100644 index 000000000..bebb420a9 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call and package name.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +@Annotation1 + +package myPackage diff --git a/DSL/tests/resources/grammar/modules/good-annotation call.sdstest b/DSL/tests/resources/grammar/modules/good-annotation call.sdstest new file mode 100644 index 000000000..d99e5e6a3 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation call.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +@Annotation1 diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls and declarations.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls and declarations.sdstest new file mode 100644 index 000000000..527c03d0d --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls and declarations.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 + +class C +class D diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls and imports and declarations.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls and imports and declarations.sdstest new file mode 100644 index 000000000..5d346acdc --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls and imports and declarations.sdstest @@ -0,0 +1,11 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C +class D diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls and imports.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls and imports.sdstest new file mode 100644 index 000000000..e1a469205 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls and imports.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls and package name and declarations.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls and package name and declarations.sdstest new file mode 100644 index 000000000..670d85b19 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls and package name and declarations.sdstest @@ -0,0 +1,9 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 + +package myPackage + +class C +class D diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls and package name and imports and declarations.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls and package name and imports and declarations.sdstest new file mode 100644 index 000000000..f0eff9127 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls and package name and imports and declarations.sdstest @@ -0,0 +1,13 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C +class D diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls and package name and imports.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls and package name and imports.sdstest new file mode 100644 index 000000000..4b5d0a79f --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls and package name and imports.sdstest @@ -0,0 +1,10 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls and package name.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls and package name.sdstest new file mode 100644 index 000000000..777ab87ab --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls and package name.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 + +package myPackage diff --git a/DSL/tests/resources/grammar/modules/good-annotation calls.sdstest b/DSL/tests/resources/grammar/modules/good-annotation calls.sdstest new file mode 100644 index 000000000..2c41fba28 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-annotation calls.sdstest @@ -0,0 +1,4 @@ +// $TEST$ no_syntax_error + +@Annotation1 +@Annotation2 diff --git a/DSL/tests/resources/grammar/modules/good-declaration.sdstest b/DSL/tests/resources/grammar/modules/good-declaration.sdstest new file mode 100644 index 000000000..04c83e5f7 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-declaration.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class C diff --git a/DSL/tests/resources/grammar/modules/good-declarations.sdstest b/DSL/tests/resources/grammar/modules/good-declarations.sdstest new file mode 100644 index 000000000..e64324dd1 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-declarations.sdstest @@ -0,0 +1,4 @@ +// $TEST$ no_syntax_error + +class C +class D diff --git a/DSL-langium/tests/resources/grammar/compilationUnits/good-empty.sdstest b/DSL/tests/resources/grammar/modules/good-empty.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/compilationUnits/good-empty.sdstest rename to DSL/tests/resources/grammar/modules/good-empty.sdstest diff --git a/DSL/tests/resources/grammar/modules/good-import and declaration.sdstest b/DSL/tests/resources/grammar/modules/good-import and declaration.sdstest new file mode 100644 index 000000000..448ebcc73 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-import and declaration.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/grammar/modules/good-import.sdstest b/DSL/tests/resources/grammar/modules/good-import.sdstest new file mode 100644 index 000000000..8e9815b67 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-import.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +import myPackage.MyClass diff --git a/DSL/tests/resources/grammar/modules/good-imports and declarations.sdstest b/DSL/tests/resources/grammar/modules/good-imports and declarations.sdstest new file mode 100644 index 000000000..afaa0c2a3 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-imports and declarations.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C +class D diff --git a/DSL-langium/tests/resources/grammar/declarations/package/good-importsOnly.sdstest b/DSL/tests/resources/grammar/modules/good-imports.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/declarations/package/good-importsOnly.sdstest rename to DSL/tests/resources/grammar/modules/good-imports.sdstest diff --git a/DSL/tests/resources/grammar/modules/good-package name and declaration.sdstest b/DSL/tests/resources/grammar/modules/good-package name and declaration.sdstest new file mode 100644 index 000000000..467c84b63 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-package name and declaration.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +package myPackage + +class C diff --git a/DSL/tests/resources/grammar/modules/good-package name and declarations.sdstest b/DSL/tests/resources/grammar/modules/good-package name and declarations.sdstest new file mode 100644 index 000000000..5d53478e9 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-package name and declarations.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package myPackage + +class C +class D diff --git a/DSL/tests/resources/grammar/modules/good-package name and import and declaration.sdstest b/DSL/tests/resources/grammar/modules/good-package name and import and declaration.sdstest new file mode 100644 index 000000000..5a2e75dd9 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-package name and import and declaration.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +package myPackage + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/grammar/modules/good-package name and import.sdstest b/DSL/tests/resources/grammar/modules/good-package name and import.sdstest new file mode 100644 index 000000000..c9295f93a --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-package name and import.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +package myPackage + +import myPackage.MyClass diff --git a/DSL/tests/resources/grammar/modules/good-package name and imports and declarations.sdstest b/DSL/tests/resources/grammar/modules/good-package name and imports and declarations.sdstest new file mode 100644 index 000000000..6aced7b55 --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-package name and imports and declarations.sdstest @@ -0,0 +1,10 @@ +// $TEST$ no_syntax_error + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C +class D diff --git a/DSL/tests/resources/grammar/modules/good-package name and imports.sdstest b/DSL/tests/resources/grammar/modules/good-package name and imports.sdstest new file mode 100644 index 000000000..42d39a21f --- /dev/null +++ b/DSL/tests/resources/grammar/modules/good-package name and imports.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL-langium/tests/resources/grammar/declarations/package/good-nameOnly.sdstest b/DSL/tests/resources/grammar/modules/good-package name.sdstest similarity index 100% rename from DSL-langium/tests/resources/grammar/declarations/package/good-nameOnly.sdstest rename to DSL/tests/resources/grammar/modules/good-package name.sdstest diff --git a/DSL/tests/resources/grammar/schema/bad-no name (colon).sdstest b/DSL/tests/resources/grammar/schema/bad-no name (colon).sdstest new file mode 100644 index 000000000..7e8ad7292 --- /dev/null +++ b/DSL/tests/resources/grammar/schema/bad-no name (colon).sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +schema MySchema { + : Int +} diff --git a/DSL/tests/resources/grammar/schema/bad-no name (no colon)sdstest b/DSL/tests/resources/grammar/schema/bad-no name (no colon)sdstest new file mode 100644 index 000000000..b9972ace6 --- /dev/null +++ b/DSL/tests/resources/grammar/schema/bad-no name (no colon)sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +schema MySchema { + Int +} diff --git a/DSL/tests/resources/grammar/schema/bad-no type (colon).sdstest b/DSL/tests/resources/grammar/schema/bad-no type (colon).sdstest new file mode 100644 index 000000000..0da371cba --- /dev/null +++ b/DSL/tests/resources/grammar/schema/bad-no type (colon).sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +schema MySchema { + "column1" : +} diff --git a/DSL/tests/resources/grammar/schema/bad-no type (no colon).sdstest b/DSL/tests/resources/grammar/schema/bad-no type (no colon).sdstest new file mode 100644 index 000000000..8a3589f9e --- /dev/null +++ b/DSL/tests/resources/grammar/schema/bad-no type (no colon).sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +schema MySchema { + "column1" +} diff --git a/DSL/tests/resources/grammar/schema/bad-switched name and type.sdstest b/DSL/tests/resources/grammar/schema/bad-switched name and type.sdstest new file mode 100644 index 000000000..354327496 --- /dev/null +++ b/DSL/tests/resources/grammar/schema/bad-switched name and type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +schema MySchema { + Int: "column1" +} diff --git a/DSL/tests/resources/grammar/schema/bad-unclosed curly brace.sdstest b/DSL/tests/resources/grammar/schema/bad-unclosed curly brace.sdstest new file mode 100644 index 000000000..344b89dab --- /dev/null +++ b/DSL/tests/resources/grammar/schema/bad-unclosed curly brace.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +schema MySchema { diff --git a/DSL/tests/resources/grammar/schema/good-annotation call.sdstest b/DSL/tests/resources/grammar/schema/good-annotation call.sdstest new file mode 100644 index 000000000..6d802b733 --- /dev/null +++ b/DSL/tests/resources/grammar/schema/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +schema MySchema {} diff --git a/DSL/tests/resources/grammar/schema/good-empty schema.sdstest b/DSL/tests/resources/grammar/schema/good-empty schema.sdstest new file mode 100644 index 000000000..f1e64b435 --- /dev/null +++ b/DSL/tests/resources/grammar/schema/good-empty schema.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +schema MySchema {} diff --git a/DSL/tests/resources/grammar/schema/good-one column.sdstest b/DSL/tests/resources/grammar/schema/good-one column.sdstest new file mode 100644 index 000000000..bea79ca35 --- /dev/null +++ b/DSL/tests/resources/grammar/schema/good-one column.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +schema MySchema { + "column1": Int +} diff --git a/DSL/tests/resources/grammar/schema/good-two columns.sdstest b/DSL/tests/resources/grammar/schema/good-two columns.sdstest new file mode 100644 index 000000000..5cd16453f --- /dev/null +++ b/DSL/tests/resources/grammar/schema/good-two columns.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +schema MySchema { + "column1": Int, + "column2": String +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without assignees.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without assignees.sdstest new file mode 100644 index 000000000..670cdb28e --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without assignees.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + () { + = 0; + }; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without expression.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without expression.sdstest new file mode 100644 index 000000000..6d5ea11a6 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without expression.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + () { + val a =; + }; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without semicolon.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without semicolon.sdstest new file mode 100644 index 000000000..910fdb296 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in block lambda without semicolon.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + () { + val a = 0 + }; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without assignees.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without assignees.sdstest new file mode 100644 index 000000000..673d19d58 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without assignees.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + = 0; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without expression.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without expression.sdstest new file mode 100644 index 000000000..5bc01e5b0 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without expression.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + val a =; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without semicolon.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without semicolon.sdstest new file mode 100644 index 000000000..1a5bd5ec0 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in pipeline without semicolon.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + val a = 0 +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in segment without assignees.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without assignees.sdstest new file mode 100644 index 000000000..886632c65 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without assignees.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment() { + = 0; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in segment without expression.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without expression.sdstest new file mode 100644 index 000000000..0d7b52fd9 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without expression.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment() { + val a =; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in segment without semicolon.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without semicolon.sdstest new file mode 100644 index 000000000..350dbd7d8 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without semicolon.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment() { + val a = 0 +} diff --git a/DSL/tests/resources/grammar/statements/assignments/good-in block lambda.sdstest b/DSL/tests/resources/grammar/statements/assignments/good-in block lambda.sdstest new file mode 100644 index 000000000..7f4f5a003 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/good-in block lambda.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + () { + val a = 0; + val a, _, yield b = call(); + }; +} diff --git a/DSL/tests/resources/grammar/statements/assignments/good-in pipeline.sdstest b/DSL/tests/resources/grammar/statements/assignments/good-in pipeline.sdstest new file mode 100644 index 000000000..547464b38 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/good-in pipeline.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + val a = 0; + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/grammar/statements/assignments/good-in segment.sdstest b/DSL/tests/resources/grammar/statements/assignments/good-in segment.sdstest new file mode 100644 index 000000000..334f15ef9 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/assignments/good-in segment.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +segment mySegment() { + val a = 0; + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/grammar/statements/bad-empty statement in block lambda.sdstest b/DSL/tests/resources/grammar/statements/bad-empty statement in block lambda.sdstest new file mode 100644 index 000000000..47540d3b2 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/bad-empty statement in block lambda.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + () { + ; + }; +} diff --git a/DSL/tests/resources/grammar/statements/bad-empty statement in pipeline.sdstest b/DSL/tests/resources/grammar/statements/bad-empty statement in pipeline.sdstest new file mode 100644 index 000000000..b49c045cb --- /dev/null +++ b/DSL/tests/resources/grammar/statements/bad-empty statement in pipeline.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + ; +} diff --git a/DSL/tests/resources/grammar/statements/bad-empty statement in segment.sdstest b/DSL/tests/resources/grammar/statements/bad-empty statement in segment.sdstest new file mode 100644 index 000000000..ab3a700b6 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/bad-empty statement in segment.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment() { + ; +} diff --git a/DSL/tests/resources/grammar/statements/expression statements/bad-in block lambda without semicolon.sdstest b/DSL/tests/resources/grammar/statements/expression statements/bad-in block lambda without semicolon.sdstest new file mode 100644 index 000000000..6493c7e33 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/expression statements/bad-in block lambda without semicolon.sdstest @@ -0,0 +1,7 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + () { + call() + }; +} diff --git a/DSL/tests/resources/grammar/statements/expression statements/bad-in pipeline without semicolon.sdstest b/DSL/tests/resources/grammar/statements/expression statements/bad-in pipeline without semicolon.sdstest new file mode 100644 index 000000000..bcf2dbd2e --- /dev/null +++ b/DSL/tests/resources/grammar/statements/expression statements/bad-in pipeline without semicolon.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +pipeline myPipeline { + call() +} diff --git a/DSL/tests/resources/grammar/statements/expression statements/bad-in segment without semicolon.sdstest b/DSL/tests/resources/grammar/statements/expression statements/bad-in segment without semicolon.sdstest new file mode 100644 index 000000000..8e9345f9f --- /dev/null +++ b/DSL/tests/resources/grammar/statements/expression statements/bad-in segment without semicolon.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment() { + call() +} diff --git a/DSL/tests/resources/grammar/statements/expression statements/good-in block lambda.sdstest b/DSL/tests/resources/grammar/statements/expression statements/good-in block lambda.sdstest new file mode 100644 index 000000000..63f8f138e --- /dev/null +++ b/DSL/tests/resources/grammar/statements/expression statements/good-in block lambda.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + () { + call(); + }; +} diff --git a/DSL/tests/resources/grammar/statements/expression statements/good-in pipeline.sdstest b/DSL/tests/resources/grammar/statements/expression statements/good-in pipeline.sdstest new file mode 100644 index 000000000..a3fb01309 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/expression statements/good-in pipeline.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline myPipeline { + call(); +} diff --git a/DSL/tests/resources/grammar/statements/expression statements/good-in segment.sdstest b/DSL/tests/resources/grammar/statements/expression statements/good-in segment.sdstest new file mode 100644 index 000000000..57c294205 --- /dev/null +++ b/DSL/tests/resources/grammar/statements/expression statements/good-in segment.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment() { + call(); +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-argument list of annotation call.sdstest b/DSL/tests/resources/grammar/trailing commas/good-argument list of annotation call.sdstest new file mode 100644 index 000000000..f8be6908c --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-argument list of annotation call.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +@A(1, 2, ) diff --git a/DSL/tests/resources/grammar/trailing commas/good-argument list of call.sdstest b/DSL/tests/resources/grammar/trailing commas/good-argument list of call.sdstest new file mode 100644 index 000000000..00d833f07 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-argument list of call.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline p { + f(1, 2, ); +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-assignee list of assignment in block lambda.sdstest b/DSL/tests/resources/grammar/trailing commas/good-assignee list of assignment in block lambda.sdstest new file mode 100644 index 000000000..397d41836 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-assignee list of assignment in block lambda.sdstest @@ -0,0 +1,7 @@ +// $TEST$ no_syntax_error + +pipeline p { + () { + val a, val b, = f(); + }; +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-assignee list of assignment.sdstest b/DSL/tests/resources/grammar/trailing commas/good-assignee list of assignment.sdstest new file mode 100644 index 000000000..83e8ff91c --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-assignee list of assignment.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline p { + val a, val b, = f(); +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-column list of schema.sdstest b/DSL/tests/resources/grammar/trailing commas/good-column list of schema.sdstest new file mode 100644 index 000000000..f4dd423f0 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-column list of schema.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +schema MySchemaWithTrailingComma { + "column1" : Int, + "column2" : String, +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-constraint list of annotation.sdstest b/DSL/tests/resources/grammar/trailing commas/good-constraint list of annotation.sdstest new file mode 100644 index 000000000..33f63690d --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-constraint list of annotation.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +annotation A where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-constraint list of class.sdstest b/DSL/tests/resources/grammar/trailing commas/good-constraint list of class.sdstest new file mode 100644 index 000000000..8a0d0fd22 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-constraint list of class.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +class C where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-constraint list of enum variant.sdstest b/DSL/tests/resources/grammar/trailing commas/good-constraint list of enum variant.sdstest new file mode 100644 index 000000000..743490924 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-constraint list of enum variant.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +enum E { + A where { + T sub Any, + T super Int, + } +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-constraint list of function.sdstest b/DSL/tests/resources/grammar/trailing commas/good-constraint list of function.sdstest new file mode 100644 index 000000000..418bb09a8 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-constraint list of function.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +fun f() where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of annotation.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of annotation.sdstest new file mode 100644 index 000000000..da48dfa89 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of annotation.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +annotation A( + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of block lambda.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of block lambda.sdstest new file mode 100644 index 000000000..a1f3e4e36 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of block lambda.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline p { + (first, second, ) {}; +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of callable type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of callable type.sdstest new file mode 100644 index 000000000..e1d85571f --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of callable type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment s( + f: (x: Int, y: Int, ) -> () +) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of class.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of class.sdstest new file mode 100644 index 000000000..5101eeba8 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of class.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class C(a: Int, b: Int, ) diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of enum variant.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of enum variant.sdstest new file mode 100644 index 000000000..449e1df03 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of enum variant.sdstest @@ -0,0 +1,8 @@ +// $TEST$ no_syntax_error + +enum E { + A( + a: Int, + b: Int, + ) +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of expression lambda.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of expression lambda.sdstest new file mode 100644 index 000000000..b8a58ec35 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of expression lambda.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline p { + (first, second, ) -> 1; +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of function.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of function.sdstest new file mode 100644 index 000000000..067186c86 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of function.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +fun f( + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of segment.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of segment.sdstest new file mode 100644 index 000000000..47f644888 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of segment.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +segment s( + a: Int, + b: Int, +) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-parent type list of class.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parent type list of class.sdstest new file mode 100644 index 000000000..1bcd73e56 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-parent type list of class.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class C sub D, E, diff --git a/DSL/tests/resources/grammar/trailing commas/good-result list of callable type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-result list of callable type.sdstest new file mode 100644 index 000000000..e06ea8975 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-result list of callable type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment s( + f: () -> (x: Int, y: Int, ) +) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-result list of function.sdstest b/DSL/tests/resources/grammar/trailing commas/good-result list of function.sdstest new file mode 100644 index 000000000..6900e96ea --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-result list of function.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +fun f() -> ( + first: Int, + second: Int, +) diff --git a/DSL/tests/resources/grammar/trailing commas/good-result list of segment.sdstest b/DSL/tests/resources/grammar/trailing commas/good-result list of segment.sdstest new file mode 100644 index 000000000..64c7b4b22 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-result list of segment.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +segment s() -> ( + first: Int, + second: Int, +) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-type argument list of call.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type argument list of call.sdstest new file mode 100644 index 000000000..343063721 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-type argument list of call.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +pipeline p { + f(); +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-type argument list of named type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type argument list of named type.sdstest new file mode 100644 index 000000000..c4d43d35d --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-type argument list of named type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment s( + f: Type +) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-type argument list of union type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type argument list of union type.sdstest new file mode 100644 index 000000000..83b717569 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-type argument list of union type.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment s( + f: union +) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-type parameter list of class.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type parameter list of class.sdstest new file mode 100644 index 000000000..8c208c017 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-type parameter list of class.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +class C diff --git a/DSL/tests/resources/grammar/trailing commas/good-type parameter list of enum variant.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type parameter list of enum variant.sdstest new file mode 100644 index 000000000..6abd76343 --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-type parameter list of enum variant.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +enum E { + A +} diff --git a/DSL/tests/resources/grammar/trailing commas/good-type parameter list of function.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type parameter list of function.sdstest new file mode 100644 index 000000000..f139517ef --- /dev/null +++ b/DSL/tests/resources/grammar/trailing commas/good-type parameter list of function.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +fun f() diff --git a/DSL/tests/resources/grammar/types/callable types/bad-with missing arrow.sdstest b/DSL/tests/resources/grammar/types/callable types/bad-with missing arrow.sdstest new file mode 100644 index 000000000..5674be225 --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/bad-with missing arrow.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + f: () () +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/bad-with missing parameter list.sdstest b/DSL/tests/resources/grammar/types/callable types/bad-with missing parameter list.sdstest new file mode 100644 index 000000000..739276971 --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/bad-with missing parameter list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + f: -> () +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/bad-with missing result list.sdstest b/DSL/tests/resources/grammar/types/callable types/bad-with missing result list.sdstest new file mode 100644 index 000000000..89bb1850e --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/bad-with missing result list.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + f: () -> +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest new file mode 100644 index 000000000..fd772f0fc --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest @@ -0,0 +1,14 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: ( + @Annotation a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) -> () +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with multiple results.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with multiple results.sdstest new file mode 100644 index 000000000..b6496d7cb --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with multiple results.sdstest @@ -0,0 +1,10 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: () -> ( + @Annotation a, + b, + c: Int, + d: Int + ) +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one typed parameter.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one typed parameter.sdstest new file mode 100644 index 000000000..d96db7f9e --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with one typed parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: (param: Int) -> () +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one typed result (in parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (in parentheses).sdstest new file mode 100644 index 000000000..c4096ac70 --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (in parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: () -> (result: Int) +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one typed result (no parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (no parentheses).sdstest new file mode 100644 index 000000000..c6ab4cde7 --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (no parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: () -> result: Int +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one untyped parameter.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one untyped parameter.sdstest new file mode 100644 index 000000000..a0a171320 --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with one untyped parameter.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: (param) -> () +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (in parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (in parentheses).sdstest new file mode 100644 index 000000000..0309a51bf --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (in parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: () -> (result) +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (no parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..af858505d --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (no parentheses).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: () -> result +) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-without parameters or results.sdstest b/DSL/tests/resources/grammar/types/callable types/good-without parameters or results.sdstest new file mode 100644 index 000000000..2baa7ff05 --- /dev/null +++ b/DSL/tests/resources/grammar/types/callable types/good-without parameters or results.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + f: () -> () +) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-callable type as member.sdstest b/DSL/tests/resources/grammar/types/member types/bad-callable type as member.sdstest new file mode 100644 index 000000000..11f5aba32 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/bad-callable type as member.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + x: OuterClass.() -> () +) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-missing member.sdstest b/DSL/tests/resources/grammar/types/member types/bad-missing member.sdstest new file mode 100644 index 000000000..9f4517d3e --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/bad-missing member.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + x: OuterClass. +) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-missing receiver.sdstest b/DSL/tests/resources/grammar/types/member types/bad-missing receiver.sdstest new file mode 100644 index 000000000..36d39ad51 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/bad-missing receiver.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + x: .InnerClass +) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-unclosed angle bracket.sdstest b/DSL/tests/resources/grammar/types/member types/bad-unclosed angle bracket.sdstest new file mode 100644 index 000000000..b69e017ba --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/bad-unclosed angle bracket.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + x: OuterClass.InnerClass< +) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-union type as member.sdstest b/DSL/tests/resources/grammar/types/member types/bad-union type as member.sdstest new file mode 100644 index 000000000..bdbd80757 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/bad-union type as member.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + x: OuterClass.union<> +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-long complex chain.sdstest b/DSL/tests/resources/grammar/types/member types/good-long complex chain.sdstest new file mode 100644 index 000000000..1a3867f8e --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-long complex chain.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: union<>.MiddleClass?.InnerClass +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (not nullable).sdstest new file mode 100644 index 000000000..4867643c1 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (not nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: () -> ().InnerClass +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (nullable).sdstest new file mode 100644 index 000000000..5cfef9a17 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: () -> ().InnerClass? +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (not nullable).sdstest new file mode 100644 index 000000000..56b6bf481 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (not nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: OuterClass.InnerClass +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (nullable).sdstest new file mode 100644 index 000000000..118f8783b --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: OuterClass.InnerClass? +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (not nullable).sdstest new file mode 100644 index 000000000..f74fa6e45 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (not nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: OuterClass?.InnerClass +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (nullable).sdstest new file mode 100644 index 000000000..118f8783b --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: OuterClass.InnerClass? +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (not nullable).sdstest new file mode 100644 index 000000000..5d1d53216 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (not nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: union<>.InnerClass +) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (nullable).sdstest new file mode 100644 index 000000000..04ad20cc6 --- /dev/null +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (nullable).sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: union<>.InnerClass? +) {} diff --git a/DSL/tests/resources/grammar/types/named types/bad-unclosed angle bracket.sdstest b/DSL/tests/resources/grammar/types/named types/bad-unclosed angle bracket.sdstest new file mode 100644 index 000000000..77d80695e --- /dev/null +++ b/DSL/tests/resources/grammar/types/named types/bad-unclosed angle bracket.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + x: OuterClass< +) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-no type arguments and not nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-no type arguments and not nullable.sdstest new file mode 100644 index 000000000..880fb7dde --- /dev/null +++ b/DSL/tests/resources/grammar/types/named types/good-no type arguments and not nullable.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: Int +) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-no type arguments and nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-no type arguments and nullable.sdstest new file mode 100644 index 000000000..9da0abc28 --- /dev/null +++ b/DSL/tests/resources/grammar/types/named types/good-no type arguments and nullable.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: Int? +) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-type argument and nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-type argument and nullable.sdstest new file mode 100644 index 000000000..ca572847d --- /dev/null +++ b/DSL/tests/resources/grammar/types/named types/good-type argument and nullable.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: Int<*, in Number, out Number, T = Number>? +) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-type arguments and not nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-type arguments and not nullable.sdstest new file mode 100644 index 000000000..26f9b9b20 --- /dev/null +++ b/DSL/tests/resources/grammar/types/named types/good-type arguments and not nullable.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: Int<*, in Number, out Number, T = Number> +) {} diff --git a/DSL/tests/resources/grammar/types/union types/bad-unclosed angle bracket.sdstest b/DSL/tests/resources/grammar/types/union types/bad-unclosed angle bracket.sdstest new file mode 100644 index 000000000..05a407afb --- /dev/null +++ b/DSL/tests/resources/grammar/types/union types/bad-unclosed angle bracket.sdstest @@ -0,0 +1,5 @@ +// $TEST$ syntax_error + +segment mySegment( + x: union< +) {} diff --git a/DSL/tests/resources/grammar/types/union types/good-empty.sdstest b/DSL/tests/resources/grammar/types/union types/good-empty.sdstest new file mode 100644 index 000000000..0d4de6156 --- /dev/null +++ b/DSL/tests/resources/grammar/types/union types/good-empty.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: union<> +) {} diff --git a/DSL/tests/resources/grammar/types/union types/good-nested.sdstest b/DSL/tests/resources/grammar/types/union types/good-nested.sdstest new file mode 100644 index 000000000..9fbe2261d --- /dev/null +++ b/DSL/tests/resources/grammar/types/union types/good-nested.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: union> +) {} diff --git a/DSL/tests/resources/grammar/types/union types/good-with type arguments.sdstest b/DSL/tests/resources/grammar/types/union types/good-with type arguments.sdstest new file mode 100644 index 000000000..0d9fc7757 --- /dev/null +++ b/DSL/tests/resources/grammar/types/union types/good-with type arguments.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +segment mySegment( + x: union +) {} diff --git a/DSL-langium/tests/resources/grammar/compilationUnits/bad-import before declaration b/DSL/tests/resources/helpers/listTestResources/nested/not a safe-ds file.txt similarity index 100% rename from DSL-langium/tests/resources/grammar/compilationUnits/bad-import before declaration rename to DSL/tests/resources/helpers/listTestResources/nested/not a safe-ds file.txt diff --git a/DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-import before declaration b/DSL/tests/resources/helpers/listTestResources/nested/pipeline file.sdspipe similarity index 100% rename from DSL/com.larsreimann.safeds/src/test/resources/grammar/compilationUnits/bad-import before declaration rename to DSL/tests/resources/helpers/listTestResources/nested/pipeline file.sdspipe diff --git a/DSL/tests/resources/helpers/listTestResources/nested/skip pipeline file.sdspipe b/DSL/tests/resources/helpers/listTestResources/nested/skip pipeline file.sdspipe new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/nested/skip stub file.sdsstub b/DSL/tests/resources/helpers/listTestResources/nested/skip stub file.sdsstub new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/nested/skip test file.sdstest b/DSL/tests/resources/helpers/listTestResources/nested/skip test file.sdstest new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/nested/stub file.sdsstub b/DSL/tests/resources/helpers/listTestResources/nested/stub file.sdsstub new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/nested/test file.sdstest b/DSL/tests/resources/helpers/listTestResources/nested/test file.sdstest new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/not a safe-ds file.txt b/DSL/tests/resources/helpers/listTestResources/not a safe-ds file.txt new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/pipeline file.sdspipe b/DSL/tests/resources/helpers/listTestResources/pipeline file.sdspipe new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/skip pipeline file.sdspipe b/DSL/tests/resources/helpers/listTestResources/skip pipeline file.sdspipe new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/skip stub file.sdsstub b/DSL/tests/resources/helpers/listTestResources/skip stub file.sdsstub new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/skip test file.sdstest b/DSL/tests/resources/helpers/listTestResources/skip test file.sdstest new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/stub file.sdsstub b/DSL/tests/resources/helpers/listTestResources/stub file.sdsstub new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tests/resources/helpers/listTestResources/test file.sdstest b/DSL/tests/resources/helpers/listTestResources/test file.sdstest new file mode 100644 index 000000000..e69de29bb diff --git a/DSL/tsconfig.json b/DSL/tsconfig.json new file mode 100644 index 000000000..798a85ade --- /dev/null +++ b/DSL/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "lib": ["ESNext"], + "sourceMap": true, + "outDir": "out", + "strict": true, + "strictPropertyInitialization": false, + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts", "tests/**/*.ts"], + "exclude": ["out", "node_modules"] +} diff --git a/DSL/vitest.config.ts b/DSL/vitest.config.ts new file mode 100644 index 000000000..8a51f9224 --- /dev/null +++ b/DSL/vitest.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + chaiConfig: { + truncateThreshold: 0, + }, + coverage: { + provider: 'v8', + include: ['src'], + exclude: ['**/generated'], + }, + }, +}); diff --git a/Runner/.coveragerc b/Runner/.coveragerc new file mode 100644 index 000000000..68ecdd763 --- /dev/null +++ b/Runner/.coveragerc @@ -0,0 +1,4 @@ +[report] +exclude_lines = + pragma: no cover + if\s+(typing\.)?TYPE_CHECKING: diff --git a/Runner/poetry.lock b/Runner/poetry.lock index a75233c61..794da5ea1 100644 --- a/Runner/poetry.lock +++ b/Runner/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. [[package]] name = "appnope" version = "0.1.3" description = "Disable App Nap on macOS >= 10.9" -category = "main" optional = false python-versions = "*" files = [ @@ -16,7 +15,6 @@ files = [ name = "asttokens" version = "2.2.1" description = "Annotate AST trees with source code positions" -category = "main" optional = false python-versions = "*" files = [ @@ -30,29 +28,10 @@ six = "*" [package.extras] test = ["astroid", "pytest"] -[[package]] -name = "attrs" -version = "21.4.0" -description = "Classes Without Boilerplate" -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -files = [ - {file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"}, - {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, -] - -[package.extras] -dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "sphinx", "sphinx-notfound-page", "zope.interface"] -docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] -tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "zope.interface"] -tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six"] - [[package]] name = "backcall" version = "0.2.0" description = "Specifications for callback functions passed in to an API" -category = "main" optional = false python-versions = "*" files = [ @@ -64,7 +43,6 @@ files = [ name = "colorama" version = "0.4.4" description = "Cross-platform colored terminal text." -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -76,7 +54,6 @@ files = [ name = "contourpy" version = "1.0.7" description = "Python library for calculating contours of 2D quadrilateral grids" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -151,7 +128,6 @@ test-no-images = ["pytest"] name = "coverage" version = "6.4.1" description = "Code coverage measurement for Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -208,7 +184,6 @@ toml = ["tomli"] name = "cycler" version = "0.11.0" description = "Composable style cycles" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -220,7 +195,6 @@ files = [ name = "decorator" version = "5.1.1" description = "Decorators for Humans" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -228,11 +202,21 @@ files = [ {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, ] +[[package]] +name = "et-xmlfile" +version = "1.1.0" +description = "An implementation of lxml.xmlfile for the standard library" +optional = false +python-versions = ">=3.6" +files = [ + {file = "et_xmlfile-1.1.0-py3-none-any.whl", hash = "sha256:a2ba85d1d6a74ef63837eed693bcb89c3f752169b0e3e7ae5b16ca5e1b3deada"}, + {file = "et_xmlfile-1.1.0.tar.gz", hash = "sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c"}, +] + [[package]] name = "exceptiongroup" version = "1.0.0" description = "Backport of PEP 654 (exception groups)" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -247,7 +231,6 @@ test = ["pytest (>=6)"] name = "executing" version = "1.2.0" description = "Get the currently executing AST node of a frame, and other information" -category = "main" optional = false python-versions = "*" files = [ @@ -262,7 +245,6 @@ tests = ["asttokens", "littleutils", "pytest", "rich"] name = "fonttools" version = "4.38.0" description = "Tools to manipulate font files" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -288,7 +270,6 @@ woff = ["brotli (>=1.0.1)", "brotlicffi (>=0.8.0)", "zopfli (>=0.1.4)"] name = "iniconfig" version = "1.1.1" description = "iniconfig: brain-dead simple config-ini parsing" -category = "dev" optional = false python-versions = "*" files = [ @@ -300,7 +281,6 @@ files = [ name = "ipython" version = "8.12.0" description = "IPython: Productive Interactive Computing" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -339,7 +319,6 @@ test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.21)", "pa name = "jedi" version = "0.18.2" description = "An autocompletion tool for Python that can be used for text editors." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -359,7 +338,6 @@ testing = ["Django (<3.1)", "attrs", "colorama", "docopt", "pytest (<7.0.0)"] name = "joblib" version = "1.2.0" description = "Lightweight pipelining with Python functions" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -371,7 +349,6 @@ files = [ name = "kiwisolver" version = "1.4.4" description = "A fast implementation of the Cassowary constraint solver" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -449,7 +426,6 @@ files = [ name = "matplotlib" version = "3.7.1" description = "Python plotting package" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -511,7 +487,6 @@ python-dateutil = ">=2.7" name = "matplotlib-inline" version = "0.1.6" description = "Inline Matplotlib backend for Jupyter" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -526,7 +501,6 @@ traitlets = "*" name = "numpy" version = "1.24.2" description = "Fundamental package for array computing in Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -560,11 +534,24 @@ files = [ {file = "numpy-1.24.2.tar.gz", hash = "sha256:003a9f530e880cb2cd177cba1af7220b9aa42def9c4afc2a2fc3ee6be7eb2b22"}, ] +[[package]] +name = "openpyxl" +version = "3.1.2" +description = "A Python library to read/write Excel 2010 xlsx/xlsm files" +optional = false +python-versions = ">=3.6" +files = [ + {file = "openpyxl-3.1.2-py2.py3-none-any.whl", hash = "sha256:f91456ead12ab3c6c2e9491cf33ba6d08357d802192379bb482f1033ade496f5"}, + {file = "openpyxl-3.1.2.tar.gz", hash = "sha256:a6f5977418eff3b2d5500d54d9db50c8277a368436f4e4f8ddb1be3422870184"}, +] + +[package.dependencies] +et-xmlfile = "*" + [[package]] name = "packaging" version = "21.3" description = "Core utilities for Python packages" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -577,39 +564,36 @@ pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" [[package]] name = "pandas" -version = "1.5.3" +version = "2.0.1" description = "Powerful data structures for data analysis, time series, and statistics" -category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "pandas-1.5.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3749077d86e3a2f0ed51367f30bf5b82e131cc0f14260c4d3e499186fccc4406"}, - {file = "pandas-1.5.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:972d8a45395f2a2d26733eb8d0f629b2f90bebe8e8eddbb8829b180c09639572"}, - {file = "pandas-1.5.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:50869a35cbb0f2e0cd5ec04b191e7b12ed688874bd05dd777c19b28cbea90996"}, - {file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c3ac844a0fe00bfaeb2c9b51ab1424e5c8744f89860b138434a363b1f620f354"}, - {file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a0a56cef15fd1586726dace5616db75ebcfec9179a3a55e78f72c5639fa2a23"}, - {file = "pandas-1.5.3-cp310-cp310-win_amd64.whl", hash = "sha256:478ff646ca42b20376e4ed3fa2e8d7341e8a63105586efe54fa2508ee087f328"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6973549c01ca91ec96199e940495219c887ea815b2083722821f1d7abfa2b4dc"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c39a8da13cede5adcd3be1182883aea1c925476f4e84b2807a46e2775306305d"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f76d097d12c82a535fda9dfe5e8dd4127952b45fea9b0276cb30cca5ea313fbc"}, - {file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e474390e60ed609cec869b0da796ad94f420bb057d86784191eefc62b65819ae"}, - {file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f2b952406a1588ad4cad5b3f55f520e82e902388a6d5a4a91baa8d38d23c7f6"}, - {file = "pandas-1.5.3-cp311-cp311-win_amd64.whl", hash = "sha256:bc4c368f42b551bf72fac35c5128963a171b40dce866fb066540eeaf46faa003"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:14e45300521902689a81f3f41386dc86f19b8ba8dd5ac5a3c7010ef8d2932813"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9842b6f4b8479e41968eced654487258ed81df7d1c9b7b870ceea24ed9459b31"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:26d9c71772c7afb9d5046e6e9cf42d83dd147b5cf5bcb9d97252077118543792"}, - {file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5fbcb19d6fceb9e946b3e23258757c7b225ba450990d9ed63ccceeb8cae609f7"}, - {file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:565fa34a5434d38e9d250af3c12ff931abaf88050551d9fbcdfafca50d62babf"}, - {file = "pandas-1.5.3-cp38-cp38-win32.whl", hash = "sha256:87bd9c03da1ac870a6d2c8902a0e1fd4267ca00f13bc494c9e5a9020920e1d51"}, - {file = "pandas-1.5.3-cp38-cp38-win_amd64.whl", hash = "sha256:41179ce559943d83a9b4bbacb736b04c928b095b5f25dd2b7389eda08f46f373"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c74a62747864ed568f5a82a49a23a8d7fe171d0c69038b38cedf0976831296fa"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c4c00e0b0597c8e4f59e8d461f797e5d70b4d025880516a8261b2817c47759ee"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a50d9a4336a9621cab7b8eb3fb11adb82de58f9b91d84c2cd526576b881a0c5a"}, - {file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd05f7783b3274aa206a1af06f0ceed3f9b412cf665b7247eacd83be41cf7bf0"}, - {file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f69c4029613de47816b1bb30ff5ac778686688751a5e9c99ad8c7031f6508e5"}, - {file = "pandas-1.5.3-cp39-cp39-win32.whl", hash = "sha256:7cec0bee9f294e5de5bbfc14d0573f65526071029d036b753ee6507d2a21480a"}, - {file = "pandas-1.5.3-cp39-cp39-win_amd64.whl", hash = "sha256:dfd681c5dc216037e0b0a2c821f5ed99ba9f03ebcf119c7dac0e9a7b960b9ec9"}, - {file = "pandas-1.5.3.tar.gz", hash = "sha256:74a3fd7e5a7ec052f183273dc7b0acd3a863edf7520f5d3a1765c04ffdb3b0b1"}, + {file = "pandas-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:70a996a1d2432dadedbb638fe7d921c88b0cc4dd90374eab51bb33dc6c0c2a12"}, + {file = "pandas-2.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:909a72b52175590debbf1d0c9e3e6bce2f1833c80c76d80bd1aa09188be768e5"}, + {file = "pandas-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe7914d8ddb2d54b900cec264c090b88d141a1eed605c9539a187dbc2547f022"}, + {file = "pandas-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0a514ae436b23a92366fbad8365807fc0eed15ca219690b3445dcfa33597a5cc"}, + {file = "pandas-2.0.1-cp310-cp310-win32.whl", hash = "sha256:12bd6618e3cc737c5200ecabbbb5eaba8ab645a4b0db508ceeb4004bb10b060e"}, + {file = "pandas-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:2b6fe5f7ce1cba0e74188c8473c9091ead9b293ef0a6794939f8cc7947057abd"}, + {file = "pandas-2.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:00959a04a1d7bbc63d75a768540fb20ecc9e65fd80744c930e23768345a362a7"}, + {file = "pandas-2.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:af2449e9e984dfad39276b885271ba31c5e0204ffd9f21f287a245980b0e4091"}, + {file = "pandas-2.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:910df06feaf9935d05247db6de452f6d59820e432c18a2919a92ffcd98f8f79b"}, + {file = "pandas-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fa0067f2419f933101bdc6001bcea1d50812afbd367b30943417d67fbb99678"}, + {file = "pandas-2.0.1-cp311-cp311-win32.whl", hash = "sha256:7b8395d335b08bc8b050590da264f94a439b4770ff16bb51798527f1dd840388"}, + {file = "pandas-2.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:8db5a644d184a38e6ed40feeb12d410d7fcc36648443defe4707022da127fc35"}, + {file = "pandas-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7bbf173d364130334e0159a9a034f573e8b44a05320995127cf676b85fd8ce86"}, + {file = "pandas-2.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:6c0853d487b6c868bf107a4b270a823746175b1932093b537b9b76c639fc6f7e"}, + {file = "pandas-2.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f25e23a03f7ad7211ffa30cb181c3e5f6d96a8e4cb22898af462a7333f8a74eb"}, + {file = "pandas-2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e09a53a4fe8d6ae2149959a2d02e1ef2f4d2ceb285ac48f74b79798507e468b4"}, + {file = "pandas-2.0.1-cp38-cp38-win32.whl", hash = "sha256:a2564629b3a47b6aa303e024e3d84e850d36746f7e804347f64229f8c87416ea"}, + {file = "pandas-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:03e677c6bc9cfb7f93a8b617d44f6091613a5671ef2944818469be7b42114a00"}, + {file = "pandas-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3d099ecaa5b9e977b55cd43cf842ec13b14afa1cfa51b7e1179d90b38c53ce6a"}, + {file = "pandas-2.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a37ee35a3eb6ce523b2c064af6286c45ea1c7ff882d46e10d0945dbda7572753"}, + {file = "pandas-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:320b180d125c3842c5da5889183b9a43da4ebba375ab2ef938f57bf267a3c684"}, + {file = "pandas-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:18d22cb9043b6c6804529810f492ab09d638ddf625c5dea8529239607295cb59"}, + {file = "pandas-2.0.1-cp39-cp39-win32.whl", hash = "sha256:90d1d365d77d287063c5e339f49b27bd99ef06d10a8843cf00b1a49326d492c1"}, + {file = "pandas-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:99f7192d8b0e6daf8e0d0fd93baa40056684e4b4aaaef9ea78dff34168e1f2f0"}, + {file = "pandas-2.0.1.tar.gz", hash = "sha256:19b8e5270da32b41ebf12f0e7165efa7024492e9513fb46fb631c5022ae5709d"}, ] [package.dependencies] @@ -617,17 +601,37 @@ numpy = [ {version = ">=1.21.0", markers = "python_version >= \"3.10\""}, {version = ">=1.23.2", markers = "python_version >= \"3.11\""}, ] -python-dateutil = ">=2.8.1" +python-dateutil = ">=2.8.2" pytz = ">=2020.1" +tzdata = ">=2022.1" [package.extras] -test = ["hypothesis (>=5.5.3)", "pytest (>=6.0)", "pytest-xdist (>=1.31)"] +all = ["PyQt5 (>=5.15.1)", "SQLAlchemy (>=1.4.16)", "beautifulsoup4 (>=4.9.3)", "bottleneck (>=1.3.2)", "brotlipy (>=0.7.0)", "fastparquet (>=0.6.3)", "fsspec (>=2021.07.0)", "gcsfs (>=2021.07.0)", "html5lib (>=1.1)", "hypothesis (>=6.34.2)", "jinja2 (>=3.0.0)", "lxml (>=4.6.3)", "matplotlib (>=3.6.1)", "numba (>=0.53.1)", "numexpr (>=2.7.3)", "odfpy (>=1.4.1)", "openpyxl (>=3.0.7)", "pandas-gbq (>=0.15.0)", "psycopg2 (>=2.8.6)", "pyarrow (>=7.0.0)", "pymysql (>=1.0.2)", "pyreadstat (>=1.1.2)", "pytest (>=7.0.0)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)", "python-snappy (>=0.6.0)", "pyxlsb (>=1.0.8)", "qtpy (>=2.2.0)", "s3fs (>=2021.08.0)", "scipy (>=1.7.1)", "tables (>=3.6.1)", "tabulate (>=0.8.9)", "xarray (>=0.21.0)", "xlrd (>=2.0.1)", "xlsxwriter (>=1.4.3)", "zstandard (>=0.15.2)"] +aws = ["s3fs (>=2021.08.0)"] +clipboard = ["PyQt5 (>=5.15.1)", "qtpy (>=2.2.0)"] +compression = ["brotlipy (>=0.7.0)", "python-snappy (>=0.6.0)", "zstandard (>=0.15.2)"] +computation = ["scipy (>=1.7.1)", "xarray (>=0.21.0)"] +excel = ["odfpy (>=1.4.1)", "openpyxl (>=3.0.7)", "pyxlsb (>=1.0.8)", "xlrd (>=2.0.1)", "xlsxwriter (>=1.4.3)"] +feather = ["pyarrow (>=7.0.0)"] +fss = ["fsspec (>=2021.07.0)"] +gcp = ["gcsfs (>=2021.07.0)", "pandas-gbq (>=0.15.0)"] +hdf5 = ["tables (>=3.6.1)"] +html = ["beautifulsoup4 (>=4.9.3)", "html5lib (>=1.1)", "lxml (>=4.6.3)"] +mysql = ["SQLAlchemy (>=1.4.16)", "pymysql (>=1.0.2)"] +output-formatting = ["jinja2 (>=3.0.0)", "tabulate (>=0.8.9)"] +parquet = ["pyarrow (>=7.0.0)"] +performance = ["bottleneck (>=1.3.2)", "numba (>=0.53.1)", "numexpr (>=2.7.1)"] +plot = ["matplotlib (>=3.6.1)"] +postgresql = ["SQLAlchemy (>=1.4.16)", "psycopg2 (>=2.8.6)"] +spss = ["pyreadstat (>=1.1.2)"] +sql-other = ["SQLAlchemy (>=1.4.16)"] +test = ["hypothesis (>=6.34.2)", "pytest (>=7.0.0)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)"] +xml = ["lxml (>=4.6.3)"] [[package]] name = "parso" version = "0.8.3" description = "A Python Parser" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -643,7 +647,6 @@ testing = ["docopt", "pytest (<6.0.0)"] name = "pexpect" version = "4.8.0" description = "Pexpect allows easy control of interactive console applications." -category = "main" optional = false python-versions = "*" files = [ @@ -658,7 +661,6 @@ ptyprocess = ">=0.5" name = "pickleshare" version = "0.7.5" description = "Tiny 'shelve'-like database with concurrency support" -category = "main" optional = false python-versions = "*" files = [ @@ -668,100 +670,87 @@ files = [ [[package]] name = "pillow" -version = "9.4.0" +version = "9.5.0" description = "Python Imaging Library (Fork)" -category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "Pillow-9.4.0-1-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:1b4b4e9dda4f4e4c4e6896f93e84a8f0bcca3b059de9ddf67dac3c334b1195e1"}, - {file = "Pillow-9.4.0-1-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:fb5c1ad6bad98c57482236a21bf985ab0ef42bd51f7ad4e4538e89a997624e12"}, - {file = "Pillow-9.4.0-1-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:f0caf4a5dcf610d96c3bd32932bfac8aee61c96e60481c2a0ea58da435e25acd"}, - {file = "Pillow-9.4.0-1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:3f4cc516e0b264c8d4ccd6b6cbc69a07c6d582d8337df79be1e15a5056b258c9"}, - {file = "Pillow-9.4.0-1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:b8c2f6eb0df979ee99433d8b3f6d193d9590f735cf12274c108bd954e30ca858"}, - {file = "Pillow-9.4.0-1-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b70756ec9417c34e097f987b4d8c510975216ad26ba6e57ccb53bc758f490dab"}, - {file = "Pillow-9.4.0-1-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:43521ce2c4b865d385e78579a082b6ad1166ebed2b1a2293c3be1d68dd7ca3b9"}, - {file = "Pillow-9.4.0-2-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:9d9a62576b68cd90f7075876f4e8444487db5eeea0e4df3ba298ee38a8d067b0"}, - {file = "Pillow-9.4.0-2-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:87708d78a14d56a990fbf4f9cb350b7d89ee8988705e58e39bdf4d82c149210f"}, - {file = "Pillow-9.4.0-2-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:8a2b5874d17e72dfb80d917213abd55d7e1ed2479f38f001f264f7ce7bae757c"}, - {file = "Pillow-9.4.0-2-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:83125753a60cfc8c412de5896d10a0a405e0bd88d0470ad82e0869ddf0cb3848"}, - {file = "Pillow-9.4.0-2-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:9e5f94742033898bfe84c93c831a6f552bb629448d4072dd312306bab3bd96f1"}, - {file = "Pillow-9.4.0-2-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:013016af6b3a12a2f40b704677f8b51f72cb007dac785a9933d5c86a72a7fe33"}, - {file = "Pillow-9.4.0-2-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:99d92d148dd03fd19d16175b6d355cc1b01faf80dae93c6c3eb4163709edc0a9"}, - {file = "Pillow-9.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:2968c58feca624bb6c8502f9564dd187d0e1389964898f5e9e1fbc8533169157"}, - {file = "Pillow-9.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c5c1362c14aee73f50143d74389b2c158707b4abce2cb055b7ad37ce60738d47"}, - {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd752c5ff1b4a870b7661234694f24b1d2b9076b8bf337321a814c612665f343"}, - {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a3049a10261d7f2b6514d35bbb7a4dfc3ece4c4de14ef5876c4b7a23a0e566d"}, - {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16a8df99701f9095bea8a6c4b3197da105df6f74e6176c5b410bc2df2fd29a57"}, - {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:94cdff45173b1919350601f82d61365e792895e3c3a3443cf99819e6fbf717a5"}, - {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:ed3e4b4e1e6de75fdc16d3259098de7c6571b1a6cc863b1a49e7d3d53e036070"}, - {file = "Pillow-9.4.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d5b2f8a31bd43e0f18172d8ac82347c8f37ef3e0b414431157718aa234991b28"}, - {file = "Pillow-9.4.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:09b89ddc95c248ee788328528e6a2996e09eaccddeeb82a5356e92645733be35"}, - {file = "Pillow-9.4.0-cp310-cp310-win32.whl", hash = "sha256:f09598b416ba39a8f489c124447b007fe865f786a89dbfa48bb5cf395693132a"}, - {file = "Pillow-9.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:f6e78171be3fb7941f9910ea15b4b14ec27725865a73c15277bc39f5ca4f8391"}, - {file = "Pillow-9.4.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:3fa1284762aacca6dc97474ee9c16f83990b8eeb6697f2ba17140d54b453e133"}, - {file = "Pillow-9.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:eaef5d2de3c7e9b21f1e762f289d17b726c2239a42b11e25446abf82b26ac132"}, - {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a4dfdae195335abb4e89cc9762b2edc524f3c6e80d647a9a81bf81e17e3fb6f0"}, - {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6abfb51a82e919e3933eb137e17c4ae9c0475a25508ea88993bb59faf82f3b35"}, - {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:451f10ef963918e65b8869e17d67db5e2f4ab40e716ee6ce7129b0cde2876eab"}, - {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:6663977496d616b618b6cfa43ec86e479ee62b942e1da76a2c3daa1c75933ef4"}, - {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:60e7da3a3ad1812c128750fc1bc14a7ceeb8d29f77e0a2356a8fb2aa8925287d"}, - {file = "Pillow-9.4.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:19005a8e58b7c1796bc0167862b1f54a64d3b44ee5d48152b06bb861458bc0f8"}, - {file = "Pillow-9.4.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:f715c32e774a60a337b2bb8ad9839b4abf75b267a0f18806f6f4f5f1688c4b5a"}, - {file = "Pillow-9.4.0-cp311-cp311-win32.whl", hash = "sha256:b222090c455d6d1a64e6b7bb5f4035c4dff479e22455c9eaa1bdd4c75b52c80c"}, - {file = "Pillow-9.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:ba6612b6548220ff5e9df85261bddc811a057b0b465a1226b39bfb8550616aee"}, - {file = "Pillow-9.4.0-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:5f532a2ad4d174eb73494e7397988e22bf427f91acc8e6ebf5bb10597b49c493"}, - {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5dd5a9c3091a0f414a963d427f920368e2b6a4c2f7527fdd82cde8ef0bc7a327"}, - {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ef21af928e807f10bf4141cad4746eee692a0dd3ff56cfb25fce076ec3cc8abe"}, - {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:847b114580c5cc9ebaf216dd8c8dbc6b00a3b7ab0131e173d7120e6deade1f57"}, - {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:653d7fb2df65efefbcbf81ef5fe5e5be931f1ee4332c2893ca638c9b11a409c4"}, - {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:46f39cab8bbf4a384ba7cb0bc8bae7b7062b6a11cfac1ca4bc144dea90d4a9f5"}, - {file = "Pillow-9.4.0-cp37-cp37m-win32.whl", hash = "sha256:7ac7594397698f77bce84382929747130765f66406dc2cd8b4ab4da68ade4c6e"}, - {file = "Pillow-9.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:46c259e87199041583658457372a183636ae8cd56dbf3f0755e0f376a7f9d0e6"}, - {file = "Pillow-9.4.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:0e51f608da093e5d9038c592b5b575cadc12fd748af1479b5e858045fff955a9"}, - {file = "Pillow-9.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:765cb54c0b8724a7c12c55146ae4647e0274a839fb6de7bcba841e04298e1011"}, - {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:519e14e2c49fcf7616d6d2cfc5c70adae95682ae20f0395e9280db85e8d6c4df"}, - {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d197df5489004db87d90b918033edbeee0bd6df3848a204bca3ff0a903bef837"}, - {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0845adc64fe9886db00f5ab68c4a8cd933ab749a87747555cec1c95acea64b0b"}, - {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:e1339790c083c5a4de48f688b4841f18df839eb3c9584a770cbd818b33e26d5d"}, - {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:a96e6e23f2b79433390273eaf8cc94fec9c6370842e577ab10dabdcc7ea0a66b"}, - {file = "Pillow-9.4.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:7cfc287da09f9d2a7ec146ee4d72d6ea1342e770d975e49a8621bf54eaa8f30f"}, - {file = "Pillow-9.4.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d7081c084ceb58278dd3cf81f836bc818978c0ccc770cbbb202125ddabec6628"}, - {file = "Pillow-9.4.0-cp38-cp38-win32.whl", hash = "sha256:df41112ccce5d47770a0c13651479fbcd8793f34232a2dd9faeccb75eb5d0d0d"}, - {file = "Pillow-9.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:7a21222644ab69ddd9967cfe6f2bb420b460dae4289c9d40ff9a4896e7c35c9a"}, - {file = "Pillow-9.4.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0f3269304c1a7ce82f1759c12ce731ef9b6e95b6df829dccd9fe42912cc48569"}, - {file = "Pillow-9.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cb362e3b0976dc994857391b776ddaa8c13c28a16f80ac6522c23d5257156bed"}, - {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a2e0f87144fcbbe54297cae708c5e7f9da21a4646523456b00cc956bd4c65815"}, - {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:28676836c7796805914b76b1837a40f76827ee0d5398f72f7dcc634bae7c6264"}, - {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0884ba7b515163a1a05440a138adeb722b8a6ae2c2b33aea93ea3118dd3a899e"}, - {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:53dcb50fbdc3fb2c55431a9b30caeb2f7027fcd2aeb501459464f0214200a503"}, - {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:e8c5cf126889a4de385c02a2c3d3aba4b00f70234bfddae82a5eaa3ee6d5e3e6"}, - {file = "Pillow-9.4.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:6c6b1389ed66cdd174d040105123a5a1bc91d0aa7059c7261d20e583b6d8cbd2"}, - {file = "Pillow-9.4.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0dd4c681b82214b36273c18ca7ee87065a50e013112eea7d78c7a1b89a739153"}, - {file = "Pillow-9.4.0-cp39-cp39-win32.whl", hash = "sha256:6d9dfb9959a3b0039ee06c1a1a90dc23bac3b430842dcb97908ddde05870601c"}, - {file = "Pillow-9.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:54614444887e0d3043557d9dbc697dbb16cfb5a35d672b7a0fcc1ed0cf1c600b"}, - {file = "Pillow-9.4.0-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b9b752ab91e78234941e44abdecc07f1f0d8f51fb62941d32995b8161f68cfe5"}, - {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d3b56206244dc8711f7e8b7d6cad4663917cd5b2d950799425076681e8766286"}, - {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aabdab8ec1e7ca7f1434d042bf8b1e92056245fb179790dc97ed040361f16bfd"}, - {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:db74f5562c09953b2c5f8ec4b7dfd3f5421f31811e97d1dbc0a7c93d6e3a24df"}, - {file = "Pillow-9.4.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:e9d7747847c53a16a729b6ee5e737cf170f7a16611c143d95aa60a109a59c336"}, - {file = "Pillow-9.4.0-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b52ff4f4e002f828ea6483faf4c4e8deea8d743cf801b74910243c58acc6eda3"}, - {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:575d8912dca808edd9acd6f7795199332696d3469665ef26163cd090fa1f8bfa"}, - {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3c4ed2ff6760e98d262e0cc9c9a7f7b8a9f61aa4d47c58835cdaf7b0b8811bb"}, - {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e621b0246192d3b9cb1dc62c78cfa4c6f6d2ddc0ec207d43c0dedecb914f152a"}, - {file = "Pillow-9.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:8f127e7b028900421cad64f51f75c051b628db17fb00e099eb148761eed598c9"}, - {file = "Pillow-9.4.0.tar.gz", hash = "sha256:a1c2d7780448eb93fbcc3789bf3916aa5720d942e37945f4056680317f1cd23e"}, + {file = "Pillow-9.5.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:ace6ca218308447b9077c14ea4ef381ba0b67ee78d64046b3f19cf4e1139ad16"}, + {file = "Pillow-9.5.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d3d403753c9d5adc04d4694d35cf0391f0f3d57c8e0030aac09d7678fa8030aa"}, + {file = "Pillow-9.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ba1b81ee69573fe7124881762bb4cd2e4b6ed9dd28c9c60a632902fe8db8b38"}, + {file = "Pillow-9.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fe7e1c262d3392afcf5071df9afa574544f28eac825284596ac6db56e6d11062"}, + {file = "Pillow-9.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f36397bf3f7d7c6a3abdea815ecf6fd14e7fcd4418ab24bae01008d8d8ca15e"}, + {file = "Pillow-9.5.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:252a03f1bdddce077eff2354c3861bf437c892fb1832f75ce813ee94347aa9b5"}, + {file = "Pillow-9.5.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:85ec677246533e27770b0de5cf0f9d6e4ec0c212a1f89dfc941b64b21226009d"}, + {file = "Pillow-9.5.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b416f03d37d27290cb93597335a2f85ed446731200705b22bb927405320de903"}, + {file = "Pillow-9.5.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:1781a624c229cb35a2ac31cc4a77e28cafc8900733a864870c49bfeedacd106a"}, + {file = "Pillow-9.5.0-cp310-cp310-win32.whl", hash = "sha256:8507eda3cd0608a1f94f58c64817e83ec12fa93a9436938b191b80d9e4c0fc44"}, + {file = "Pillow-9.5.0-cp310-cp310-win_amd64.whl", hash = "sha256:d3c6b54e304c60c4181da1c9dadf83e4a54fd266a99c70ba646a9baa626819eb"}, + {file = "Pillow-9.5.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:7ec6f6ce99dab90b52da21cf0dc519e21095e332ff3b399a357c187b1a5eee32"}, + {file = "Pillow-9.5.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:560737e70cb9c6255d6dcba3de6578a9e2ec4b573659943a5e7e4af13f298f5c"}, + {file = "Pillow-9.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:96e88745a55b88a7c64fa49bceff363a1a27d9a64e04019c2281049444a571e3"}, + {file = "Pillow-9.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d9c206c29b46cfd343ea7cdfe1232443072bbb270d6a46f59c259460db76779a"}, + {file = "Pillow-9.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cfcc2c53c06f2ccb8976fb5c71d448bdd0a07d26d8e07e321c103416444c7ad1"}, + {file = "Pillow-9.5.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:a0f9bb6c80e6efcde93ffc51256d5cfb2155ff8f78292f074f60f9e70b942d99"}, + {file = "Pillow-9.5.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:8d935f924bbab8f0a9a28404422da8af4904e36d5c33fc6f677e4c4485515625"}, + {file = "Pillow-9.5.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:fed1e1cf6a42577953abbe8e6cf2fe2f566daebde7c34724ec8803c4c0cda579"}, + {file = "Pillow-9.5.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:c1170d6b195555644f0616fd6ed929dfcf6333b8675fcca044ae5ab110ded296"}, + {file = "Pillow-9.5.0-cp311-cp311-win32.whl", hash = "sha256:54f7102ad31a3de5666827526e248c3530b3a33539dbda27c6843d19d72644ec"}, + {file = "Pillow-9.5.0-cp311-cp311-win_amd64.whl", hash = "sha256:cfa4561277f677ecf651e2b22dc43e8f5368b74a25a8f7d1d4a3a243e573f2d4"}, + {file = "Pillow-9.5.0-cp311-cp311-win_arm64.whl", hash = "sha256:965e4a05ef364e7b973dd17fc765f42233415974d773e82144c9bbaaaea5d089"}, + {file = "Pillow-9.5.0-cp312-cp312-win32.whl", hash = "sha256:22baf0c3cf0c7f26e82d6e1adf118027afb325e703922c8dfc1d5d0156bb2eeb"}, + {file = "Pillow-9.5.0-cp312-cp312-win_amd64.whl", hash = "sha256:432b975c009cf649420615388561c0ce7cc31ce9b2e374db659ee4f7d57a1f8b"}, + {file = "Pillow-9.5.0-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:5d4ebf8e1db4441a55c509c4baa7a0587a0210f7cd25fcfe74dbbce7a4bd1906"}, + {file = "Pillow-9.5.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:375f6e5ee9620a271acb6820b3d1e94ffa8e741c0601db4c0c4d3cb0a9c224bf"}, + {file = "Pillow-9.5.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:99eb6cafb6ba90e436684e08dad8be1637efb71c4f2180ee6b8f940739406e78"}, + {file = "Pillow-9.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2dfaaf10b6172697b9bceb9a3bd7b951819d1ca339a5ef294d1f1ac6d7f63270"}, + {file = "Pillow-9.5.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:763782b2e03e45e2c77d7779875f4432e25121ef002a41829d8868700d119392"}, + {file = "Pillow-9.5.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:35f6e77122a0c0762268216315bf239cf52b88865bba522999dc38f1c52b9b47"}, + {file = "Pillow-9.5.0-cp37-cp37m-win32.whl", hash = "sha256:aca1c196f407ec7cf04dcbb15d19a43c507a81f7ffc45b690899d6a76ac9fda7"}, + {file = "Pillow-9.5.0-cp37-cp37m-win_amd64.whl", hash = "sha256:322724c0032af6692456cd6ed554bb85f8149214d97398bb80613b04e33769f6"}, + {file = "Pillow-9.5.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:a0aa9417994d91301056f3d0038af1199eb7adc86e646a36b9e050b06f526597"}, + {file = "Pillow-9.5.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f8286396b351785801a976b1e85ea88e937712ee2c3ac653710a4a57a8da5d9c"}, + {file = "Pillow-9.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c830a02caeb789633863b466b9de10c015bded434deb3ec87c768e53752ad22a"}, + {file = "Pillow-9.5.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fbd359831c1657d69bb81f0db962905ee05e5e9451913b18b831febfe0519082"}, + {file = "Pillow-9.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8fc330c3370a81bbf3f88557097d1ea26cd8b019d6433aa59f71195f5ddebbf"}, + {file = "Pillow-9.5.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:7002d0797a3e4193c7cdee3198d7c14f92c0836d6b4a3f3046a64bd1ce8df2bf"}, + {file = "Pillow-9.5.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:229e2c79c00e85989a34b5981a2b67aa079fd08c903f0aaead522a1d68d79e51"}, + {file = "Pillow-9.5.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:9adf58f5d64e474bed00d69bcd86ec4bcaa4123bfa70a65ce72e424bfb88ed96"}, + {file = "Pillow-9.5.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:662da1f3f89a302cc22faa9f14a262c2e3951f9dbc9617609a47521c69dd9f8f"}, + {file = "Pillow-9.5.0-cp38-cp38-win32.whl", hash = "sha256:6608ff3bf781eee0cd14d0901a2b9cc3d3834516532e3bd673a0a204dc8615fc"}, + {file = "Pillow-9.5.0-cp38-cp38-win_amd64.whl", hash = "sha256:e49eb4e95ff6fd7c0c402508894b1ef0e01b99a44320ba7d8ecbabefddcc5569"}, + {file = "Pillow-9.5.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:482877592e927fd263028c105b36272398e3e1be3269efda09f6ba21fd83ec66"}, + {file = "Pillow-9.5.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3ded42b9ad70e5f1754fb7c2e2d6465a9c842e41d178f262e08b8c85ed8a1d8e"}, + {file = "Pillow-9.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c446d2245ba29820d405315083d55299a796695d747efceb5717a8b450324115"}, + {file = "Pillow-9.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8aca1152d93dcc27dc55395604dcfc55bed5f25ef4c98716a928bacba90d33a3"}, + {file = "Pillow-9.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:608488bdcbdb4ba7837461442b90ea6f3079397ddc968c31265c1e056964f1ef"}, + {file = "Pillow-9.5.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:60037a8db8750e474af7ffc9faa9b5859e6c6d0a50e55c45576bf28be7419705"}, + {file = "Pillow-9.5.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:07999f5834bdc404c442146942a2ecadd1cb6292f5229f4ed3b31e0a108746b1"}, + {file = "Pillow-9.5.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:a127ae76092974abfbfa38ca2d12cbeddcdeac0fb71f9627cc1135bedaf9d51a"}, + {file = "Pillow-9.5.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:489f8389261e5ed43ac8ff7b453162af39c3e8abd730af8363587ba64bb2e865"}, + {file = "Pillow-9.5.0-cp39-cp39-win32.whl", hash = "sha256:9b1af95c3a967bf1da94f253e56b6286b50af23392a886720f563c547e48e964"}, + {file = "Pillow-9.5.0-cp39-cp39-win_amd64.whl", hash = "sha256:77165c4a5e7d5a284f10a6efaa39a0ae8ba839da344f20b111d62cc932fa4e5d"}, + {file = "Pillow-9.5.0-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:833b86a98e0ede388fa29363159c9b1a294b0905b5128baf01db683672f230f5"}, + {file = "Pillow-9.5.0-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aaf305d6d40bd9632198c766fb64f0c1a83ca5b667f16c1e79e1661ab5060140"}, + {file = "Pillow-9.5.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0852ddb76d85f127c135b6dd1f0bb88dbb9ee990d2cd9aa9e28526c93e794fba"}, + {file = "Pillow-9.5.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:91ec6fe47b5eb5a9968c79ad9ed78c342b1f97a091677ba0e012701add857829"}, + {file = "Pillow-9.5.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:cb841572862f629b99725ebaec3287fc6d275be9b14443ea746c1dd325053cbd"}, + {file = "Pillow-9.5.0-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:c380b27d041209b849ed246b111b7c166ba36d7933ec6e41175fd15ab9eb1572"}, + {file = "Pillow-9.5.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7c9af5a3b406a50e313467e3565fc99929717f780164fe6fbb7704edba0cebbe"}, + {file = "Pillow-9.5.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5671583eab84af046a397d6d0ba25343c00cd50bce03787948e0fff01d4fd9b1"}, + {file = "Pillow-9.5.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:84a6f19ce086c1bf894644b43cd129702f781ba5751ca8572f08aa40ef0ab7b7"}, + {file = "Pillow-9.5.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1e7723bd90ef94eda669a3c2c19d549874dd5badaeefabefd26053304abe5799"}, + {file = "Pillow-9.5.0.tar.gz", hash = "sha256:bf548479d336726d7a0eceb6e767e179fbde37833ae42794602631a070d630f1"}, ] [package.extras] -docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-issues (>=3.0.1)", "sphinx-removed-in", "sphinxext-opengraph"] +docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-removed-in", "sphinxext-opengraph"] tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] [[package]] name = "pluggy" version = "1.0.0" description = "plugin and hook calling mechanisms for python" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -777,7 +766,6 @@ testing = ["pytest", "pytest-benchmark"] name = "prompt-toolkit" version = "3.0.38" description = "Library for building powerful interactive command lines in Python" -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -792,7 +780,6 @@ wcwidth = "*" name = "ptyprocess" version = "0.7.0" description = "Run a subprocess in a pseudo terminal" -category = "main" optional = false python-versions = "*" files = [ @@ -804,7 +791,6 @@ files = [ name = "pure-eval" version = "0.2.2" description = "Safely evaluate AST nodes without side effects" -category = "main" optional = false python-versions = "*" files = [ @@ -819,7 +805,6 @@ tests = ["pytest"] name = "pygments" version = "2.14.0" description = "Pygments is a syntax highlighting package written in Python." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -834,7 +819,6 @@ plugins = ["importlib-metadata"] name = "pyparsing" version = "3.0.9" description = "pyparsing module - Classes and methods to define and execute parsing grammars" -category = "main" optional = false python-versions = ">=3.6.8" files = [ @@ -847,18 +831,16 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" -version = "7.2.2" +version = "7.4.0" description = "pytest: simple powerful testing with Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pytest-7.2.2-py3-none-any.whl", hash = "sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e"}, - {file = "pytest-7.2.2.tar.gz", hash = "sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4"}, + {file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"}, + {file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"}, ] [package.dependencies] -attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" @@ -867,18 +849,17 @@ pluggy = ">=0.12,<2.0" tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-cov" -version = "4.0.0" +version = "4.1.0" description = "Pytest plugin for measuring coverage." -category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "pytest-cov-4.0.0.tar.gz", hash = "sha256:996b79efde6433cdbd0088872dbc5fb3ed7fe1578b68cdbba634f14bb8dd0470"}, - {file = "pytest_cov-4.0.0-py3-none-any.whl", hash = "sha256:2feb1b751d66a8bd934e5edfa2e961d11309dc37b73b0eabe73b5945fee20f6b"}, + {file = "pytest-cov-4.1.0.tar.gz", hash = "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"}, + {file = "pytest_cov-4.1.0-py3-none-any.whl", hash = "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a"}, ] [package.dependencies] @@ -892,7 +873,6 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale name = "python-dateutil" version = "2.8.2" description = "Extensions to the standard Python datetime module" -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ @@ -907,7 +887,6 @@ six = ">=1.5" name = "pytz" version = "2022.7.1" description = "World timezone definitions, modern and historical" -category = "main" optional = false python-versions = "*" files = [ @@ -917,20 +896,21 @@ files = [ [[package]] name = "safe-ds" -version = "0.8.0" +version = "0.14.0" description = "A user-friendly library for Data Science in Python." -category = "main" optional = false python-versions = ">=3.10,<4.0" files = [ - {file = "safe_ds-0.8.0-py3-none-any.whl", hash = "sha256:2782ec5b409504c8c1d0e917c6946c762f0b3bf2b9b68a766b1ff73522b512d8"}, - {file = "safe_ds-0.8.0.tar.gz", hash = "sha256:cf0aa600d11aa16f8d021d8a3dcf02e08d66cb37d61c51394ca0f58cd1c85488"}, + {file = "safe_ds-0.14.0-py3-none-any.whl", hash = "sha256:5a6dc065aa9527719c984119bcc1276c66b5d306a0d5dd74851006d59bfd7424"}, + {file = "safe_ds-0.14.0.tar.gz", hash = "sha256:cf6fa620ae4b70e7760ba87796e3b349af9425131d556e39265f040fd86fb91f"}, ] [package.dependencies] ipython = ">=8.8.0,<9.0.0" matplotlib = ">=3.6.3,<4.0.0" -pandas = ">=1.5.3,<2.0.0" +openpyxl = ">=3.1.2,<4.0.0" +pandas = ">=2.0.0,<3.0.0" +pillow = ">=9.5.0,<10.0.0" scikit-learn = ">=1.2.0,<2.0.0" seaborn = ">=0.12.2,<0.13.0" @@ -938,7 +918,6 @@ seaborn = ">=0.12.2,<0.13.0" name = "scikit-learn" version = "1.2.1" description = "A set of python modules for machine learning and data mining" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -981,7 +960,6 @@ tests = ["black (>=22.3.0)", "flake8 (>=3.8.2)", "matplotlib (>=3.1.3)", "mypy ( name = "scipy" version = "1.9.3" description = "Fundamental algorithms for scientific computing in Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1020,7 +998,6 @@ test = ["asv", "gmpy2", "mpmath", "pytest", "pytest-cov", "pytest-xdist", "sciki name = "seaborn" version = "0.12.2" description = "Statistical data visualization" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1042,7 +1019,6 @@ stats = ["scipy (>=1.3)", "statsmodels (>=0.10)"] name = "six" version = "1.16.0" description = "Python 2 and 3 compatibility utilities" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -1054,7 +1030,6 @@ files = [ name = "stack-data" version = "0.6.2" description = "Extract data from python stack frames and tracebacks for informative displays" -category = "main" optional = false python-versions = "*" files = [ @@ -1074,7 +1049,6 @@ tests = ["cython", "littleutils", "pygments", "pytest", "typeguard"] name = "threadpoolctl" version = "3.1.0" description = "threadpoolctl" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1086,7 +1060,6 @@ files = [ name = "tomli" version = "2.0.1" description = "A lil' TOML parser" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1098,7 +1071,6 @@ files = [ name = "traitlets" version = "5.9.0" description = "Traitlets Python configuration system" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1110,11 +1082,21 @@ files = [ docs = ["myst-parser", "pydata-sphinx-theme", "sphinx"] test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"] +[[package]] +name = "tzdata" +version = "2023.3" +description = "Provider of IANA time zone data" +optional = false +python-versions = ">=2" +files = [ + {file = "tzdata-2023.3-py2.py3-none-any.whl", hash = "sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda"}, + {file = "tzdata-2023.3.tar.gz", hash = "sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a"}, +] + [[package]] name = "wcwidth" version = "0.2.6" description = "Measures the displayed width of unicode strings in a terminal" -category = "main" optional = false python-versions = "*" files = [ @@ -1125,4 +1107,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "dae9609afd3ae1ac2d96997907fe6293d5dea5bbbe39aeb4ab91375c66bf9526" +content-hash = "4a361d894e46301b274464988862c6f9536620b4ab1eb31381ee0bf63782424b" diff --git a/Runner/pyproject.toml b/Runner/pyproject.toml index c3499d138..d41711c93 100644 --- a/Runner/pyproject.toml +++ b/Runner/pyproject.toml @@ -10,11 +10,11 @@ packages = [ [tool.poetry.dependencies] python = "^3.10" -safe-ds = "^0.8.0" +safe-ds = "^0.14.0" [tool.poetry.dev-dependencies] -pytest = "^7.2.2" -pytest-cov = "^4.0.0" +pytest = "^7.4.0" +pytest-cov = "^4.1.0" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/codecov.yml b/codecov.yml index 25d41d447..473e7a30d 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,6 @@ codecov: notify: - after_n_builds: 3 + after_n_builds: 2 comment: layout: 'header, diff, flags, components, files' @@ -15,7 +15,3 @@ component_management: name: runner paths: - Runner/** - - component_id: module_dsl_langium - name: dsl-langium - paths: - - DSL-langium/** diff --git a/docs/README.md b/docs/README.md index a6080d26d..f72f0ed04 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,10 +3,24 @@ [![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/safe-ds.safe-ds)](https://marketplace.visualstudio.com/items?itemName=safe-ds.safe-ds) [![Main](https://github.com/Safe-DS/DSL/actions/workflows/main.yml/badge.svg)](https://github.com/Safe-DS/DSL/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/Safe-DS/DSL/branch/main/graph/badge.svg?token=ma0ytglhO1)](https://codecov.io/gh/Safe-DS/DSL) -[![Documentation Status](https://readthedocs.org/projects/safe-ds-dsl/badge/?version=stable)](https://dsl.safe-ds.com) +[![Documentation Status](https://readthedocs.org/projects/safe-ds-dsl/badge/?version=stable)](https://dsl.safeds.com) Safely develop Data Science programs with a statically checked. +## Installation + +Get the latest extension for [Visual Studio Code](https://code.visualstudio.com/) from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=safe-ds.safe-ds). + ## Documentation -You can find the full documentation [here](https://dsl.safe-ds.com). +You can find the full documentation [here](https://dsl.safeds.com). + +## Contributing + +We welcome contributions from everyone. As a starting point, check the following resources: + +* [Contributing page](https://github.com/Safe-DS/DSL/contribute) + +If you need further help, please [use our discussion forum][forum]. + +[forum]: https://github.com/orgs/Safe-DS/discussions diff --git a/docs/development/dsl-development-checklist.md b/docs/development/dsl-development-checklist.md deleted file mode 100644 index d5ae9bb16..000000000 --- a/docs/development/dsl-development-checklist.md +++ /dev/null @@ -1,86 +0,0 @@ -# How to add a new language concept - -1. Create new classes in the EMF model (_abstract syntax_): - - 1. [Update the Ecore file][safeds.ecore]. Ensure that `SdsAbstractObject` is either a direct of transitive supertype. - 1. [Update the Genmodel file][safeds.genmodel]. - -1. Update the grammar (_concrete syntax_). - - 1. Create [grammar tests][grammar-tests]: - 1. Positive tests (with comment `// no_syntax_error`) - 1. Negative tests (with comment `// syntax_error`) - 1. Run the tests (`./gradlew test`). There should be failures. - 1. Update the [Xtext grammar file][safeds.xtext]. - 1. Run the tests again (`./gradlew test`). Tests should now pass. - -1. Update the [constants][constants] if the concrete syntax of your concept has terminals that need to be accessed programmatically (e.g. operators or modifiers). Mark new declarations with [`@ExperimentalSdsApi`][experimental-sds-api]. - -1. Update the [creators][creators], which simplify the creation of instances of model classes. There should be at least one function for each class. Mark new declarations with [`@ExperimentalSdsApi`][experimental-sds-api]. - -1. Update the [access shortcuts][shortcuts], which simplify the traversal of the EMF model. This is not always required and the file should only contain functions that are simple enough to not require tests. Mark new declarations with [`@ExperimentalSdsApi`][experimental-sds-api]. - -1. Update the converters if your concept includes terminals where the value they represent differs from their textual representation. - - 1. Create [converter tests][converter-tests] - 1. Run the tests (`./gradlew test`). There should be failures. - 1. Add a [converter][converters]. - 1. Run the tests again (`./gradlew test`). Tests should now pass. - -1. Update the scope provider if your concept has cross-references. - - 1. Create [scoping tests][scoping-tests]. - 1. Run the tests (`./gradlew test`). There should be failures. - 1. Update the [local scope provider][local-scope-provider]. - 1. Run the tests again (`./gradlew test`). Tests should now pass. - -1. Update the [resource description strategy][resource-description-strategy] if your concept is a declaration that should be visible from another file. - -1. Update the [static analyses][static-analysis]. Mark new declarations with [`@ExperimentalSdsApi`][experimental-sds-api]. - -1. Update the validator. - - 1. Create [validation tests][validation-tests] - 1. Run the tests (`./gradlew test`). There should be failures. - 1. Update the [validators][validators] or add a new one. - 1. Run the tests again (`./gradlew test`). Tests should now pass. - -1. Update the code generator. - - 1. Create [generator tests][generator-tests] - 1. Run the tests (`./gradlew test`). There should be failures. - 1. Update the [generator][generator]. - 1. Run the tests again (`./gradlew test`). Tests should now pass. - -1. Update the formatter. - - 1. Create [formatting tests][formatting-tests]. - 1. Run the tests (`./gradlew test`). There should be failures. - 1. Update the [formatter][formatting]. - 1. Run the tests again (`./gradlew test`). Tests should now pass. - -1. Update the [tutorial][tutorial]. - - - -[experimental-sds-api]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/utils/MarkerAnnotations.kt -[safeds.ecore]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/model/SafeDS.ecore -[safeds.genmodel]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/model/SafeDS.genmodel -[grammar-tests]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/test/resources/grammar -[safeds.xtext]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/SafeDS.xtext -[converter-tests]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/conversion -[converters]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/conversion -[scoping-tests]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/test/kotlin/com/larsreimann/safeds/scoping/ScopingTest.kt -[local-scope-provider]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSScopeProvider.kt -[resource-description-strategy]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/scoping/SafeDSResourceDescriptionStrategy.kt -[static-analysis]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/staticAnalysis -[validation-tests]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/test/resources/validation -[validators]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/validation -[constants]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/constant -[creators]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/Creators.kt -[shortcuts]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/emf/SimpleShortcuts.kt -[generator-tests]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/test/resources/generator -[generator]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/generator/SafeDSGenerator.kt -[formatting-tests]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/test/resources/formatting -[formatting]: https://github.com/lars-reimann/Safe-DS/blob/main/DSL/com.larsreimann.safeds/src/main/kotlin/com/larsreimann/safeds/formatting2/SafeDSFormatter.kt -[tutorial]: ../language/README.md diff --git a/docs/development/formatting-testing.md b/docs/development/formatting-testing.md new file mode 100644 index 000000000..cc5b72200 --- /dev/null +++ b/docs/development/formatting-testing.md @@ -0,0 +1,20 @@ +# Formatting Testing + +Formatting tests are data driven instead of being specified explicitly. This document explains how to add a new formatting test. + +## Adding a formatting test + +1. Create a new file with extension `.sdstest` in the `DSL/tests/resources/formatting` directory or any + subdirectory. Give the file a descriptive name, since the file name becomes part of the test name. + + !!! tip "Skipping a test" + + If you want to skip a test, add the prefix `skip-` to the file name. + +2. Add the original unformatted Safe-DS code to the top of the file. The code must be syntactically valid. +3. Add the following separator to the file: + ```txt + // ----------------------------------------------------------------------------- + ``` +4. Add the expected formatted Safe-DS code to the file below the separator. +5. Run the tests. The test runner will automatically pick up the new test. diff --git a/docs/development/grammar-testing.md b/docs/development/grammar-testing.md new file mode 100644 index 000000000..2dcc1b603 --- /dev/null +++ b/docs/development/grammar-testing.md @@ -0,0 +1,38 @@ +# Grammar Testing + +Grammar tests are data driven instead of being specified explicitly. This document explains how to add a new grammar test. + +## Adding a grammar test + +1. Create a new file with extension `.sdstest` in the `DSL/tests/resources/grammar` directory or any + subdirectory. Give the file a descriptive name, since the file name becomes part of the test name. + + !!! note "Naming convention" + + By convention, the names of files that **should not** contain syntax errors should be prefixed with `good-` and the names of files that **should** contain syntax errors with `bad-`. This is irrelevant for the test runner, but it helps to keep the tests organized. + + !!! tip "Skipping a test" + + If you want to skip a test, add the prefix `skip-` to the file name. + +2. If you want to assert that a file is parsed without a syntax error[^1], add the following comment to the file: + ```ts + // $TEST$ no_syntax_error + ``` + If you instead want to assert that the parser detects a syntax error, add the following comment to the file: + ```ts + // $TEST$ syntax_error + ``` + + !!! warning + + The two comments are mutually exclusive. You must have exactly one in a grammar test file. + + !!! note "Comment placement" + + By convention, the comment should be placed at the start of the file. + +3. Add the Safe-DS code that you want to test to the file. +4. Run the tests. The test runner will automatically pick up the new test. + +[^1]: We do not differentiate whether the error originated in the lexer (error code `lexing-error`) or the actual parser (error code `parsing-error`). Both are treated as syntax errors. diff --git a/docs/development/release-checklist.md b/docs/development/release-checklist.md deleted file mode 100644 index ee8067017..000000000 --- a/docs/development/release-checklist.md +++ /dev/null @@ -1,39 +0,0 @@ -# How to prepare a release - -1. Bump the version of the DSL in [build.gradle.kts][main-build-gradle]: - ```kts - subprojects { - // ... - version = "1.0.0" - // ... - } - ``` -1. Bump the version of the VS Code extension in [package.json][vscode-package-json]: - ```json5 - { - // ... - version: '1.0.0', - // ... - } - ``` -1. Run this command to also update the associated `package-lock.json` file: - ```sh - cd DSL/com.larsreimann.safeds.vscode - npm i - ``` - -1. Bump the version of the runner in [pyproject.toml][runner-pyproject-toml]: - ```toml - [tool.poetry] - # ... - version = "1.0.0" - # ... - ``` -1. Commit the changes in a new branch. -1. Create a pull request. -1. Merge the pull request into main. -1. Create a release on GitHub. - -[main-build-gradle]: https://github.com/Safe-DS/DSL/blob/main/DSL/build.gradle.kts -[vscode-package-json]: https://github.com/Safe-DS/DSL/blob/main/DSL/com.larsreimann.safeds.vscode/package.json -[runner-pyproject-toml]: https://github.com/Safe-DS/DSL/blob/main/Runner/pyproject.toml diff --git a/docs/language/common/parameters.md b/docs/language/common/parameters.md index 77d7cffb2..15308aecd 100644 --- a/docs/language/common/parameters.md +++ b/docs/language/common/parameters.md @@ -53,10 +53,10 @@ Let us break down the syntax: ## Complete Example -Let us now look at a full example of a [step][steps] called `doSomething` with one [required parameter](#required-parameters) and one [optional parameter](#optional-parameters): +Let us now look at a full example of a [segment][segments] called `doSomething` with one [required parameter](#required-parameters) and one [optional parameter](#optional-parameters): ```txt -step doSomething(requiredParameter: Int, optionalParameter: Boolean = false) { +segment doSomething(requiredParameter: Int, optionalParameter: Boolean = false) { // ... } ``` @@ -192,7 +192,7 @@ Most commonly, default values in Python are literals, since default values are o [types]: types.md [types-python]: types.md#corresponding-python-code -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [calls]: ../pipeline-language/expressions.md#calls [stub-language]: ../stub-language/README.md [int-literals]: ../pipeline-language/expressions.md#int-literals diff --git a/docs/language/common/results.md b/docs/language/common/results.md index 31eece3ec..8b755d333 100644 --- a/docs/language/common/results.md +++ b/docs/language/common/results.md @@ -14,10 +14,10 @@ Here is a breakdown of the syntax: ## Complete Example -Let us now look at a full example of a [step][steps] called `doSomething` with two results: +Let us now look at a full example of a [segment][segments] called `doSomething` with two results: ```txt -step doSomething() -> (result1: Int, result2: Boolean) { +segment doSomething() -> (result1: Int, result2: Boolean) { // ... } ``` @@ -34,11 +34,11 @@ The interesting part is the list of results, which uses the following syntactic In case that the callable produces only a single result, we can omit the parentheses. The following two declarations are, hence, equivalent: ```txt -step doSomething1() -> (result: Int) {} +segment doSomething1() -> (result: Int) {} ``` ```txt -step doSomething2() -> result: Int {} +segment doSomething2() -> result: Int {} ``` ## Shorthand Version: No Results @@ -46,11 +46,11 @@ step doSomething2() -> result: Int {} In case that the callable produces no results, we can usually omit the entire results list. The following two declarations are, hence equivalent: ```txt -step doSomething1() -> () {} +segment doSomething1() -> () {} ``` ```txt -step doSomething2() {} +segment doSomething2() {} ``` The notable exception are [callable types][callable-types], where the result list must always be specified even when it is empty. @@ -67,5 +67,5 @@ Since Python results do not have a name, the names of Safe-DS results can be arb [types]: types.md [types-python]: types.md#corresponding-python-code [callable-types]: types.md#callable-type -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [calls]: ../pipeline-language/expressions.md#calls diff --git a/docs/language/common/types.md b/docs/language/common/types.md index 785a1e956..b14e59346 100644 --- a/docs/language/common/types.md +++ b/docs/language/common/types.md @@ -298,7 +298,7 @@ A _callable type_ denotes that only values that can be [called][calls] are accep - [constructors of enum variants][enum-variant-constructors] - [methods][methods] - [global functions][global-functions] -- [steps][steps] +- [segments][segments] - [lambdas][lambdas] Additionally, a callable types specifies the names and types of parameters and results. Here is the most basic callable type that expects neither parameters nor results: @@ -349,14 +349,6 @@ If exactly one result is expected, the surrounding parentheses may be also remov (a: Int, b: Int) -> r: Int ``` -### Parenthesized Types - -To improve clarity, parts of a type or the entire type can be enclosed in parentheses. The parentheses have no special meaning and are just meant as a visual guide. Here is an example: - -```txt -(Int) -``` - ## Corresponding Python Code **Note:** This section is only relevant if you are interested in the [stub language][stub-language]. @@ -393,7 +385,6 @@ The following table shows how Safe-DS types can be written as Python [type hints | `union` | `Union[str, int]` | | `(a: Int, b: Int) -> r: Int` | `Callable[[int, int], int]` | | `(a: Int, b: Int) -> (r: Int, s: Int)` | `Callable[[int, int], Tuple[int, int]]` | -| `(SomeClass)` | No exact equivalent. Convert the type without parentheses instead. | Most of these are rather self-explanatory. We will, however, cover the translation of [callable types](#callable-types) in a little more detail: In Python, the type hint for a callable type has the following general syntax: @@ -432,7 +423,7 @@ Getting the ` depends on the number of results. If there is only a [member-accesses]: ../pipeline-language/expressions.md#member-access-of-enum-variants [null-literal]: ../pipeline-language/expressions.md#null-literal [calls]: ../pipeline-language/expressions.md#calls -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [lambdas]: ../pipeline-language/expressions.md#lambdas [mypy]: http://mypy-lang.org/ [type-hints]: https://docs.python.org/3/library/typing.html diff --git a/docs/language/pipeline-language/README.md b/docs/language/pipeline-language/README.md index 31e802841..1a672233c 100644 --- a/docs/language/pipeline-language/README.md +++ b/docs/language/pipeline-language/README.md @@ -5,8 +5,8 @@ The pipeline language is the part of the Safe-DS DSL that is designed to solve s - [Packages][packages] help avoid conflicts that could arise if two declarations have the same name. - [Imports][imports] make declarations in other packages accessible. - [Pipelines][pipelines] define the entry point of a data science program. -- [Steps][steps] encapsulate parts of a data science program and make them reusable. -- [Statements][statements] are the instructions that are executed as part of a [pipeline][pipelines], [step][steps], or [block lambda][block-lambdas]. +- [Segments][segments] encapsulate parts of a data science program and make them reusable. +- [Statements][statements] are the instructions that are executed as part of a [pipeline][pipelines], [segment][segments], or [block lambda][block-lambdas]. - [Expressions][expressions] are computations that produce some value. - [Comments][comments] document the code. @@ -15,7 +15,7 @@ Files that use the pipeline language must have the extension `.sdspipe`. [packages]: ../common/packages.md [imports]: ../common/imports.md [pipelines]: pipelines.md -[steps]: steps.md +[segments]: segments.md [statements]: statements.md [expressions]: expressions.md [block-lambdas]: expressions.md#block-lambdas diff --git a/docs/language/pipeline-language/expressions.md b/docs/language/pipeline-language/expressions.md index 0e070dbb3..5a19a7f09 100644 --- a/docs/language/pipeline-language/expressions.md +++ b/docs/language/pipeline-language/expressions.md @@ -149,27 +149,27 @@ In order to refer to global declarations in other [packages][packages], we first ## Calls -Calls are used to trigger the execution of a specific action, which can, for example, be the creation of an instance of a [class][classes] or executing the code in a [step][steps]. Let's look at an example: +Calls are used to trigger the execution of a specific action, which can, for example, be the creation of an instance of a [class][classes] or executing the code in a [segment][segments]. Let's look at an example: -First, we show the code of the [step][steps] that we want to call. +First, we show the code of the [segment][segments] that we want to call. ```txt -step createDecisionTree(maxDepth: Int = 10) { +segment createDecisionTree(maxDepth: Int = 10) { // ... do something ... } ``` -This [step][steps] has a single [parameter][parameters] `maxDepth`, which must have [type][types] `Int`, and has the default value `10`. Since it has a default value, we are not required to specify a value when we call this [step][steps]. The most basic legal call of the [step][steps] is, thus, this: +This [segment][segments] has a single [parameter][parameters] `maxDepth`, which must have [type][types] `Int`, and has the default value `10`. Since it has a default value, we are not required to specify a value when we call this [segment][segments]. The most basic legal call of the [segment][segments] is, thus, this: ```txt createDecisionTree() ``` -This calls the [step][steps] `createDecisionTree`, using the default `maxDepth` of `10`. +This calls the [segment][segments] `createDecisionTree`, using the default `maxDepth` of `10`. The syntax consists of these elements: -- The _callee_ of the call, which is the expression to call (here a [reference](#references) to the [step][steps] `createDecisionTree`) +- The _callee_ of the call, which is the expression to call (here a [reference](#references) to the [segment][segments] `createDecisionTree`) - The list of arguments, which is delimited by parentheses. In this case the list is empty, so no arguments are passed. If we want to override the default value of an optional [parameter][parameters] or if the callee has required [parameters][parameters], we need to pass arguments. We can either use _positional arguments_ or _named arguments_. @@ -196,10 +196,10 @@ These are the syntactic elements: ### Passing Multiple Arguments -We now add another parameter to the `createDecisionTree` [step][steps]: +We now add another parameter to the `createDecisionTree` [segment][segments]: ```txt -step createDecisionTree(isBinary: Boolean, maxDepth: Int = 10) { +segment createDecisionTree(isBinary: Boolean, maxDepth: Int = 10) { // ... do something ... } ``` @@ -231,7 +231,7 @@ Depending on the callee, a call can do different things. The following table lis | [Enum Variant][enum-variants] | Creates a new instance of the enum variant. Enum variants are always callable. The call evaluates to this new instance. | | [Global Function][global-functions] | Invokes the function and runs the associated Python code. The call evaluates to the result record of the function. | | [Method][methods] | Invokes the method and runs the associated Python code. The call evaluates to the result record of the method. | -| [Step][steps] | Invokes the step and runs the Safe-DS code in its body. The call evaluates to the result record of the step. | +| [Segment][segments] | Invokes the segment and runs the Safe-DS code in its body. The call evaluates to the result record of the segment. | | [Block Lambda](#block-lambdas) | Invokes the lambda and runs the Safe-DS code in its body. The call evaluates to the result record of the lambda. | | [Expression Lambda](#expression-lambdas) | Invokes the lambda and runs the Safe-DS code in its body. The call evaluates to the result record of the lambda. | | Declaration with [Callable Type][callable-types] | Call whatever the value of the declaration is. | @@ -242,7 +242,7 @@ The term _result record_ warrants further explanation: A result record maps [res - [global function][global-functions], - [method][methods], -- [step][steps], or +- [segment][segments], or - [lambda](#lambdas) to their computed values. @@ -402,10 +402,10 @@ createValueWrapper() ## Indexed Accesses -An indexed access is currently only used to access one value assigned to a [variadic parameter][variadic-parameters]. In the following example, we use an index access to retrieve the first value that is assigned to the [variadic parameter][variadic-parameters] `values` of the step `printFirst`: +An indexed access is currently only used to access one value assigned to a [variadic parameter][variadic-parameters]. In the following example, we use an index access to retrieve the first value that is assigned to the [variadic parameter][variadic-parameters] `values` of the segment `printFirst`: ```txt -step printFirst(vararg values: Int) { +segment printFirst(vararg values: Int) { print(values[0]); } ``` @@ -431,17 +431,17 @@ class LinearRegression() { This is a [class][classes] `LinearRegression`, which has a constructor and an instance [method][methods] called `drawAsGraph`. -We can then use those declarations in a [step][steps]: +We can then use those declarations in a [segment][segments]: ```txt -step myStep(vararg regressions: LinearRegression) { +segment mySegment(vararg regressions: LinearRegression) { regressions[0].drawAsGraph(); } ``` -This step is called `myStep` and has a [variadic parameter][variadic-parameters] `regressions` of type `LinearRegression`. This means we can pass an arbitrary number of instances of `LinearRegression` to the step when we [call](#calls) it. +This segment is called `mySegment` and has a [variadic parameter][variadic-parameters] `regressions` of type `LinearRegression`. This means we can pass an arbitrary number of instances of `LinearRegression` to the segment when we [call](#calls) it. -In the body of the step we then +In the body of the segment we then 1. access the first instance that was pass using an [indexed access](#indexed-accesses), 2. access the instance method `drawAsGraph` of this instance using a [member access](#member-accesses), @@ -449,7 +449,7 @@ In the body of the step we then ## Lambdas -If you want to write reusable blocks of code, use a [step][steps]. However, sometimes you need to create a highly application-specific callable that can be passed as argument to some function or returned as the result of a [step][steps]. We will explain this concept by filtering a list. Here are the relevant declarations: +If you want to write reusable blocks of code, use a [segment][segments]. However, sometimes you need to create a highly application-specific callable that can be passed as argument to some function or returned as the result of a [segment][segments]. We will explain this concept by filtering a list. Here are the relevant declarations: ```txt class IntList { @@ -463,27 +463,27 @@ First, we declare a [class][classes] `IntList`, which has a single [method][meth Second, we declare a [global function][global-functions] `intListOf` that is supposed to wrap `elements` into an `IntList`. -Say, we now want to keep only the elements in the list that are less than `10`. We can do this by declaring a [step][steps]: +Say, we now want to keep only the elements in the list that are less than `10`. We can do this by declaring a [segment][segments]: ```txt -step keepLessThan10(a: Int) -> shouldKeep: Boolean { +segment keepLessThan10(a: Int) -> shouldKeep: Boolean { yield shouldKeep = a < 10; } ``` -Here is how to solve the task of keeping only elements below `10` with this [step][steps]: +Here is how to solve the task of keeping only elements below `10` with this [segment][segments]: ```txt intListOf(1, 4, 11).filter(keepLessThan10) ``` -The [call](#calls) to `intListOf` is just there to create an `IntList` that we can use for filtering. The interesting part is the argument we pass to the `filter` [method][methods], which is simply a reference to the [step][steps] we declared above. +The [call](#calls) to `intListOf` is just there to create an `IntList` that we can use for filtering. The interesting part is the argument we pass to the `filter` [method][methods], which is simply a reference to the [segment][segments] we declared above. -The problem here is that this solution is very cumbersome and verbose. We need to come up with a name for a [step][steps] that we will likely use only once. Moreover, the step must declare the [types][types] of its [parameters][parameters] and its [results][results] in its header. Finally, the declaration of the step has to happen in a separate location then its use. We can solve those issues with lambdas. +The problem here is that this solution is very cumbersome and verbose. We need to come up with a name for a [segment][segments] that we will likely use only once. Moreover, the segment must declare the [types][types] of its [parameters][parameters] and its [results][results] in its header. Finally, the declaration of the segment has to happen in a separate location then its use. We can solve those issues with lambdas. ### Block Lambdas -We will first rewrite the above solution using a _block lambda_, which is essentially a [step][steps] without a name and more concise syntax that can be declared where it is needed: +We will first rewrite the above solution using a _block lambda_, which is essentially a [segment][segments] without a name and more concise syntax that can be declared where it is needed: ```txt intListOf(1, 4, 11).filter( @@ -491,7 +491,7 @@ intListOf(1, 4, 11).filter( ) ``` -While this appears longer than the solution with [steps][steps], note that it replaces both the declaration of the [step][steps] as well as the [reference](#references) to it. +While this appears longer than the solution with [segments][segments], note that it replaces both the declaration of the [segment][segments] as well as the [reference](#references) to it. Here are the syntactic elements: @@ -523,12 +523,12 @@ These are the syntactic elements: Both [block lambdas](#block-lambdas) and [expression lambdas](#expression-lambdas) are closures, which means they remember the values of [placeholders][placeholders] and [parameters][parameters] that can be accessed within their body at the time of their creation. Here is an example: ```txt -step lazyValue(value: Int) -> result: () -> storedValue: Int { +segment lazyValue(value: Int) -> result: () -> storedValue: Int { yield result = () -> value } ``` -This deserves further explanation: We declare a [step][steps] `lazyValue`. It takes a single [required parameter][required-parameters] `value` with type `Int`. It produces a single [result][results] called `result`, which has a [callable type][callable-types] that takes no [parameters] and produces a single [result][results] called `storedValue` with type `Int`. In the [body][step-body] of the [step][steps] we then [assign][assignments-to-step-results] an [expression lambda](#expression-lambdas) to the [result][results] `result`. +This deserves further explanation: We declare a [segment][segments] `lazyValue`. It takes a single [required parameter][required-parameters] `value` with type `Int`. It produces a single [result][results] called `result`, which has a [callable type][callable-types] that takes no [parameters] and produces a single [result][results] called `storedValue` with type `Int`. In the [body][segment-body] of the [segment][segments] we then [assign][assignments-to-segment-results] an [expression lambda](#expression-lambdas) to the [result][results] `result`. The interesting part here is that we [refer to](#references) to the [parameter][parameters] `value` within the expression of the lambda. Since lambdas are closures, this means the current `value` is stored when the lambda is created. When we later call this lambda, exactly this value is returned. @@ -537,8 +537,8 @@ The interesting part here is that we [refer to](#references) to the [parameter][ At the moment, lambdas can only be used if the context determines the type of its parameters. Concretely, this means we can use lambdas in these two places: - As an argument that is assigned to a [parameter][parameters] with a [type][types] in a [call](#calls). -- As the value that is [assigned to a result of a step][assignments-to-step-results]. - In other cases, declare a step instead and use a [reference](#references) to this step where you would write the lambda. +- As the value that is [assigned to a result of a segment][assignments-to-segment-results]. + In other cases, declare a segment instead and use a [reference](#references) to this segment where you would write the lambda. ## Precedence @@ -579,8 +579,8 @@ If the default precedence of operators is not sufficient, parentheses can be use [pipeline-language]: README.md [statements]: statements.md [assignment-multiple-assignees]: statements.md#multiple-assignees -[assignments-to-step-results]: statements.md#yielding-results-of-steps +[assignments-to-segment-results]: statements.md#yielding-results-of-segments [assignments-to-block-lambda-results]: statements.md#declare-results-of-block-lambdas [placeholders]: statements.md#declaring-placeholders -[steps]: steps.md -[step-body]: steps.md#statements +[segments]: segments.md +[segment-body]: segments.md#statements diff --git a/docs/language/pipeline-language/pipelines.md b/docs/language/pipeline-language/pipelines.md index 402d13992..ca92df416 100644 --- a/docs/language/pipeline-language/pipelines.md +++ b/docs/language/pipeline-language/pipelines.md @@ -1,6 +1,6 @@ # Pipelines -Pipelines are data science programs designed to solve a specific task. They act as the entry point to start execution. Pipelines are not meant to be reusable, instead extract reusable code into a [step][steps]. +Pipelines are data science programs designed to solve a specific task. They act as the entry point to start execution. Pipelines are not meant to be reusable, instead extract reusable code into a [segment][segments]. ## Syntax @@ -33,5 +33,5 @@ pipeline predictSpeed { More information about statements can be found in the [linked document][statements]. Note particularly, that all statements must end with a semicolon. -[steps]: steps.md +[segments]: segments.md [statements]: statements.md diff --git a/docs/language/pipeline-language/segments.md b/docs/language/pipeline-language/segments.md new file mode 100644 index 000000000..029c46631 --- /dev/null +++ b/docs/language/pipeline-language/segments.md @@ -0,0 +1,136 @@ +# Segments + +Segments are used to extract a sequence of [statements][statements] from a data science program to give the sequence a name and make it reusable. In the following discussion we explain how to [declare a segment](#declaring-a-segment) and how to [call it](#calling-a-segment). + +## Declaring a Segment + +### Minimal Example + +Let's look at a minimal example of a segment: + +```txt +segment loadMovieRatingsSample() {} +``` + +This declaration of a segment has the following syntactic elements: + +- The keyword `segment`. +- The name of the segment, here `loadMovieRatingsSample`. This can be any combination of upper- and lowercase letters, underscores, and numbers, as long as it does not start with a number. However, we suggest to use `lowerCamelCase` for the names of segments. +- The list of parameters (i.e. inputs) of the segment. This is delimited by parentheses. In the example above, the segment has no parameters. +- The _body_ of the segment, which contains the [statements][statements] that should be run when the segment is [called](#calling-a-segment). The body is delimited by curly braces. In this example, the body is empty, so running this segment does nothing. + +### Parameters + +To make a segment configurable, add [parameters][parameters] (inputs). We will first show how to [declare parameters](#parameter-declaration) and afterwards how to [refer to them](#references-to-parameters) in the body of the segment. + +#### Parameter Declaration + +Parameters must be declared in the header of the segment so [callers](#calling-a-segment) know they are expected to pass them as an argument, and so we can [use them](#references-to-parameters) in the body of the segment. + +In the following example, we give the segment a single parameters with name `nInstances` and [type][types] `Int`. + +```txt +segment loadMovieRatingsSample(nInstances: Int) {} +``` + +More information about parameters can be found in the [linked document][parameters]. + +#### References to Parameters + +Within the segment we can access the value of a parameter using a [reference][references]. Here is a basic example where we print the value of the `nInstances` parameter to the console: + +```txt +segment loadMovieRatingsSample(nInstances: Int) { + print(nInstances); +} +``` + +More information about references can be found in the [linked document][references]. + +### Statements + +In order to describe what should be done when the segment is executed, we need to add [statements][statements] to its body. The previous example in the section ["References to Parameters"](#references-to-parameters) already contained a statement - an [expression statement][expression-statements] to be precise. Here is another example, this time showing an [assignment][assignments]: + +```txt +segment loadMovieRatingsSample(nInstances: Int) { + val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); +} +``` + +More information about statements can be found in the [linked document][statements]. Note particularly, that all statements must end with a semicolon. + +### Results + +[Results][results] (outputs) are used to return values that are produced inside the segment back to the caller. First, we show how to [declare the available results](#result-declaration) of the segment and then how to [assign a value to them](#assigning-to-results). + +#### Result Declaration + +As with [parameters](#parameters) we first need to declare the available results in the headed. This tells [callers](#calling-a-segment) that they can use these results and reminds us to [assign a value to them](#assigning-to-results) in the body of the segment. Let's look at an example: + +```txt +segment loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { + val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); +} +``` + +We added two results to the segment: The first one is called `features` and has type `Dataset`, while the second one is called `target` and also has type `Dataset`. + +More information about the declaration of results can be found in the [linked document][results]. + +#### Assigning to Results + +Currently, the program will not compile since we never assigned a value to these results. This can be done with an [assignment][assignments] and the `yield` keyword: + +```txt +segment loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { + val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); + yield features = movieRatingsSample.keepAttributes( + "leadingActor", + "genre", + "length" + ); + yield target = movieRatingsSample.keepAttributes( + "rating" + ); +} +``` + +In the assignment beginning with `yield features =` we specify the value of the result called `features`, while the next assignment beginning with `yield target =` assigns a value to the `target` result. + +The order of the [result declarations](#result-declaration) does not need to match the order of assignment. However, **each result musts be assigned exactly once**. Note that unlike the `return` in other programming languages, `yield` does not stop the execution of the segment, which allows [assignments][assignments] to different results to be split across multiple [statements][statements]. + +## Visibility + +By default, a segment can be [imported][imports] in any other file and reused there. We say they have `public` visibility. However, it is possible to restrict the visibility of a segment with modifiers: + +```txt +internal segment internalSegment() {} + +private segment privateSegment() {} +``` + +The segment `internalSegment` is only visible in files with the same [package][packages]. The segment `privateSegment` is only visible in the file it is declared in. + +## Calling a Segment + +Inside a [pipeline][pipelines], another segment, or a [lambda][lambdas] we can then [call][calls] a segment, which means the segment is executed when the call is reached: The results of a segment can then be used as needed. In the following example, where we call the segment `loadMovieRatingsSample` that we defined above, we [assign the results to placeholders][assignments-to-placeholders]: + +```txt +val features, val target = loadMovieRatingsSample(nInstances = 1000); +``` + +More information about calls can be found in the [linked document][calls]. + +[imports]: ../common/imports.md +[parameters]: ../common/parameters.md +[results]: ../common/results.md +[types]: ../common/types.md +[packages]: ../common/packages.md +[statements]: statements.md +[assignments]: statements.md#assignments +[assignments-to-placeholders]: statements.md#assigning-placeholders +[expression-statements]: statements.md#expression-statements +[calls]: expressions.md#calls +[lambdas]: expressions.md#lambdas +[references]: expressions.md#references +[pipelines]: pipelines.md diff --git a/docs/language/pipeline-language/statements.md b/docs/language/pipeline-language/statements.md index 654a60de1..d8f3307eb 100644 --- a/docs/language/pipeline-language/statements.md +++ b/docs/language/pipeline-language/statements.md @@ -49,10 +49,10 @@ This assignment to a placeholder has the following syntactic elements: #### References to Placeholder -We can access the value of a placeholder in any statement that follows the assignment of that placeholder in the closest containing [pipeline][pipelines], [step][steps], or [block lambda][block-lambdas] using a [reference][references]. Here is a basic example, where we print the value of the `one` placeholder (here `1`) to the console: +We can access the value of a placeholder in any statement that follows the assignment of that placeholder in the closest containing [pipeline][pipelines], [segment][segments], or [block lambda][block-lambdas] using a [reference][references]. Here is a basic example, where we print the value of the `one` placeholder (here `1`) to the console: ```txt -step loadMovieRatingsSample(nInstances: Int) { +segment loadMovieRatingsSample(nInstances: Int) { val one = 1; print(one); } @@ -62,14 +62,14 @@ More information about references can be found in the [linked document][referenc ### Yielding Results -In addition to the [declaration of placeholders](#declaring-placeholders), assignments are used to assign a value to a [result of a step](#yielding-results-of-steps) or declare [results of a block lambda](#declare-results-of-block-lambdas). +In addition to the [declaration of placeholders](#declaring-placeholders), assignments are used to assign a value to a [result of a segment](#yielding-results-of-segments) or declare [results of a block lambda](#declare-results-of-block-lambdas). -#### Yielding Results of Steps +#### Yielding Results of Segments -The following snippet shows how we can assign a value to a declared [result][results] of a [step][steps]: +The following snippet shows how we can assign a value to a declared [result][results] of a [segment][segments]: ```txt -step trulyRandomInt() -> result: Int { +segment trulyRandomInt() -> result: Int { yield result = 1; } ``` @@ -77,14 +77,14 @@ step trulyRandomInt() -> result: Int { The assignment here has the following syntactic elements: - The keyword `yield`, which indicates that we want to assign to a result. -- The name of the result, here `greeting`. This must be identical to one of the names of a declared result in the header of the step. +- The name of the result, here `greeting`. This must be identical to one of the names of a declared result in the header of the segment. - An `=` sign. - The expression to evaluate (right-hand side). - A semicolon at the end. #### Declare Results of Block Lambdas -Similar syntax is used to yield results of [block lambdas][block-lambdas]. The difference to steps is that block lambdas do not declare their results in their header. Instead the results are declared within the assignments, just like [placeholders](#declaring-placeholders). The block lambda in the following snippet has a single result called `greeting`, which gets the value `"Hello, world!"`: +Similar syntax is used to yield results of [block lambdas][block-lambdas]. The difference to segments is that block lambdas do not declare their results in their header. Instead the results are declared within the assignments, just like [placeholders](#declaring-placeholders). The block lambda in the following snippet has a single result called `greeting`, which gets the value `"Hello, world!"`: ```txt () -> { @@ -115,7 +115,7 @@ So far, the left-hand side of the assignment always had a single assignee. Howev For example, the `split` method in the next example splits a large dataset into two datasets according to a given ratio. We then ignore the first dataset using a [wildcard](#ignoring-results) and [assign the second result to a placeholder](#declaring-placeholders) called `trainingDataset`. Afterwards, we train a `DecisionTree` using the `trainingDataset` and yield the trained model as a result: ```txt -step createModel(fullDataset: Dataset) -> trainedModel: Model { +segment createModel(fullDataset: Dataset) -> trainedModel: Model { _, val trainingDataset = fullDataset.split(0.2); yield trainedModel = DecisionTree().fit(trainingDataset); } @@ -142,5 +142,5 @@ Assignment happens by index, so the first result is assigned to the first assign [block-lambdas]: expressions.md#block-lambdas [calls]: expressions.md#calls [references]: expressions.md#references -[steps]: steps.md +[segments]: segments.md [pipelines]: pipelines.md diff --git a/docs/language/pipeline-language/steps.md b/docs/language/pipeline-language/steps.md deleted file mode 100644 index c2b3926e4..000000000 --- a/docs/language/pipeline-language/steps.md +++ /dev/null @@ -1,136 +0,0 @@ -# Steps - -Steps are used to extract a sequence of [statements][statements] from a data science program to give the sequence a name and make it reusable. In the following discussion we explain how to [declare a step](#declaring-a-step) and how to [call it](#calling-a-step). - -## Declaring a Step - -### Minimal Example - -Let's look at a minimal example of a step: - -```txt -step loadMovieRatingsSample() {} -``` - -This declaration of a step has the following syntactic elements: - -- The keyword `step`. -- The name of the step, here `loadMovieRatingsSample`. This can be any combination of upper- and lowercase letters, underscores, and numbers, as long as it does not start with a number. However, we suggest to use `lowerCamelCase` for the names of steps. -- The list of parameters (i.e. inputs) of the step. This is delimited by parentheses. In the example above, the step has no parameters. -- The _body_ of the step, which contains the [statements][statements] that should be run when the step is [called](#calling-a-step). The body is delimited by curly braces. In this example, the body is empty, so running this step does nothing. - -### Parameters - -To make a step configurable, add [parameters][parameters] (inputs). We will first show how to [declare parameters](#parameter-declaration) and afterwards how to [refer to them](#references-to-parameters) in the body of the step. - -#### Parameter Declaration - -Parameters must be declared in the header of the step so [callers](#calling-a-step) know they are expected to pass them as an argument, and so we can [use them](#references-to-parameters) in the body of the step. - -In the following example, we give the step a single parameters with name `nInstances` and [type][types] `Int`. - -```txt -step loadMovieRatingsSample(nInstances: Int) {} -``` - -More information about parameters can be found in the [linked document][parameters]. - -#### References to Parameters - -Within the step we can access the value of a parameter using a [reference][references]. Here is a basic example where we print the value of the `nInstances` parameter to the console: - -```txt -step loadMovieRatingsSample(nInstances: Int) { - print(nInstances); -} -``` - -More information about references can be found in the [linked document][references]. - -### Statements - -In order to describe what should be done when the step is executed, we need to add [statements][statements] to its body. The previous example in the section ["References to Parameters"](#references-to-parameters) already contained a statement - an [expression statement][expression-statements] to be precise. Here is another example, this time showing an [assignment][assignments]: - -```txt -step loadMovieRatingsSample(nInstances: Int) { - val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); -} -``` - -More information about statements can be found in the [linked document][statements]. Note particularly, that all statements must end with a semicolon. - -### Results - -[Results][results] (outputs) are used to return values that are produced inside the step back to the caller. First, we show how to [declare the available results](#result-declaration) of the step and then how to [assign a value to them](#assigning-to-results). - -#### Result Declaration - -As with [parameters](#parameters) we first need to declare the available results in the headed. This tells [callers](#calling-a-step) that they can use these results and reminds us to [assign a value to them](#assigning-to-results) in the body of the step. Let's look at an example: - -```txt -step loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { - val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); -} -``` - -We added two results to the step: The first one is called `features` and has type `Dataset`, while the second one is called `target` and also has type `Dataset`. - -More information about the declaration of results can be found in the [linked document][results]. - -#### Assigning to Results - -Currently, the program will not compile since we never assigned a value to these results. This can be done with an [assignment][assignments] and the `yield` keyword: - -```txt -step loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { - val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); - yield features = movieRatingsSample.keepAttributes( - "leadingActor", - "genre", - "length" - ); - yield target = movieRatingsSample.keepAttributes( - "rating" - ); -} -``` - -In the assignment beginning with `yield features =` we specify the value of the result called `features`, while the next assignment beginning with `yield target =` assigns a value to the `target` result. - -The order of the [result declarations](#result-declaration) does not need to match the order of assignment. However, **each result musts be assigned exactly once**. Note that unlike the `return` in other programming languages, `yield` does not stop the execution of the step, which allows [assignments][assignments] to different results to be split across multiple [statements][statements]. - -## Visibility - -By default, a step can be [imported][imports] in any other file and reused there. We say they have `public` visibility. However, it is possible to restrict the visibility of a step with modifiers: - -```txt -internal step internalStep() {} - -private step privateStep() {} -``` - -The step `internalStep` is only visible in files with the same [package][packages]. The step `privateStep` is only visible in the file it is declared in. - -## Calling a Step - -Inside a [pipeline][pipelines], another step, or a [lambda][lambdas] we can then [call][calls] a step, which means the step is executed when the call is reached: The results of a step can then be used as needed. In the following example, where we call the step `loadMovieRatingsSample` that we defined above, we [assign the results to placeholders][assignments-to-placeholders]: - -```txt -val features, val target = loadMovieRatingsSample(nInstances = 1000); -``` - -More information about calls can be found in the [linked document][calls]. - -[imports]: ../common/imports.md -[parameters]: ../common/parameters.md -[results]: ../common/results.md -[types]: ../common/types.md -[packages]: ../common/packages.md -[statements]: statements.md -[assignments]: statements.md#assignments -[assignments-to-placeholders]: statements.md#assigning-placeholders -[expression-statements]: statements.md#expression-statements -[calls]: expressions.md#calls -[lambdas]: expressions.md#lambdas -[references]: expressions.md#references -[pipelines]: pipelines.md diff --git a/docs/language/stub-language/annotations.md b/docs/language/stub-language/annotations.md index 25aefe288..c65e0a7a8 100644 --- a/docs/language/stub-language/annotations.md +++ b/docs/language/stub-language/annotations.md @@ -1,6 +1,6 @@ # Annotations -Annotations attach additional metainformation to declarations. Annotations must first be [declared](#declaring-an-annotation), so Safe-DS knows the annotation exists and which inputs are expected. Afterwards, annotations can be [called](#calling-an-annotation), which is the step that truly attaches metainformation to declarations. +Annotations attach additional metainformation to declarations. Annotations must first be [declared](#declaring-an-annotation), so Safe-DS knows the annotation exists and which inputs are expected. Afterwards, annotations can be [called](#calling-an-annotation), which is the segment that truly attaches metainformation to declarations. ## Declaring an Annotation @@ -49,7 +49,7 @@ To attach metainformation to a declaration, the annotation must be called on tha - [Global functions][global-functions] / [methods][methods] - [Parameters][parameters] - [Results][results] -- [Steps][steps] +- [Segments][segments] - [Type parameters][type-parameters] - [Pipelines][pipelines] @@ -101,7 +101,7 @@ The package `safeds.lang` contains several annotations that are processed by Saf [global-functions]: global-functions.md [methods]: classes.md#defining-methods [results]: ../common/parameters.md -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [type-parameters]: type-parameters.md [pipelines]: ../pipeline-language/pipelines.md [safeds-lang]: ../../stdlib/safeds_lang.md diff --git a/docs/requirements.txt b/docs/requirements.txt index d37d31479..e2ccaed89 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -mkdocs==1.4.2 -mkdocs-glightbox==0.3.2 -mkdocs-material==9.1.5 +mkdocs==1.4.3 +mkdocs-glightbox==0.3.4 +mkdocs-material==9.1.17 diff --git a/docs/stdlib/safeds_lang.md b/docs/stdlib/safeds_lang.md index 0bf975390..4f98b5827 100644 --- a/docs/stdlib/safeds_lang.md +++ b/docs/stdlib/safeds_lang.md @@ -118,8 +118,8 @@ The annotation can be called on results. **Parameters:** _None expected._ -### Enum Variant `Step` -The annotation can be called on steps. +### Enum Variant `Segment` +The annotation can be called on segments. **Parameters:** _None expected._ @@ -158,7 +158,7 @@ The declaration should no longer be used. * Function * Parameter * Result -* Step +* Segment * TypeParameter ## Annotation `Description` @@ -180,7 +180,7 @@ The purpose of a declaration. * Parameter * Pipeline * Result -* Step +* Segment * TypeParameter ## Annotation `Experimental` @@ -196,7 +196,7 @@ The declaration might change without a major version bump. * Function * Parameter * Result -* Step +* Segment * TypeParameter ## Annotation `Expert` @@ -247,7 +247,7 @@ The name of the corresponding API element in Python (default is the name of the * Function * Parameter * Pipeline -* Step +* Segment ## Annotation `Repeatable` The annotation can be called multiple times for the same declaration. @@ -275,7 +275,7 @@ The version in which a declaration was added. * Parameter * Pipeline * Result -* Step +* Segment * TypeParameter ## Annotation `Target` @@ -288,4 +288,3 @@ The annotation can target these declaration types. If the @Target annotation is **Valid targets:** * Annotation - diff --git a/mkdocs.yml b/mkdocs.yml index 5aaea3632..41bac7a9a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,7 +12,7 @@ nav: - Pipeline Language: - language/pipeline-language/README.md - Pipelines: language/pipeline-language/pipelines.md - - Steps: language/pipeline-language/steps.md + - Segments: language/pipeline-language/segments.md - Statements: language/pipeline-language/statements.md - Expressions: language/pipeline-language/expressions.md - Common: @@ -35,8 +35,8 @@ nav: - stdlib/README.md - safeds.lang: stdlib/safeds_lang.md - Development: - - DSL Development Checklist: development/dsl-development-checklist.md - - Release Checklist: development/release-checklist.md + - Grammar Testing: development/grammar-testing.md + - Formatting Testing: development/formatting-testing.md # Configuration of MkDocs & Material for MkDocs -------------------------------- diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index f93bec221..62e91851d 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,14 +1,8 @@ { - "extends": "./DSL/com.larsreimann.safeds.vscode/tsconfig.json", + "extends": "./DSL/tsconfig.json", "compilerOptions": { "noEmit": true }, - "include": [ - "./.eslintrc.js", - "./docs/javascript/**/*", - "./DSL/com.larsreimann.safeds.vscode/src/**/*", - "./DSL-langium/src/**/*", - "./DSL-langium/tests/**/*" - ], + "include": ["./.eslintrc.js", "./docs/javascript/**/*", "./DSL/src/**/*", "./DSL/tests/**/*"], "exclude": [] }