typeprof 0.21.11 → 0.30.0

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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -31
  3. data/bin/typeprof +5 -0
  4. data/doc/doc.ja.md +134 -0
  5. data/doc/doc.md +136 -0
  6. data/lib/typeprof/cli/cli.rb +180 -0
  7. data/lib/typeprof/cli.rb +2 -133
  8. data/lib/typeprof/code_range.rb +112 -0
  9. data/lib/typeprof/core/ast/base.rb +263 -0
  10. data/lib/typeprof/core/ast/call.rb +251 -0
  11. data/lib/typeprof/core/ast/const.rb +126 -0
  12. data/lib/typeprof/core/ast/control.rb +432 -0
  13. data/lib/typeprof/core/ast/meta.rb +150 -0
  14. data/lib/typeprof/core/ast/method.rb +335 -0
  15. data/lib/typeprof/core/ast/misc.rb +263 -0
  16. data/lib/typeprof/core/ast/module.rb +123 -0
  17. data/lib/typeprof/core/ast/pattern.rb +140 -0
  18. data/lib/typeprof/core/ast/sig_decl.rb +471 -0
  19. data/lib/typeprof/core/ast/sig_type.rb +663 -0
  20. data/lib/typeprof/core/ast/value.rb +319 -0
  21. data/lib/typeprof/core/ast/variable.rb +315 -0
  22. data/lib/typeprof/core/ast.rb +472 -0
  23. data/lib/typeprof/core/builtin.rb +146 -0
  24. data/lib/typeprof/core/env/method.rb +137 -0
  25. data/lib/typeprof/core/env/method_entity.rb +55 -0
  26. data/lib/typeprof/core/env/module_entity.rb +408 -0
  27. data/lib/typeprof/core/env/static_read.rb +155 -0
  28. data/lib/typeprof/core/env/type_alias_entity.rb +27 -0
  29. data/lib/typeprof/core/env/value_entity.rb +32 -0
  30. data/lib/typeprof/core/env.rb +360 -0
  31. data/lib/typeprof/core/graph/box.rb +991 -0
  32. data/lib/typeprof/core/graph/change_set.rb +224 -0
  33. data/lib/typeprof/core/graph/filter.rb +155 -0
  34. data/lib/typeprof/core/graph/vertex.rb +222 -0
  35. data/lib/typeprof/core/graph.rb +3 -0
  36. data/lib/typeprof/core/service.rb +522 -0
  37. data/lib/typeprof/core/type.rb +348 -0
  38. data/lib/typeprof/core/util.rb +81 -0
  39. data/lib/typeprof/core.rb +32 -0
  40. data/lib/typeprof/diagnostic.rb +35 -0
  41. data/lib/typeprof/lsp/messages.rb +430 -0
  42. data/lib/typeprof/lsp/server.rb +177 -0
  43. data/lib/typeprof/lsp/text.rb +69 -0
  44. data/lib/typeprof/lsp/util.rb +61 -0
  45. data/lib/typeprof/lsp.rb +4 -907
  46. data/lib/typeprof/version.rb +1 -1
  47. data/lib/typeprof.rb +4 -18
  48. data/typeprof.gemspec +5 -7
  49. metadata +48 -35
  50. data/.github/dependabot.yml +0 -6
  51. data/.github/workflows/main.yml +0 -39
  52. data/.gitignore +0 -9
  53. data/Gemfile +0 -17
  54. data/Gemfile.lock +0 -41
  55. data/Rakefile +0 -10
  56. data/exe/typeprof +0 -10
  57. data/lib/typeprof/analyzer.rb +0 -2598
  58. data/lib/typeprof/arguments.rb +0 -414
  59. data/lib/typeprof/block.rb +0 -176
  60. data/lib/typeprof/builtin.rb +0 -893
  61. data/lib/typeprof/code-range.rb +0 -177
  62. data/lib/typeprof/config.rb +0 -158
  63. data/lib/typeprof/container-type.rb +0 -912
  64. data/lib/typeprof/export.rb +0 -589
  65. data/lib/typeprof/import.rb +0 -852
  66. data/lib/typeprof/insns-def.rb +0 -65
  67. data/lib/typeprof/iseq.rb +0 -864
  68. data/lib/typeprof/method.rb +0 -355
  69. data/lib/typeprof/type.rb +0 -1140
  70. data/lib/typeprof/utils.rb +0 -212
  71. data/tools/coverage.rb +0 -14
  72. data/tools/setup-insns-def.rb +0 -30
  73. data/typeprof-lsp +0 -3
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.21.11"
2
+ VERSION = "0.30.0"
3
3
  end
data/lib/typeprof.rb CHANGED
@@ -1,20 +1,6 @@
1
- module TypeProf end
2
-
3
1
  require_relative "typeprof/version"
4
- require_relative "typeprof/config"
5
- require_relative "typeprof/insns-def"
6
- require_relative "typeprof/utils"
7
- require_relative "typeprof/type"
8
- require_relative "typeprof/container-type"
9
- require_relative "typeprof/method"
10
- require_relative "typeprof/block"
11
- require_relative "typeprof/iseq"
12
- require_relative "typeprof/arguments"
13
- require_relative "typeprof/analyzer"
14
- require_relative "typeprof/import"
15
- require_relative "typeprof/export"
16
- require_relative "typeprof/builtin"
2
+ require_relative "typeprof/code_range"
3
+ require_relative "typeprof/diagnostic"
4
+ require_relative "typeprof/core"
5
+ require_relative "typeprof/lsp"
17
6
  require_relative "typeprof/cli"
18
- require_relative "typeprof/code-range"
19
-
20
- require_relative "typeprof/lsp" if RUBY_VERSION >= "3" and RUBY_ENGINE != "truffleruby"
data/typeprof.gemspec CHANGED
@@ -11,12 +11,10 @@ Gem::Specification.new do |spec|
11
11
  TypeProf performs a type analysis of non-annotated Ruby code.
12
12
 
13
13
  It abstractly executes input Ruby code in a level of types instead of values, gathers what types are passed to and returned by methods, and prints the analysis result in RBS format, a standard type description format for Ruby 3.0.
14
-
15
- This tool is planned to be bundled with Ruby 3.0.
16
14
  EOD
17
15
  spec.homepage = "https://github.com/ruby/typeprof"
18
16
  spec.license = "MIT"
19
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7")
17
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3")
20
18
 
21
19
  spec.metadata["homepage_uri"] = spec.homepage
22
20
  spec.metadata["source_code_uri"] = "https://github.com/ruby/typeprof"
@@ -24,11 +22,11 @@ Gem::Specification.new do |spec|
24
22
  # Specify which files should be added to the gem when it is released.
25
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
24
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(doc|test|spec|features|smoke|testbed|vscode)/}) }
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(.devcontainer|.github|scenario|sig|test|tool)/}) } - [ ".gitignore", "Gemfile", "Gemfile.lock", "Rakefile", "typeprof.conf.json"]
28
26
  end
29
- spec.bindir = "exe"
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.bindir = "bin"
28
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
31
29
  spec.require_paths = ["lib"]
32
30
 
33
- spec.add_runtime_dependency "rbs", ">= 1.8.1"
31
+ spec.add_runtime_dependency "rbs", ">= 3.6.0"
34
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typeprof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.11
4
+ version: 0.30.0
5
5
  platform: ruby
6
+ original_platform: ''
6
7
  authors:
7
8
  - Yusuke Endoh
8
- autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-19 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -16,20 +16,18 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.8.1
19
+ version: 3.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.8.1
26
+ version: 3.6.0
27
27
  description: |
28
28
  TypeProf performs a type analysis of non-annotated Ruby code.
29
29
 
30
30
  It abstractly executes input Ruby code in a level of types instead of values, gathers what types are passed to and returned by methods, and prints the analysis result in RBS format, a standard type description format for Ruby 3.0.
31
-
32
- This tool is planned to be bundled with Ruby 3.0.
33
31
  email:
34
32
  - mame@ruby-lang.org
35
33
  executables:
@@ -37,36 +35,53 @@ executables:
37
35
  extensions: []
38
36
  extra_rdoc_files: []
39
37
  files:
40
- - ".github/dependabot.yml"
41
- - ".github/workflows/main.yml"
42
- - ".gitignore"
43
- - Gemfile
44
- - Gemfile.lock
45
38
  - LICENSE
46
39
  - README.md
47
- - Rakefile
48
- - exe/typeprof
40
+ - bin/typeprof
41
+ - doc/doc.ja.md
42
+ - doc/doc.md
49
43
  - lib/typeprof.rb
50
- - lib/typeprof/analyzer.rb
51
- - lib/typeprof/arguments.rb
52
- - lib/typeprof/block.rb
53
- - lib/typeprof/builtin.rb
54
44
  - lib/typeprof/cli.rb
55
- - lib/typeprof/code-range.rb
56
- - lib/typeprof/config.rb
57
- - lib/typeprof/container-type.rb
58
- - lib/typeprof/export.rb
59
- - lib/typeprof/import.rb
60
- - lib/typeprof/insns-def.rb
61
- - lib/typeprof/iseq.rb
45
+ - lib/typeprof/cli/cli.rb
46
+ - lib/typeprof/code_range.rb
47
+ - lib/typeprof/core.rb
48
+ - lib/typeprof/core/ast.rb
49
+ - lib/typeprof/core/ast/base.rb
50
+ - lib/typeprof/core/ast/call.rb
51
+ - lib/typeprof/core/ast/const.rb
52
+ - lib/typeprof/core/ast/control.rb
53
+ - lib/typeprof/core/ast/meta.rb
54
+ - lib/typeprof/core/ast/method.rb
55
+ - lib/typeprof/core/ast/misc.rb
56
+ - lib/typeprof/core/ast/module.rb
57
+ - lib/typeprof/core/ast/pattern.rb
58
+ - lib/typeprof/core/ast/sig_decl.rb
59
+ - lib/typeprof/core/ast/sig_type.rb
60
+ - lib/typeprof/core/ast/value.rb
61
+ - lib/typeprof/core/ast/variable.rb
62
+ - lib/typeprof/core/builtin.rb
63
+ - lib/typeprof/core/env.rb
64
+ - lib/typeprof/core/env/method.rb
65
+ - lib/typeprof/core/env/method_entity.rb
66
+ - lib/typeprof/core/env/module_entity.rb
67
+ - lib/typeprof/core/env/static_read.rb
68
+ - lib/typeprof/core/env/type_alias_entity.rb
69
+ - lib/typeprof/core/env/value_entity.rb
70
+ - lib/typeprof/core/graph.rb
71
+ - lib/typeprof/core/graph/box.rb
72
+ - lib/typeprof/core/graph/change_set.rb
73
+ - lib/typeprof/core/graph/filter.rb
74
+ - lib/typeprof/core/graph/vertex.rb
75
+ - lib/typeprof/core/service.rb
76
+ - lib/typeprof/core/type.rb
77
+ - lib/typeprof/core/util.rb
78
+ - lib/typeprof/diagnostic.rb
62
79
  - lib/typeprof/lsp.rb
63
- - lib/typeprof/method.rb
64
- - lib/typeprof/type.rb
65
- - lib/typeprof/utils.rb
80
+ - lib/typeprof/lsp/messages.rb
81
+ - lib/typeprof/lsp/server.rb
82
+ - lib/typeprof/lsp/text.rb
83
+ - lib/typeprof/lsp/util.rb
66
84
  - lib/typeprof/version.rb
67
- - tools/coverage.rb
68
- - tools/setup-insns-def.rb
69
- - typeprof-lsp
70
85
  - typeprof.gemspec
71
86
  homepage: https://github.com/ruby/typeprof
72
87
  licenses:
@@ -74,7 +89,6 @@ licenses:
74
89
  metadata:
75
90
  homepage_uri: https://github.com/ruby/typeprof
76
91
  source_code_uri: https://github.com/ruby/typeprof
77
- post_install_message:
78
92
  rdoc_options: []
79
93
  require_paths:
80
94
  - lib
@@ -82,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
96
  requirements:
83
97
  - - ">="
84
98
  - !ruby/object:Gem::Version
85
- version: '2.7'
99
+ version: '3.3'
86
100
  required_rubygems_version: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - ">="
@@ -90,7 +104,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
104
  version: '0'
91
105
  requirements: []
92
106
  rubygems_version: 3.6.0.dev
93
- signing_key:
94
107
  specification_version: 4
95
108
  summary: TypeProf is a type analysis tool for Ruby code based on abstract interpretation
96
109
  test_files: []
@@ -1,6 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: 'github-actions'
4
- directory: '/'
5
- schedule:
6
- interval: 'weekly'
@@ -1,39 +0,0 @@
1
- name: Ruby
2
-
3
- on:
4
- push:
5
- pull_request:
6
- workflow_dispatch:
7
- schedule:
8
- # # This job runs at 00:00 on Friday.
9
- - cron: '0 15 * * 5'
10
-
11
- jobs:
12
- ruby-versions:
13
- uses: ruby/actions/.github/workflows/ruby_versions.yml@master
14
- with:
15
- engine: cruby-truffleruby
16
- min_version: 3.0
17
-
18
- build:
19
- needs: ruby-versions
20
- name: build (${{ matrix.ruby }})
21
- strategy:
22
- fail-fast: false
23
- matrix:
24
- ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
25
- runs-on: ubuntu-latest
26
- steps:
27
- - uses: actions/checkout@v4
28
- - name: Set up Ruby
29
- uses: ruby/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
- - name: Bundle install
33
- run: |
34
- bundle install
35
- - run: bundle exec typeprof --version
36
- - name: Run the test suite
37
- run: |
38
- bundle exec rake TESTOPT=-v
39
- if: ${{ !startsWith(matrix.ruby, 'truffle') }}
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- coverage.dump
2
- coverage.info
3
- coverage/
4
- stackprof*.dump
5
- testbed/diff-lcs
6
- pkg/
7
- *.log
8
- .*.sw*
9
- *.dump
data/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- if ENV["RBS_VERSION"]
4
- gem "rbs", github: "ruby/rbs", ref: ENV["RBS_VERSION"]
5
- else
6
- # Specify your gem's dependencies in typeprof.gemspec
7
- gemspec
8
- end
9
-
10
- group :development do
11
- gem "rake"
12
- gem "stackprof", platforms: :mri
13
- gem "test-unit"
14
- gem "simplecov"
15
- gem "simplecov-html"
16
- gem "coverage-helpers"
17
- end
data/Gemfile.lock DELETED
@@ -1,41 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- typeprof (0.21.11)
5
- rbs (>= 1.8.1)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- abbrev (0.1.2)
11
- coverage-helpers (1.0.0)
12
- docile (1.4.0)
13
- power_assert (2.0.1)
14
- rake (13.0.1)
15
- rbs (3.4.4)
16
- abbrev
17
- simplecov (0.21.2)
18
- docile (~> 1.1)
19
- simplecov-html (~> 0.11)
20
- simplecov_json_formatter (~> 0.1)
21
- simplecov-html (0.12.3)
22
- simplecov_json_formatter (0.1.4)
23
- stackprof (0.2.19)
24
- test-unit (3.5.3)
25
- power_assert
26
-
27
- PLATFORMS
28
- ruby
29
- x86_64-linux
30
-
31
- DEPENDENCIES
32
- coverage-helpers
33
- rake
34
- simplecov
35
- simplecov-html
36
- stackprof
37
- test-unit
38
- typeprof!
39
-
40
- BUNDLED WITH
41
- 2.3.11
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test
data/exe/typeprof DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative "../lib/typeprof"
4
-
5
- config = TypeProf::CLI.parse(ARGV)
6
- if config.options[:lsp]
7
- TypeProf.start_lsp_server(config)
8
- else
9
- TypeProf.analyze(config)
10
- end