Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEA-3240: Support Dart v3 #116

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
jobs:
snapshots:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dir: [basic-project, diagnostics, dart3-features]
steps:
- uses: actions/checkout@v3
- name: Install scip cli
Expand All @@ -19,38 +23,31 @@ jobs:

- uses: dart-lang/setup-dart@v1
with:
# use a fixed version number so changes to 'stable', dont break snapshot diffs (language version is used in the scip symbol)
sdk: 2.19.6
- name: dart pub get scip-dart package
run: dart pub get

- name: dart pub get basic-project directory
- name: pub get scip-dart package
run: dart pub get
working-directory: ./snapshots/input/basic-project

- name: dart pub get diagnostics directory
- name: pub get
working-directory: ./snapshots/input/${{ matrix.dir }}
run: dart pub get
working-directory: ./snapshots/input/diagnostics

- name: Snapshots Diff Check
run: |
dart run scip_dart ./snapshots/input/basic-project
./scip snapshot --to ./snapshots/output/basic-project

dart run scip_dart ./snapshots/input/diagnostics
./scip snapshot --to ./snapshots/output/diagnostics
dart run scip_dart ./snapshots/input/${{ matrix.dir }}
./scip snapshot --to ./snapshots/output/${{matrix.dir}}

if [[ -z "$(git status --porcelain ./snapshots/output)" ]];
if [[ -z "$(git status --porcelain ./snapshots/output/${{ matrix.dir }})" ]];
then
echo "No changes to snapshot files"
else
echo
echo "Snapshot diff detected differences, run 'make gen-snaps' to re-generate snapshots"
git status --short ./snapshots/output
echo "Snapshot diff detected differences, run 'make regen-snapshots' to re-generate snapshots"
git --no-pager diff ./snapshots/output/${{ matrix.dir }}
echo
exit 1
fi


consumer:
runs-on: ubuntu-latest
strategy:
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
regen-snapshots:
dart run scip_dart ./snapshots/input/basic-project
scip snapshot --to ./snapshots/output/basic-project

dart run scip_dart ./snapshots/input/diagnostics
scip snapshot --to ./snapshots/output/diagnostics
./tool/regen-snapshots.sh

run:
dart run scip_dart ./snapshots/input/staging-project --verbose
Expand Down
78 changes: 39 additions & 39 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: e440ac42679dfc04bbbefb58ed225c994bc7e07fccc8a68ec7d3631a127e5da9
sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
url: "https://pub.dev"
source: hosted
version: "54.0.0"
version: "61.0.0"
analyzer:
dependency: "direct main"
description:
name: analyzer
sha256: "2c2e3721ee9fb36de92faa060f3480c81b23e904352b087e5c64224b1a044427"
sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
url: "https://pub.dev"
source: hosted
version: "5.6.0"
version: "5.13.0"
args:
dependency: "direct main"
description:
name: args
sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
url: "https://pub.dev"
source: hosted
version: "2.4.1"
version: "2.4.2"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -69,10 +69,10 @@ packages:
dependency: transitive
description:
name: build_resolvers
sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95
sha256: "0713a05b0386bd97f9e63e78108805a4feca5898a4b821d6610857f10c91e975"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.4.0"
build_runner:
dependency: transitive
description:
Expand All @@ -85,10 +85,10 @@ packages:
dependency: transitive
description:
name: build_runner_core
sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292"
sha256: "0671ad4162ed510b70d0eb4ad6354c249f8429cab4ae7a4cec86bbc2886eb76e"
url: "https://pub.dev"
source: hosted
version: "7.2.7"
version: "7.2.7+1"
built_collection:
dependency: transitive
description:
Expand All @@ -101,10 +101,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: "598a2a682e2a7a90f08ba39c0aaa9374c5112340f0a2e275f61b59389543d166"
sha256: "69acb7007eb2a31dc901512bfe0f7b767168be34cb734835d54c070bfa74c1b2"
url: "https://pub.dev"
source: hosted
version: "8.6.1"
version: "8.8.0"
chalk:
dependency: "direct dev"
description:
Expand All @@ -117,18 +117,18 @@ packages:
dependency: transitive
description:
name: checked_yaml
sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311"
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted
version: "2.0.2"
version: "2.0.3"
code_builder:
dependency: transitive
description:
name: code_builder
sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe"
sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677"
url: "https://pub.dev"
source: hosted
version: "4.4.0"
version: "4.7.0"
collection:
dependency: transitive
description:
Expand All @@ -149,10 +149,10 @@ packages:
dependency: transitive
description:
name: crypto
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.3"
dart_dev:
dependency: "direct dev"
description:
Expand All @@ -165,10 +165,10 @@ packages:
dependency: transitive
description:
name: dart_style
sha256: "5be16bf1707658e4c03078d4a9b90208ded217fb02c163e207d334082412f2fb"
sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55"
url: "https://pub.dev"
source: hosted
version: "2.2.5"
version: "2.3.2"
dependency_validator:
dependency: "direct dev"
description:
Expand All @@ -189,10 +189,10 @@ packages:
dependency: transitive
description:
name: fixnum
sha256: "04be3e934c52e082558cc9ee21f42f5c1cd7a1262f4c63cd0357c08d5bba81ec"
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
version: "1.1.0"
frontend_server_client:
dependency: transitive
description:
Expand All @@ -205,10 +205,10 @@ packages:
dependency: "direct dev"
description:
name: glob
sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c"
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
graphs:
dependency: transitive
description:
Expand Down Expand Up @@ -245,26 +245,26 @@ packages:
dependency: transitive
description:
name: js
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.5"
version: "0.6.7"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
url: "https://pub.dev"
source: hosted
version: "4.8.0"
version: "4.8.1"
logging:
dependency: transitive
description:
name: logging
sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d"
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
version: "1.2.0"
matcher:
dependency: transitive
description:
Expand All @@ -277,10 +277,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.11.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -365,18 +365,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
stream_transform:
dependency: transitive
description:
Expand Down Expand Up @@ -453,9 +453,9 @@ packages:
dependency: transitive
description:
name: yaml
sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370"
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.2"
sdks:
dart: ">=2.18.0 <3.0.0"
dart: ">=2.19.6 <3.0.0"
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ description: generates scip bindings for dart files
repository: https://github.com/Workiva/scip-dart

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.19.6 <4.0.0"

executables:
scip_dart:

dependencies:
analyzer: ^5.4.0
analyzer: ^5.13.0
args: ^2.4.0
package_config: ^2.1.0
path: ^1.8.3
Expand Down
65 changes: 65 additions & 0 deletions snapshots/input/dart3-features/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
(String, int) userInfo(Map<String, dynamic> json) {
return (json['name'] as String, json['height'] as int);
}

void parser(int charCode) {
const slash = 1;
const star = 2;
const plus = 3;
const minus = 4;

final nextCharCode = 'a';
const digit0 = 0;
const digit9 = 9;

void skipComment() {}
void operatorFn(int charCode) {}
void number() {}
void invalid() {}

switch (charCode) {
case slash when nextCharCode == slash:
skipComment();

case slash || star || plus || minus:
operatorFn(charCode);

case >= digit0 && <= digit9:
number();

default:
invalid();
}
}

const six = 6;
const msg = 'Feeling the Monday blues?';
String describeDate(DateTime dt) {
const one = 1;
return switch (dt.weekday) {
one => 'Feeling the Monday blues?',
7 || six => 'Enjoy the weekend!',
_ => 'Hang in there.'
};
}

void main() {
var (
String name,
int height,
) = userInfo({'name': 'Michael', 'height': 180});
print('User $name is $height cm tall.');

final json = {'name': 'Michael', 'height': 180};
if (json case {'name': 'Michael', 'height': int h}) {
print('Michael is $h cm tall.');
}
}

base class Foo {}

final class Bar {}

interface class Car {}

sealed class Zar {}
5 changes: 5 additions & 0 deletions snapshots/input/dart3-features/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages: {}
sdks:
dart: ">=2.19.6 <4.0.0"
5 changes: 5 additions & 0 deletions snapshots/input/dart3-features/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: dart3_features
version: 1.0.0

environment:
sdk: ">=2.19.6 <4.0.0"
Loading
Loading