Skip to content
Merged
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
4 changes: 2 additions & 2 deletions lib/typeprof/core/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def dump_declarations(path)
when AST::ModuleNode
if node.static_cpath
if event == :enter
out << " " * stack.size + "module #{ node.static_cpath.join("::") }"
out << " " * stack.size + "module #{ format_declared_const_path(node.static_cpath, stack) }"
if stack == [:toplevel]
out << "end"
stack.pop
Expand All @@ -453,7 +453,7 @@ def dump_declarations(path)
next if stack.any? { node.is_a?(AST::SingletonClassNode) && (_1.is_a?(AST::ClassNode) || _1.is_a?(AST::ModuleNode)) && node.static_cpath == _1.static_cpath }

if event == :enter
s = "class #{ node.static_cpath.join("::") }"
s = "class #{ format_declared_const_path(node.static_cpath, stack) }"
mod = @genv.resolve_cpath(node.static_cpath)
superclass = mod.superclass
if superclass == nil
Expand Down
2 changes: 1 addition & 1 deletion scenario/class/basic2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def foo(n)

## assert
class C
class C::D
class D
def foo: (String) -> singleton(C)
end
end
4 changes: 2 additions & 2 deletions scenario/class/circular_mutual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class Foo < Baz
class Foo
end
class Bar
class Bar::Baz < Bar::Foo
class Baz < Bar::Foo
end
class Bar::Foo # failed to identify its superclass
class Foo # failed to identify its superclass
end
end

Expand Down
2 changes: 1 addition & 1 deletion scenario/class/include-hack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Baz

## assert
module Foo
module Foo::Bar
module Bar
end
end
module Baz
Expand Down
2 changes: 1 addition & 1 deletion scenario/class/self-in-cbase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class self::Bar::Baz

## assert
class Foo
class Foo::Bar::Baz
class Bar::Baz
end
end

Expand Down
4 changes: 2 additions & 2 deletions scenario/class/unknown-cbase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def check = foo

## assert: test.rb
class Foo::Bar
class Foo::Bar::C
class C
def foo: -> Integer
end
end
Expand All @@ -28,7 +28,7 @@ module Foo

## assert: test.rb
class Foo::Bar
class Foo::Bar::C
class C
def foo: -> Integer
end
end
Expand Down
6 changes: 3 additions & 3 deletions scenario/const/superclass1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class E < C
class C
end
class D
class D::E < C
class E < C
end
end

Expand All @@ -25,7 +25,7 @@ class C # Defining D::C changes the superclass of D::E from ::C to D::C
class C
end
class D
class D::E < D::C
class E < D::C
end
end

Expand All @@ -38,7 +38,7 @@ class D
class C
end
class D
class D::E < C
class E < C
end
end

12 changes: 6 additions & 6 deletions scenario/const/superclass2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class C < A::B

## assert: test0.rb
class A
class A::B
class B
end
end
class X
class X::C < A::B
class C < A::B
end
end

Expand All @@ -28,11 +28,11 @@ class A

## assert: test0.rb
class A
class A::B
class B
end
end
class X
class X::C # failed to identify its superclass
class C # failed to identify its superclass
end
end

Expand All @@ -47,10 +47,10 @@ class B

## assert: test0.rb
class A
class A::B
class B
end
end
class X
class X::C < X::A::B
class C < X::A::B
end
end
12 changes: 6 additions & 6 deletions scenario/const/superclass3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class D < B

## assert: test0.rb
class A
class A::B
class B
end
end
class X
class X::C < A
class X::C::D < A::B
class C < A
class D < A::B
end
end
end
Expand All @@ -33,12 +33,12 @@ class B

## assert: test0.rb
class A
class A::B
class B
end
end
class X
class X::C < X::A
class X::C::D < X::A::B
class C < X::A
class D < X::A::B
end
end
end
2 changes: 1 addition & 1 deletion scenario/flow/is_a.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def foo(n)

## assert
class C
class C::D
class D
end
def foo: (C::D | Integer) -> (C::D | String)
end
2 changes: 1 addition & 1 deletion scenario/incremental/add-included-module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def initialize(n)

## assert: test1.rb
module M
class M::A
class A
def initialize: (Integer) -> void
end
end
4 changes: 2 additions & 2 deletions scenario/incremental/basic4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def foo(n)

## assert
class C
class C::C
class C
end
def foo: (untyped) -> singleton(C::C)
end
Expand All @@ -39,7 +39,7 @@ def foo(n)

## assert
class C
class C::D
class D
end
def foo: (untyped) -> singleton(C)
end
2 changes: 1 addition & 1 deletion scenario/incremental/change-included-module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class C

## assert: test1.rb
class C
module C::M
module M
def foo: (Integer) -> nil
end
end
4 changes: 2 additions & 2 deletions scenario/incremental/change-superclass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class C2
def target: (untyped) -> untyped
end
class X
class X::D < C
class D < C
def foo: -> Integer
end
end
Expand All @@ -42,7 +42,7 @@ class C2
def target: (Integer) -> Integer
end
class X
class X::D < X::C
class D < X::C
def foo: -> Integer
end
end
6 changes: 3 additions & 3 deletions scenario/variable/ivar3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def foo: -> :C
def x: -> (:C | :E)
end
class X
class X::D < C
class D < C
end
end
class E < X::D
Expand All @@ -40,7 +40,7 @@ def foo: -> :C
def x: -> :C
end
class X
class X::D < X::C
class D < X::C
end
end
class E < X::D
Expand All @@ -49,7 +49,7 @@ def foo: -> :E

## assert: test1.rb
class X
class X::C
class C
def foo: -> :XC
def x: -> (:E | :XC)
end
Expand Down