steep 1.10.0 → 2.1.0.dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +84 -1
  3. data/CLAUDE.md +114 -0
  4. data/README.md +2 -2
  5. data/Rakefile +365 -150
  6. data/Steepfile +13 -13
  7. data/doc/release.md +264 -0
  8. data/lib/steep/annotation_parser.rb +5 -1
  9. data/lib/steep/annotations_helper.rb +12 -2
  10. data/lib/steep/ast/node/type_application.rb +22 -16
  11. data/lib/steep/ast/node/type_assertion.rb +7 -4
  12. data/lib/steep/ast/types/factory.rb +3 -2
  13. data/lib/steep/cli.rb +246 -2
  14. data/lib/steep/daemon/configuration.rb +19 -0
  15. data/lib/steep/daemon/server.rb +476 -0
  16. data/lib/steep/daemon.rb +201 -0
  17. data/lib/steep/diagnostic/ruby.rb +54 -12
  18. data/lib/steep/diagnostic/signature.rb +31 -8
  19. data/lib/steep/drivers/check.rb +301 -140
  20. data/lib/steep/drivers/print_project.rb +9 -10
  21. data/lib/steep/drivers/query.rb +102 -0
  22. data/lib/steep/drivers/start_server.rb +19 -0
  23. data/lib/steep/drivers/stop_server.rb +20 -0
  24. data/lib/steep/drivers/watch.rb +2 -2
  25. data/lib/steep/index/rbs_index.rb +38 -13
  26. data/lib/steep/index/signature_symbol_provider.rb +24 -3
  27. data/lib/steep/interface/builder.rb +48 -15
  28. data/lib/steep/interface/shape.rb +13 -5
  29. data/lib/steep/locator.rb +377 -0
  30. data/lib/steep/node_helper.rb +2 -2
  31. data/lib/steep/project/dsl.rb +26 -5
  32. data/lib/steep/project/group.rb +8 -2
  33. data/lib/steep/project/target.rb +16 -2
  34. data/lib/steep/project.rb +21 -2
  35. data/lib/steep/server/base_worker.rb +2 -2
  36. data/lib/steep/server/change_buffer.rb +2 -1
  37. data/lib/steep/server/custom_methods.rb +12 -0
  38. data/lib/steep/server/inline_source_change_detector.rb +94 -0
  39. data/lib/steep/server/interaction_worker.rb +51 -74
  40. data/lib/steep/server/lsp_formatter.rb +48 -12
  41. data/lib/steep/server/master.rb +100 -18
  42. data/lib/steep/server/target_group_files.rb +124 -151
  43. data/lib/steep/server/type_check_controller.rb +276 -123
  44. data/lib/steep/server/type_check_worker.rb +104 -3
  45. data/lib/steep/services/completion_provider/rbs.rb +74 -0
  46. data/lib/steep/services/completion_provider/ruby.rb +652 -0
  47. data/lib/steep/services/completion_provider/type_name.rb +243 -0
  48. data/lib/steep/services/completion_provider.rb +39 -662
  49. data/lib/steep/services/content_change.rb +14 -1
  50. data/lib/steep/services/file_loader.rb +4 -2
  51. data/lib/steep/services/goto_service.rb +271 -68
  52. data/lib/steep/services/hover_provider/content.rb +67 -0
  53. data/lib/steep/services/hover_provider/rbs.rb +8 -9
  54. data/lib/steep/services/hover_provider/ruby.rb +124 -65
  55. data/lib/steep/services/hover_provider/singleton_methods.rb +4 -0
  56. data/lib/steep/services/signature_help_provider.rb +1 -1
  57. data/lib/steep/services/signature_service.rb +129 -54
  58. data/lib/steep/services/type_check_service.rb +72 -27
  59. data/lib/steep/signature/validator.rb +30 -18
  60. data/lib/steep/source/ignore_ranges.rb +14 -4
  61. data/lib/steep/source.rb +21 -7
  62. data/lib/steep/tagged_logging.rb +39 -0
  63. data/lib/steep/type_construction.rb +111 -24
  64. data/lib/steep/type_inference/block_params.rb +7 -7
  65. data/lib/steep/type_inference/context.rb +4 -2
  66. data/lib/steep/type_inference/logic_type_interpreter.rb +24 -3
  67. data/lib/steep/type_inference/method_call.rb +4 -0
  68. data/lib/steep/type_inference/type_env.rb +1 -1
  69. data/lib/steep/typing.rb +3 -5
  70. data/lib/steep/version.rb +1 -1
  71. data/lib/steep.rb +42 -32
  72. data/manual/ruby-diagnostics.md +67 -0
  73. data/sample/Steepfile +1 -0
  74. data/sample/lib/conference.rb +1 -0
  75. data/sample/lib/deprecated.rb +6 -0
  76. data/sample/lib/inline.rb +43 -0
  77. data/sample/sig/generics.rbs +3 -0
  78. data/steep.gemspec +4 -5
  79. metadata +27 -26
  80. data/lib/steep/services/type_name_completion.rb +0 -236
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b79359121b2e5d63dcd89f96cb6e3a8851880701c965a23ecd29edafd047c5c
4
- data.tar.gz: 17437149e2093895ba8826563aac4529b5efb8e41ae7752bba3df59fb2bffe93
3
+ metadata.gz: 9985b9a834986497b037bbe836f6646aad30fcc1dfa33cf187a3f6aea572d5c6
4
+ data.tar.gz: a3ef68064767f01a511e48b02598f4dffa6c403554898b59a76762a732aaa448
5
5
  SHA512:
6
- metadata.gz: 561a0bb7a9fa92840562f2bd1c30a9530e5bfcfdb5f20a42602c956876eb87486bf1f25938bbba9b081f3a2a7fca32dc85831b7f2912c0c9c4f4ae65fdb83075
7
- data.tar.gz: 52bb1321df0464bf4bbe18416c7b6476da00338a2cee6aa2994a0d352102027275f5fbf4bc4a29e8319b97ae8b888227cd161a0606f06c4837d14c504f4b6b48
6
+ metadata.gz: '018023551867526507d0b4a490a871c7b06e7bce17aedc87a1e6622d21fc5de212530fd34b94b4fc81fe45e618312433c5a4426969a27bd2144a9a84ee40c874'
7
+ data.tar.gz: 5d5c55850108f163260d34f0745e684efa15c922d22a9b417ac41272757c78b579656229ecf191d8e14e33b39cae015cc8fc876d8f4ccdd1fba99045e467a725
data/CHANGELOG.md CHANGED
@@ -1,6 +1,89 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 3.10.0 (2025-03-18)
3
+ ## 2.0.0 (2026-04-14)
4
+
5
+ ### Summary
6
+
7
+ Steep 2.0 introduces three major new features.
8
+
9
+ * **Inline RBS Declaration (Experimental)**: Files configured with `check(inline: true)` can now have RBS type declarations written directly in Ruby code. Supports method types, `attr_*`, instance variables, constants, mixins, inheritance, and more, with editor integration for completion, hover, and go-to-definition.
10
+ * **`steep server` command**: A daemon server that persists the RBS environment. By connecting to the daemon during `steep check`, it skips RBS environment setup and speeds up type checking.
11
+ * **`steep query` command**: Query type information from the daemon server. `steep query hover` retrieves hover information and `steep query definition` retrieves definition locations, making type information accessible outside of editors.
12
+
13
+ In addition, this release includes many improvements such as type narrowing for `block_given?`, type checking arbitrary expressions with the `steep check` with `-e` option, and Prism parser introduction for Ruby 3.4+.
14
+
15
+ ### Type checker core
16
+
17
+ * Handle RBS library syntax error
18
+ ([#2211](https://github.com/soutaro/steep/pull/2211))
19
+ * Fix literal type hints to unwrap nil ([#2205](https://github.com/soutaro/steep/pull/2205))
20
+ * Fix array literal type inference with union tuple hint ([#2096](https://github.com/soutaro/steep/pull/2096))
21
+ * Fix union narrowing in the else branch ([#2101](https://github.com/soutaro/steep/pull/2101))
22
+ * feat: type narrowing for block_given? ([#2186](https://github.com/soutaro/steep/pull/2186))
23
+ * Support @type var annotations in ensure blocks to suppress type errors ([#2194](https://github.com/soutaro/steep/pull/2194))
24
+ * Fix ancestor error diagnostics reporting in library RBS files ([#2198](https://github.com/soutaro/steep/pull/2198))
25
+ * Allow yield in methods with untyped parameters ([#2193](https://github.com/soutaro/steep/pull/2193))
26
+ * Prepare for Ruby 3.4+ syntax support by introducing Prism parser ([#1845](https://github.com/soutaro/steep/pull/1845))
27
+ * Trigger full type checking when type signature of inline RBS declaration is changed ([#1829](https://github.com/soutaro/steep/pull/1829))
28
+ * Support inline class/module alias declaration ([#1819](https://github.com/soutaro/steep/pull/1819))
29
+ * Fix `Locator::Inline` ([#1815](https://github.com/soutaro/steep/pull/1815))
30
+ * Support inline constant declaration ([#1814](https://github.com/soutaro/steep/pull/1814))
31
+ * Support instance variable declaration ([#1812](https://github.com/soutaro/steep/pull/1812))
32
+ * Support inheritance ([#1809](https://github.com/soutaro/steep/pull/1809))
33
+ * `attr_***` Inline RBS type declaration ([#1800](https://github.com/soutaro/steep/pull/1800))
34
+ * Implement inline mixin ([#1788](https://github.com/soutaro/steep/pull/1788))
35
+ * Provide workspace symbols feature for inline declarations ([#1741](https://github.com/soutaro/steep/pull/1741))
36
+ * Fix splat/kwsplat param typing without name ([#1731](https://github.com/soutaro/steep/pull/1731))
37
+ * Fix empty comment error ([#1730](https://github.com/soutaro/steep/pull/1730))
38
+ * Type check service supports inline type declarations ([#1728](https://github.com/soutaro/steep/pull/1728))
39
+ * Fix redundant ignore comment ([#1722](https://github.com/soutaro/steep/pull/1722))
40
+ * Add `RedundantIgnoreComment` diagnostic ([#1670](https://github.com/soutaro/steep/pull/1670))
41
+ * Update project and `Steepfile` DSL to support inline RBS declaration ([#1602](https://github.com/soutaro/steep/pull/1602))
42
+ * Setup inline rbs integration ([#1585](https://github.com/soutaro/steep/pull/1585))
43
+
44
+ ### Commandline tool
45
+
46
+ * Add `steep query definition NAME` command ([#2208](https://github.com/soutaro/steep/pull/2208))
47
+ * Add `steep query hover` command for querying type info from daemon ([#2206](https://github.com/soutaro/steep/pull/2206))
48
+
49
+ * Handle special characters in path when globbing ([#2203](https://github.com/soutaro/steep/pull/2203))
50
+ * Add daemon server for persistent RBS environment ([#2080](https://github.com/soutaro/steep/pull/2080))
51
+ * Fix `steep check` with inline source paths ([#2182](https://github.com/soutaro/steep/pull/2182))
52
+ * Don't use `logger.fatal` for non-fatal info ([#2158](https://github.com/soutaro/steep/pull/2158))
53
+ * Add -e flag to steep check for type checking arbitrary expressions ([#2102](https://github.com/soutaro/steep/pull/2102))
54
+
55
+ ### Language server
56
+
57
+ * Fix goto-definition in inline source files ([#2192](https://github.com/soutaro/steep/pull/2192))
58
+ * Support completion and signature help for inline type annotations ([#2191](https://github.com/soutaro/steep/pull/2191))
59
+ * Implement completion for type names in inline RBS comments ([#1777](https://github.com/soutaro/steep/pull/1777))
60
+ * Small bug fixes for goto inline definition ([#1775](https://github.com/soutaro/steep/pull/1775))
61
+ * Goto definition into inline declaration ([#1774](https://github.com/soutaro/steep/pull/1774))
62
+ * Implement goto definition from inline RBS types ([#1773](https://github.com/soutaro/steep/pull/1773))
63
+ * Implement hover for Inline RBS types ([#1771](https://github.com/soutaro/steep/pull/1771))
64
+ * Refactor hover content classes ([#1742](https://github.com/soutaro/steep/pull/1742))
65
+ * Call `Process.warmup` before refork ([#1665](https://github.com/soutaro/steep/pull/1665))
66
+
67
+ ### Miscellaneous
68
+
69
+ * Add RBS for test method ([#2204](https://github.com/soutaro/steep/pull/2204))
70
+ * Add missing RBS definition for test_ensure_annotation ([#2202](https://github.com/soutaro/steep/pull/2202))
71
+ * Add RBS signature generation and validation workflow ([#2200](https://github.com/soutaro/steep/pull/2200))
72
+ * Fix rbs collection setup ([#2199](https://github.com/soutaro/steep/pull/2199))
73
+ * Skip fork tests (2) ([#2196](https://github.com/soutaro/steep/pull/2196))
74
+ * Fix test failure on Windows ([#2195](https://github.com/soutaro/steep/pull/2195))
75
+ * Fix type checking ([#2181](https://github.com/soutaro/steep/pull/2181))
76
+ * Remove activesupport dependency ([#2172](https://github.com/soutaro/steep/pull/2172))
77
+ * bundle rbs-4.0.0 ([#2114](https://github.com/soutaro/steep/pull/2114))
78
+ * Fix type errors ([#2170](https://github.com/soutaro/steep/pull/2170))
79
+ * Remove unused `mutex_m` dependency ([#2106](https://github.com/soutaro/steep/pull/2106))
80
+ * Use `rbs` gem from git repository ([#2068](https://github.com/soutaro/steep/pull/2068))
81
+ * Fix typos ([#1572](https://github.com/soutaro/steep/pull/1572))
82
+ * Let claude-code fix type errors ([#1709](https://github.com/soutaro/steep/pull/1709))
83
+ * Drop Ruby 3.1 ([#1721](https://github.com/soutaro/steep/pull/1721))
84
+
85
+
86
+ ## 1.10.0 (2025-03-18)
4
87
 
5
88
  Nothing changed since `1.10.0.pre.3`.
6
89
 
data/CLAUDE.md ADDED
@@ -0,0 +1,114 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ Steep is a gradual type checker for Ruby that requires explicit type declarations using RBS (Ruby Signature) files. It performs static type checking without type inference and integrates with editors via Language Server Protocol.
8
+
9
+ ## Common Development Commands
10
+
11
+ ### Running Tests
12
+ ```bash
13
+ # Run all unit tests
14
+ rake test
15
+
16
+ # Run smoke tests (integration tests with expected diagnostics)
17
+ rake test:output
18
+
19
+ # Run a specific test file
20
+ ruby -Itest test/type_check_test.rb
21
+
22
+ # Run current smoke test in a directory
23
+ cd smoke/alias && rake test:output:current
24
+ ```
25
+
26
+ ### Type Checking
27
+ ```bash
28
+ # Type check the Steep codebase itself
29
+ bin/steep check
30
+
31
+ # Type check with specific severity
32
+ bin/steep check --severity=error
33
+
34
+ # Watch mode for continuous type checking
35
+ bin/steep watch
36
+
37
+ # Start language server
38
+ bin/steep langserver
39
+ ```
40
+
41
+ ### Building and Development
42
+ ```bash
43
+ # Initial setup
44
+ bin/setup
45
+
46
+ # Generate RBS signatures from test files using rbs-inline
47
+ rake rbs:generate
48
+
49
+ # Watch and regenerate RBS signatures
50
+ rake rbs:watch
51
+
52
+ # Install gem locally
53
+ bundle exec rake install
54
+
55
+ # Build gem
56
+ bundle exec rake build
57
+ ```
58
+
59
+ ## Architecture Overview
60
+
61
+ ### Core Type Checking Flow
62
+ 1. **Parser Phase**: Ruby code is parsed into AST using the parser gem
63
+ 2. **Type Construction**: `TypeConstruction` class builds typed AST by:
64
+ - Reading RBS signatures from sig/ directories
65
+ - Processing annotations (@type, @dynamic, etc.)
66
+ - Building type environments
67
+ 3. **Subtyping Check**: `Subtyping::Check` validates type relationships
68
+ 4. **Diagnostics**: Type errors are collected and formatted
69
+
70
+ ### Key Components
71
+
72
+ **Type System Core** (`lib/steep/`):
73
+ - `type_construction.rb`: Main type checking logic that traverses AST
74
+ - `type_inference/`: Components for inferring types in specific contexts
75
+ - `subtyping/`: Subtyping relationship validation
76
+ - `interface/`: Type interface definitions and method resolution
77
+
78
+ **Language Server** (`lib/steep/server/`):
79
+ - `master.rb`: Coordinates worker processes
80
+ - `type_check_worker.rb`: Performs type checking in background
81
+ - `interaction_worker.rb`: Handles completion, hover, goto definition
82
+
83
+ **Services** (`lib/steep/services/`):
84
+ - `type_check_service.rb`: Manages incremental type checking
85
+ - `signature_service.rb`: Manages RBS signatures and dependencies
86
+ - `completion_provider.rb`: Provides code completion
87
+
88
+ ### Testing Strategy
89
+
90
+ 1. **Unit Tests**: Traditional tests in `test/` directory
91
+ 2. **Smoke Tests**: Integration tests in `smoke/` with:
92
+ - Each test case in its own directory
93
+ - `test_expectations.yml` defines expected diagnostics
94
+ - Tests cover Ruby features and edge cases
95
+
96
+ ### Configuration
97
+
98
+ **Steepfile**: Defines type checking targets
99
+ - `check`: Directories to type check
100
+ - `signature`: RBS signature directories
101
+ - `library`: Standard library dependencies
102
+ - `collection_config`: External RBS definitions
103
+ - Multiple targets supported (app, test, bin)
104
+
105
+ **RBS Collection**: Manages external type definitions via `rbs_collection.steep.yaml`
106
+
107
+ ## Key Implementation Details
108
+
109
+ - Self-hosted: Steep type-checks its own codebase
110
+ - Uses RBS 4.0.0.dev (development version)
111
+ - Requires Ruby 3.1.0+
112
+ - Diagnostic severity levels: error, warning, information, hint
113
+ - Supports gradual typing with @dynamic annotations
114
+ - Implements LSP for IDE integration
data/README.md CHANGED
@@ -203,7 +203,7 @@ Generally, these are by our design.
203
203
 
204
204
  ## Docs
205
205
 
206
- There are some documents in the `manul` and `guide` directories.
206
+ There are some documents in the `manual` and `guides` directories.
207
207
 
208
208
  * [Guides](guides)
209
209
  * [Manual](manual)
@@ -247,7 +247,7 @@ Use `bundle exec rake -T` to see all available tasks.
247
247
 
248
248
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
249
249
 
250
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
250
+ To install this gem onto your local machine, run `bundle exec rake install`. Releases are cut by the `Release gem` workflow rather than from a working copy -- see [doc/release.md](doc/release.md).
251
251
 
252
252
  ## Contributing
253
253