From efd9291264d108be9ef51246072af93d0d5c422f Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Thu, 26 Sep 2024 14:38:41 -0600 Subject: [PATCH 01/15] implemented scip-test --- .github/workflows/ci.yaml | 2 +- Makefile | 7 +- test/lib/functions.dart | 25 +++ test/pubspec.lock | 365 ++++++++++++++++++++++++++++++++++++++ test/pubspec.yaml | 8 + 5 files changed, 405 insertions(+), 2 deletions(-) create mode 100644 test/lib/functions.dart create mode 100644 test/pubspec.lock create mode 100644 test/pubspec.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f88a94da..7523d389 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v4 - name: Install scip cli run: | - bash -c 'curl -L "https://github.com/sourcegraph/scip/releases/download/v0.3.3/scip-linux-amd64.tar.gz"' | tar xzf - scip + bash -c 'curl -L "https://github.com/sourcegraph/scip/releases/download/v0.5.0/scip-linux-amd64.tar.gz"' | tar xzf - scip ./scip --version - uses: dart-lang/setup-dart@v1 diff --git a/Makefile b/Makefile index bdf91850..3907c450 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,9 @@ gen-proto: protoc --dart_out=. ./lib/src/gen/scip.proto print: - scip print ./index.scip \ No newline at end of file + scip print ./index.scip + +.PHONY: test +test: + dart run scip_dart ./test + scip test ./test \ No newline at end of file diff --git a/test/lib/functions.dart b/test/lib/functions.dart new file mode 100644 index 00000000..c8eb7898 --- /dev/null +++ b/test/lib/functions.dart @@ -0,0 +1,25 @@ +void main() {} +// ^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/main(). + +String withReturn() => 'asdf'; +// <- reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# + +void withParameters( + String pos, +//^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// ^^^ definition local 0 + int pos2, +//^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# +// ^^^^ definition local 1 +) {} + +void withNamedParameters({ + String? name, +//^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// ^^^^ definition scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# + int? name2, +//^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# +// ^^^^^ definition scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# +}) {} + +void withPositionalParameters(String base, [String? pos, int? pos2]) {} diff --git a/test/pubspec.lock b/test/pubspec.lock new file mode 100644 index 00000000..e4b7cf07 --- /dev/null +++ b/test/pubspec.lock @@ -0,0 +1,365 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + url: "https://pub.dev" + source: hosted + version: "61.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + url: "https://pub.dev" + source: hosted + version: "5.13.0" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" + url: "https://pub.dev" + source: hosted + version: "1.6.4" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: "direct main" + description: + name: test + sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" + url: "https://pub.dev" + source: hosted + version: "1.24.3" + test_api: + dependency: transitive + description: + name: test_api + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + test_core: + dependency: transitive + description: + name: test_core + sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" + url: "https://pub.dev" + source: hosted + version: "0.5.3" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + url: "https://pub.dev" + source: hosted + version: "11.10.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=2.19.0 <3.0.0" diff --git a/test/pubspec.yaml b/test/pubspec.yaml new file mode 100644 index 00000000..3d1e239f --- /dev/null +++ b/test/pubspec.yaml @@ -0,0 +1,8 @@ +name: scip_dart_test +version: 1.0.0 + +environment: + sdk: ">=2.18.0 <3.0.0" + +dependencies: + test: ^1.24.3 \ No newline at end of file From 5eefb655f59970d0528f0aa7d83b7cb2111d1476 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Thu, 26 Sep 2024 22:14:32 -0600 Subject: [PATCH 02/15] iter --- Makefile | 2 +- test/lib/functions.dart | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 3907c450..1b9142d2 100644 --- a/Makefile +++ b/Makefile @@ -26,4 +26,4 @@ print: .PHONY: test test: dart run scip_dart ./test - scip test ./test \ No newline at end of file + cd ~/go/src/github.com/sourcegraph/scip && go run ./cmd/scip test --from=/Users/matthewnitschke/Repos/Workiva/scip-dart/index.scip /Users/matthewnitschke/Repos/Workiva/scip-dart/test \ No newline at end of file diff --git a/test/lib/functions.dart b/test/lib/functions.dart index c8eb7898..0698fb54 100644 --- a/test/lib/functions.dart +++ b/test/lib/functions.dart @@ -1,25 +1,29 @@ -void main() {} -// ^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/main(). +void main() { + withReturn(); + // <- definition asdf +} + +@Deprecated('a') String withReturn() => 'asdf'; -// <- reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// <- reference scip-dart pub dart:core . dart:core/`string.dart`/String# void withParameters( String pos, -//^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +//^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# // ^^^ definition local 0 int pos2, -//^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# +//^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# // ^^^^ definition local 1 ) {} void withNamedParameters({ String? name, -//^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# -// ^^^^ definition scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +//^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/withNamedParameters().(name) int? name2, -//^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# -// ^^^^^ definition scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# +//^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +// ^^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/withNamedParameters().(name2) }) {} void withPositionalParameters(String base, [String? pos, int? pos2]) {} From 21f011c530db1424a5224a05c36b88a8d670586c Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Sun, 21 Sep 2025 16:26:18 -0600 Subject: [PATCH 03/15] fleshed out parameters --- test/lib/functions.dart | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/test/lib/functions.dart b/test/lib/functions.dart index 0698fb54..980f1279 100644 --- a/test/lib/functions.dart +++ b/test/lib/functions.dart @@ -1,10 +1,12 @@ void main() { withReturn(); - // <- definition asdf + // <- reference scip-dart pub scip_dart_test . lib/`functions.dart`/withReturn(). } -@Deprecated('a') +void basicFunction() {} +// ^^^^^^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`functions.dart`/basicFunction(). + String withReturn() => 'asdf'; // <- reference scip-dart pub dart:core . dart:core/`string.dart`/String# @@ -13,17 +15,34 @@ void withParameters( //^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# // ^^^ definition local 0 int pos2, -//^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +//^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# // ^^^^ definition local 1 ) {} -void withNamedParameters({ +void withNamedParameters( + String base, { +//^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^^ definition local . + String? name, //^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# // ^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/withNamedParameters().(name) + int? name2, //^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# // ^^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/withNamedParameters().(name2) }) {} -void withPositionalParameters(String base, [String? pos, int? pos2]) {} +void withPositionalParameters( + String base, [ +//^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^^ definition local . + + String? pos, +//^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^ definition local . + + int? pos2 +//^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +// ^^^^ definition local . +]) {} From c0658e9efdc2b9337371a1eaa53b57834fd6cf11 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Mon, 22 Sep 2025 13:27:00 -0600 Subject: [PATCH 04/15] implemented functions variables and classes tests --- test/lib/classes.dart | 17 +++++++++++++++++ test/lib/variables.dart | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 test/lib/classes.dart create mode 100644 test/lib/variables.dart diff --git a/test/lib/classes.dart b/test/lib/classes.dart new file mode 100644 index 00000000..879e0a22 --- /dev/null +++ b/test/lib/classes.dart @@ -0,0 +1,17 @@ +class AClass {} +class BClass {} +class CClass {} + +mixin AMixin on AClass {} +// ^^^^^^ definition scip-dart pub scip_dart_test . lib/`classes.dart`/AMixin# +// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/AClass# + +class ComplexClass +// ^^^^^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`classes.dart`/ComplexClass# + extends AClass +// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/AClass# + with AMixin +// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/AMixin# + implements CClass, BClass {} +// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/CClass# +// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/BClass# \ No newline at end of file diff --git a/test/lib/variables.dart b/test/lib/variables.dart new file mode 100644 index 00000000..ae06bacc --- /dev/null +++ b/test/lib/variables.dart @@ -0,0 +1,22 @@ +const foo = 'asdf'; +// ^^^ definition scip-dart pub scip_dart_test . lib/`variables.dart`/foo. + +final String bar = 'asdf'; +// ^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^ definition scip-dart pub scip_dart_test . lib/`variables.dart`/bar. + +var zar = 1; +// ^^^ definition scip-dart pub scip_dart_test . lib/`variables.dart`/zar. + +void main() { + final variable = 'some local variable'; + // ^^^^^^^^ definition local 0 + + print(variable); + // ^^^^^^^^ reference local 0 + + print(foo + bar + zar.toString()); + // ^^^ reference scip-dart pub scip_dart_test . lib/`variables.dart`/foo. + // ^^^ reference scip-dart pub scip_dart_test . lib/`variables.dart`/bar. + // ^^^ reference scip-dart pub scip_dart_test . lib/`variables.dart`/zar. +} \ No newline at end of file From fd9a6f2d1c8075fe96d0b3b29fee36c29b1e2961 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Mon, 22 Sep 2025 13:34:42 -0600 Subject: [PATCH 05/15] runner --- .github/workflows/ci.yaml | 11 ++++++++++- Makefile | 7 ++++--- test/lib/classes.dart | 5 ++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4ee2a8de..cf06eafa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,6 +18,16 @@ jobs: build: uses: Workiva/gha-dart-oss/.github/workflows/build.yaml@v0.1.12 + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: dart-lang/setup-dart@v1 + with: + sdk: 2.19.6 + - run: dart pub get + - run: make gen-test test + snapshots: runs-on: ubuntu-latest strategy: @@ -61,7 +71,6 @@ jobs: exit 1 fi - consumer: runs-on: ubuntu-latest strategy: diff --git a/Makefile b/Makefile index 7f88a8d7..22e04f04 100644 --- a/Makefile +++ b/Makefile @@ -29,11 +29,12 @@ gen-proto: print: scip print ./index.scip +gen-test: + dart ./bin/scip_dart.dart ./test + .PHONY: test test: - dart run scip_dart ./test - cd ~/go/src/github.com/sourcegraph/scip && go run ./cmd/scip test --from=/Users/matthewnitschke/Repos/Workiva/scip-dart/index.scip /Users/matthewnitschke/Repos/Workiva/scip-dart/test - scip print ./index.scip + ~/go/src/github.com/sourcegraph/scip/scip test ./test print-ast: dart run ./tool/ast_printer.dart ./snapshots/input/staging-project diff --git a/test/lib/classes.dart b/test/lib/classes.dart index 879e0a22..bb962435 100644 --- a/test/lib/classes.dart +++ b/test/lib/classes.dart @@ -14,4 +14,7 @@ class ComplexClass // ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/AMixin# implements CClass, BClass {} // ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/CClass# -// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/BClass# \ No newline at end of file +// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/BClass# + +void fn(ComplexClass c) {} +// ^^^^^^^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/ComplexClass# \ No newline at end of file From 40d50402783382fcb483f53b7631b8509a642e4e Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Mon, 22 Sep 2025 13:37:03 -0600 Subject: [PATCH 06/15] setup scip cli action --- .github/actions/setup-scip-cli/action.yaml | 26 ++++++++++++++++++++++ .github/workflows/ci.yaml | 10 ++++----- 2 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 .github/actions/setup-scip-cli/action.yaml diff --git a/.github/actions/setup-scip-cli/action.yaml b/.github/actions/setup-scip-cli/action.yaml new file mode 100644 index 00000000..1fc4f7e2 --- /dev/null +++ b/.github/actions/setup-scip-cli/action.yaml @@ -0,0 +1,26 @@ +name: Setup SCIP CLI +description: Sets up the SCIP cli + +inputs: + version: + description: The version of the scip cli to setup + default: 0.5.1 + +runs: + using: composite + steps: + # scip is very small, doesn't make sense to try and cache it + - name: Install SCIP CLI + shell: bash + run: | + bash -c 'curl -L "https://github.com/sourcegraph/scip/releases/download/v${{ inputs.version }}/scip-linux-amd64.tar.gz"' | tar xzf - scip + + ./scip --version + + RUNNER_TOOL_CACHE="/opt/hostedtoolcache" + mkdir -p "$RUNNER_TOOL_CACHE/scip/${{ inputs.version }}/x64" + mv ./scip "$RUNNER_TOOL_CACHE/scip/${{ inputs.version }}/x64" + + - name: Add scip to PATH + shell: bash + run: echo "/opt/hostedtoolcache/scip/${{ inputs.version }}/x64" >> $GITHUB_PATH \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cf06eafa..6775f4e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,10 @@ jobs: with: sdk: 2.19.6 - run: dart pub get - - run: make gen-test test + + - uses: ./.github/actions/setup-scip-cli + + - run: make gen-test test p snapshots: runs-on: ubuntu-latest @@ -40,10 +43,7 @@ jobs: sdk: 3.7.2 steps: - uses: actions/checkout@v5 - - name: Install scip cli - run: | - bash -c 'curl -L "https://github.com/sourcegraph/scip/releases/download/v0.5.0/scip-linux-amd64.tar.gz"' | tar xzf - scip - ./scip --version + - uses: ./.github/actions/setup-scip-cli - uses: dart-lang/setup-dart@v1 with: From 15a401bc0968d9cf3bdf4b2563f49f4c64d27572 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Mon, 22 Sep 2025 13:39:15 -0600 Subject: [PATCH 07/15] ignore test directory --- tool/dart_dev/config.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/tool/dart_dev/config.dart b/tool/dart_dev/config.dart index ffe7397c..5bd25c0f 100644 --- a/tool/dart_dev/config.dart +++ b/tool/dart_dev/config.dart @@ -7,5 +7,6 @@ final config = { ..exclude = [ Glob('snapshots/**'), Glob('lib/src/gen/*.dart'), + Glob('test/**') ], }; From c28cca198776c11f8a6222d56dabe17cfd62ab00 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Mon, 22 Sep 2025 13:41:39 -0600 Subject: [PATCH 08/15] fixed scip path --- .github/workflows/ci.yaml | 4 ++-- Makefile | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6775f4e1..18407d66 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,7 @@ jobs: - uses: ./.github/actions/setup-scip-cli - - run: make gen-test test p + - run: make gen-test test snapshots: runs-on: ubuntu-latest @@ -58,7 +58,7 @@ jobs: - name: Snapshots Diff Check run: | dart run scip_dart ./snapshots/input/${{ matrix.dir.path }} --index-pubspec - ./scip snapshot --to ./snapshots/output/${{ matrix.dir.path }} + scip snapshot --to ./snapshots/output/${{ matrix.dir.path }} if [[ -z "$(git status --porcelain ./snapshots/output/${{ matrix.dir.path }})" ]]; then diff --git a/Makefile b/Makefile index 22e04f04..3815e422 100644 --- a/Makefile +++ b/Makefile @@ -31,10 +31,11 @@ print: gen-test: dart ./bin/scip_dart.dart ./test - + .PHONY: test test: - ~/go/src/github.com/sourcegraph/scip/scip test ./test + scip test ./test +# ~/go/src/github.com/sourcegraph/scip/scip test ./test print-ast: dart run ./tool/ast_printer.dart ./snapshots/input/staging-project From 3576cebe8b289fcef801ff9ca6100f55c5be2ebf Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Mon, 22 Sep 2025 15:35:59 -0600 Subject: [PATCH 09/15] fix --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3815e422..bbbf5d38 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,7 @@ gen-test: .PHONY: test test: - scip test ./test -# ~/go/src/github.com/sourcegraph/scip/scip test ./test + scip test ./test print-ast: dart run ./tool/ast_printer.dart ./snapshots/input/staging-project From 15ec8f0cafe94d508abe4d7030b33b4fd6c3b0cb Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Tue, 23 Sep 2025 08:10:10 -0600 Subject: [PATCH 10/15] latest scip cli --- .github/actions/setup-scip-cli/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-scip-cli/action.yaml b/.github/actions/setup-scip-cli/action.yaml index 1fc4f7e2..ddf128d9 100644 --- a/.github/actions/setup-scip-cli/action.yaml +++ b/.github/actions/setup-scip-cli/action.yaml @@ -4,7 +4,7 @@ description: Sets up the SCIP cli inputs: version: description: The version of the scip cli to setup - default: 0.5.1 + default: 0.6.0 runs: using: composite From facc3162421517815143e2c1e6baf696ade5245e Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Tue, 23 Sep 2025 08:14:38 -0600 Subject: [PATCH 11/15] ignore makefile --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 18407d66..77081078 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,10 @@ jobs: - uses: ./.github/actions/setup-scip-cli - - run: make gen-test test + - working-directory: test + run: | + dart ../bin/scip_dart.dart ./ + scip test ./ snapshots: runs-on: ubuntu-latest From 5a9f192787abb0d9a6cfdc80ed4a789ac395c144 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Tue, 23 Sep 2025 08:20:09 -0600 Subject: [PATCH 12/15] upload artifact --- .github/workflows/ci.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 77081078..aef38659 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,9 +30,11 @@ jobs: - uses: ./.github/actions/setup-scip-cli - working-directory: test - run: | - dart ../bin/scip_dart.dart ./ - scip test ./ + run: dart ../bin/scip_dart.dart ./ + + - uses: actions/upload-artifact@v4 + with: + path: ./test/index.scip snapshots: runs-on: ubuntu-latest From f7b714a37d9ff2865aeac27d0e086efcef7f0b1c Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Tue, 23 Sep 2025 08:25:39 -0600 Subject: [PATCH 13/15] re-run scip-test --- .github/workflows/ci.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aef38659..77081078 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,11 +30,9 @@ jobs: - uses: ./.github/actions/setup-scip-cli - working-directory: test - run: dart ../bin/scip_dart.dart ./ - - - uses: actions/upload-artifact@v4 - with: - path: ./test/index.scip + run: | + dart ../bin/scip_dart.dart ./ + scip test ./ snapshots: runs-on: ubuntu-latest From 846f9b110893108213efbb926900b8f43051a426 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Fri, 26 Sep 2025 12:53:17 -0600 Subject: [PATCH 14/15] added additional test coverage --- test/lib/classes.dart | 10 ++++++---- test/lib/constructors.dart | 12 ++++++++++++ test/lib/enums.dart | 37 +++++++++++++++++++++++++++++++++++++ test/lib/fields.dart | 21 +++++++++++++++++++++ test/lib/functions.dart | 4 ++-- test/lib/methods.dart | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 test/lib/constructors.dart create mode 100644 test/lib/enums.dart create mode 100644 test/lib/fields.dart create mode 100644 test/lib/methods.dart diff --git a/test/lib/classes.dart b/test/lib/classes.dart index bb962435..aa5515e7 100644 --- a/test/lib/classes.dart +++ b/test/lib/classes.dart @@ -1,20 +1,22 @@ class AClass {} class BClass {} -class CClass {} +class CClass {} mixin AMixin on AClass {} // ^^^^^^ definition scip-dart pub scip_dart_test . lib/`classes.dart`/AMixin# // ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/AClass# -class ComplexClass +class ComplexClass // ^^^^^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`classes.dart`/ComplexClass# +// ^ definition scip-dart pub scip_dart_test 1.0.0 lib/`classes.dart`/T# extends AClass // ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/AClass# with AMixin // ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/AMixin# - implements CClass, BClass {} + implements CClass, BClass {} // ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/CClass# -// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/BClass# +// ^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +// ^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/BClass# void fn(ComplexClass c) {} // ^^^^^^^^^^^^ reference scip-dart pub scip_dart_test . lib/`classes.dart`/ComplexClass# \ No newline at end of file diff --git a/test/lib/constructors.dart b/test/lib/constructors.dart new file mode 100644 index 00000000..f430b5b4 --- /dev/null +++ b/test/lib/constructors.dart @@ -0,0 +1,12 @@ +class AClass { + AClass(); +//^^^^^^ definition scip-dart pub scip_dart_test . lib/`constructors.dart`/AClass#``(). + + AClass.bar() { +// ^^^ definition scip-dart pub scip_dart_test . lib/`constructors.dart`/AClass#bar(). + print(''); + } + + factory AClass.car() => AClass(); + // ^^^ definition scip-dart pub scip_dart_test . lib/`constructors.dart`/AClass#car(). +} \ No newline at end of file diff --git a/test/lib/enums.dart b/test/lib/enums.dart new file mode 100644 index 00000000..e9b2daad --- /dev/null +++ b/test/lib/enums.dart @@ -0,0 +1,37 @@ +enum AnEnum { +// ^^^^^^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnum# + a, +//^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnum#a. + b +//^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnum#b. +} + +enum AnEnhancedEnum { +// ^^^^^^^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum# + + a(val: 3), +//^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#a. +// ^^^ reference scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#``().(val) + + b(val: 2); +//^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#b. +// ^^^ reference scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#``().(val) + + const AnEnhancedEnum({ +// ^^^^^^^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#``(). + required this.val, +// ^^^ reference scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#val. + }); + + final int val; +// ^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +// ^^^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#val. + + int get getter => val * 2; +//^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +// ^^^^^^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#`getter`. + + String method(String inp) => inp + val.toString(); +//^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^^^^ definition scip-dart pub scip_dart_test . lib/`enums.dart`/AnEnhancedEnum#method(). +} \ No newline at end of file diff --git a/test/lib/fields.dart b/test/lib/fields.dart new file mode 100644 index 00000000..445b5ffc --- /dev/null +++ b/test/lib/fields.dart @@ -0,0 +1,21 @@ +class AClass { + final inferred = 'a'; +// ^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`fields.dart`/AClass#inferred. + + final String declared = 'b'; +// ^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`fields.dart`/AClass#declared. + + static String static = 'c'; +// ^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# +// ^^^^^^ definition scip-dart pub scip_dart_test . lib/`fields.dart`/AClass#static. + + int get getter => 0; +//^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +// ^^^^^^ definition scip-dart pub scip_dart_test . lib/`fields.dart`/AClass#`getter`. + + set setter(int v) {} +// ^^^^^^ definition scip-dart pub scip_dart_test . lib/`fields.dart`/AClass#`setter`. +// ^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# +// ^ definition local . +} \ No newline at end of file diff --git a/test/lib/functions.dart b/test/lib/functions.dart index 980f1279..69b225b7 100644 --- a/test/lib/functions.dart +++ b/test/lib/functions.dart @@ -26,11 +26,11 @@ void withNamedParameters( String? name, //^^^^^^ reference scip-dart pub dart:core . dart:core/`string.dart`/String# -// ^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/withNamedParameters().(name) +// ^^^^ definition scip-dart pub scip_dart_test . lib/`functions.dart`/withNamedParameters().(name) int? name2, //^^^ reference scip-dart pub dart:core . dart:core/`int.dart`/int# -// ^^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`functions.dart`/withNamedParameters().(name2) +// ^^^^^ definition scip-dart pub scip_dart_test . lib/`functions.dart`/withNamedParameters().(name2) }) {} void withPositionalParameters( diff --git a/test/lib/methods.dart b/test/lib/methods.dart new file mode 100644 index 00000000..6422bdc3 --- /dev/null +++ b/test/lib/methods.dart @@ -0,0 +1,37 @@ +class AClass { + void basicMethod() {} +// ^^^^^^^^^^^ definition scip-dart pub scip_dart_test . lib/`methods.dart`/AClass#basicMethod(). + + String withReturn() => 'asdf'; +//^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// ^^^^^^^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`methods.dart`/AClass#withReturn(). + + void withNamedParameters( +// ^^^^^^^^^^^^^^^^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`methods.dart`/AClass#withNamedParameters(). + String base, { +// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// ^^^^ definition local . + + String? name, +// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// ^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`methods.dart`/AClass#withNamedParameters().(name) + + int? name2 +// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# +// ^^^^^ definition scip-dart pub scip_dart_test 1.0.0 lib/`methods.dart`/AClass#withNamedParameters().(name2) + }) {} + + void withPositionalParameters( + String base, [ +// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// ^^^^ definition local . + + String? pos, +// ^^^^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`string.dart`/String# +// ^^^ definition local . + + int? pos2, +// ^^^ reference scip-dart pub dart:core 2.19.0 dart:core/`int.dart`/int# +// ^^^^ definition local . + ]) {} +} \ No newline at end of file From 9ce4ef66769427196c851e95864b3ae117b11d18 Mon Sep 17 00:00:00 2001 From: Matthew Nitschke Date: Fri, 26 Sep 2025 12:54:42 -0600 Subject: [PATCH 15/15] pg --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 77081078..b00f775a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,6 +31,7 @@ jobs: - working-directory: test run: | + dart pub get dart ../bin/scip_dart.dart ./ scip test ./