steep 1.6.0.pre.2 → 1.6.0.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/steep/interface/builder.rb +27 -13
- data/lib/steep/type_construction.rb +11 -2
- data/lib/steep/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89c50cdd644b4f90f2b7f5a18c262c181088eda18b116b7604f8ca4b4d17363c
|
4
|
+
data.tar.gz: 6191d664a4a348dfdc43559c40a75ded920b83a2b245d28d10f84c3c72f7d324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833394273e491c154a8fd6ca60c693f1fd28f51d4dcb2f864c4d60abe4645e7dceb4d9914261d8237fb339e0c7f27a7625baedea3cd9ac1680d0d32a98b2867c
|
7
|
+
data.tar.gz: 827261fdcffe5a0d3b32ee5771bbc6577a7a9b71a0aa2f25f3cff5eb1c6a2817e592a56f6c7189d8a028a686b7a1d8e24b313e919427c253f372de3316ed6353
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.6.0.pre.3 (2023-11-01)
|
6
|
+
|
7
|
+
### Type checker core
|
8
|
+
|
9
|
+
* Object methods are moved to Kernel ([#952](https://github.com/soutaro/steep/pull/952))
|
10
|
+
* Check if `rescue` body has `bot` type ([#953](https://github.com/soutaro/steep/pull/953))
|
11
|
+
|
5
12
|
## 1.6.0.pre.2 (2023-10-31)
|
6
13
|
|
7
14
|
### Type checker core
|
data/Gemfile.lock
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module Steep
|
3
2
|
module Interface
|
4
3
|
class Builder
|
@@ -718,22 +717,30 @@ module Steep
|
|
718
717
|
if member.is_a?(RBS::AST::Members::MethodDefinition)
|
719
718
|
case method_name.method_name
|
720
719
|
when :is_a?, :kind_of?, :instance_of?
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
720
|
+
case
|
721
|
+
when RBS::BuiltinNames::Object.name,
|
722
|
+
RBS::BuiltinNames::Kernel.name
|
723
|
+
if member.instance?
|
724
|
+
return method_type.with(
|
725
|
+
type: method_type.type.with(
|
726
|
+
return_type: AST::Types::Logic::ReceiverIsArg.new(location: method_type.type.return_type.location)
|
727
|
+
)
|
725
728
|
)
|
726
|
-
|
729
|
+
end
|
727
730
|
end
|
728
731
|
|
729
732
|
when :nil?
|
730
733
|
case defined_in
|
731
|
-
when RBS::BuiltinNames::Object.name,
|
732
|
-
|
733
|
-
|
734
|
-
|
734
|
+
when RBS::BuiltinNames::Object.name,
|
735
|
+
AST::Builtin::NilClass.module_name,
|
736
|
+
RBS::BuiltinNames::Kernel.name
|
737
|
+
if member.instance?
|
738
|
+
return method_type.with(
|
739
|
+
type: method_type.type.with(
|
740
|
+
return_type: AST::Types::Logic::ReceiverIsNil.new(location: method_type.type.return_type.location)
|
741
|
+
)
|
735
742
|
)
|
736
|
-
|
743
|
+
end
|
737
744
|
end
|
738
745
|
|
739
746
|
when :!
|
@@ -757,8 +764,14 @@ module Steep
|
|
757
764
|
return_type: AST::Types::Logic::ArgIsReceiver.new(location: method_type.type.return_type.location)
|
758
765
|
)
|
759
766
|
)
|
760
|
-
when RBS::BuiltinNames::Object.name,
|
761
|
-
RBS::BuiltinNames::
|
767
|
+
when RBS::BuiltinNames::Object.name,
|
768
|
+
RBS::BuiltinNames::Kernel.name,
|
769
|
+
RBS::BuiltinNames::String.name,
|
770
|
+
RBS::BuiltinNames::Integer.name,
|
771
|
+
RBS::BuiltinNames::Symbol.name,
|
772
|
+
RBS::BuiltinNames::TrueClass.name,
|
773
|
+
RBS::BuiltinNames::FalseClass.name,
|
774
|
+
TypeName("::NilClass")
|
762
775
|
# Value based type-case works on literal types which is available for String, Integer, Symbol, TrueClass, FalseClass, and NilClass
|
763
776
|
return method_type.with(
|
764
777
|
type: method_type.type.with(
|
@@ -783,3 +796,4 @@ module Steep
|
|
783
796
|
end
|
784
797
|
end
|
785
798
|
end
|
799
|
+
|
@@ -2214,6 +2214,10 @@ module Steep
|
|
2214
2214
|
end
|
2215
2215
|
end
|
2216
2216
|
|
2217
|
+
resbody_pairs.select! do |pair|
|
2218
|
+
no_subtyping?(sub_type: pair.type, super_type: AST::Types::Bot.new)
|
2219
|
+
end
|
2220
|
+
|
2217
2221
|
resbody_types = resbody_pairs.map(&:type)
|
2218
2222
|
resbody_envs = resbody_pairs.map {|pair| pair.context.type_env }
|
2219
2223
|
|
@@ -2225,8 +2229,13 @@ module Steep
|
|
2225
2229
|
.update_type_env {|env| env.join(*resbody_envs, env) }
|
2226
2230
|
.add_typing(node, type: union_type(else_type, *resbody_types))
|
2227
2231
|
else
|
2228
|
-
|
2229
|
-
|
2232
|
+
if resbody_types.empty?
|
2233
|
+
constr = body_pair ? body_pair.constr : self
|
2234
|
+
constr.add_typing(node, type: body_pair&.type || AST::Builtin.nil_type)
|
2235
|
+
else
|
2236
|
+
update_type_env {|env| env.join(*resbody_envs, else_constr.context.type_env) }
|
2237
|
+
.add_typing(node, type: union_type(*[body_pair&.type, *resbody_types].compact))
|
2238
|
+
end
|
2230
2239
|
end
|
2231
2240
|
end
|
2232
2241
|
|
data/lib/steep/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.0.pre.
|
4
|
+
version: 1.6.0.pre.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|