-
Notifications
You must be signed in to change notification settings - Fork 4
Audit and broaden snapshot coverage of indexer behavior. #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jasonhawkharris
wants to merge
1
commit into
scip-ruby/master
Choose a base branch
from
jhh/update-snapshots-and-e2e-tests
base: scip-ruby/master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # typed: strict | ||
|
|
||
| # Exercises abstract!, interface!, final!, sealed!, mixes_in_class_methods. | ||
|
|
||
| module Drawable | ||
| extend T::Sig | ||
| extend T::Helpers | ||
| interface! | ||
|
|
||
| sig { abstract.returns(String) } | ||
| def draw; end | ||
| end | ||
|
|
||
| class Shape | ||
| extend T::Sig | ||
| extend T::Helpers | ||
| abstract! | ||
|
|
||
| sig { abstract.returns(Integer) } | ||
| def area; end | ||
| end | ||
|
|
||
| class Square < Shape | ||
| extend T::Sig | ||
| include Drawable | ||
|
|
||
| sig { override.returns(Integer) } | ||
| def area | ||
| 16 | ||
| end | ||
|
|
||
| sig { override.returns(String) } | ||
| def draw | ||
| "square" | ||
| end | ||
| end | ||
|
|
||
| class FinalLeaf | ||
| extend T::Sig | ||
| extend T::Helpers | ||
| final! | ||
|
|
||
| sig(:final) { returns(Integer) } | ||
| def value | ||
| 42 | ||
| end | ||
| end | ||
|
|
||
| module SealedHierarchy | ||
| extend T::Helpers | ||
| sealed! | ||
| end | ||
|
|
||
| module ClassMethodsMixin | ||
| extend T::Sig | ||
|
|
||
| sig { returns(String) } | ||
| def class_helper | ||
| "class!" | ||
| end | ||
| end | ||
|
|
||
| module InstanceMethodsMixin | ||
| extend T::Helpers | ||
| mixes_in_class_methods(ClassMethodsMixin) | ||
| end | ||
|
|
||
| class WithMixedIn | ||
| include InstanceMethodsMixin | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| # typed: strict | ||
|
|
||
| # Exercises abstract!, interface!, final!, sealed!, mixes_in_class_methods. | ||
|
|
||
| module Drawable | ||
| # ^^^^^^^^ definition [..] Drawable# | ||
| extend T::Sig | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| extend T::Helpers | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| interface! | ||
|
|
||
| sig { abstract.returns(String) } | ||
| # ^^^^^^ reference [..] String# | ||
| def draw; end | ||
| # ^^^^ definition [..] Drawable#draw(). | ||
| end | ||
|
|
||
| class Shape | ||
| # ^^^^^ definition [..] Shape# | ||
| extend T::Sig | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| extend T::Helpers | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| abstract! | ||
|
|
||
| sig { abstract.returns(Integer) } | ||
| # ^^^^^^^ reference [..] Integer# | ||
| def area; end | ||
| # ^^^^ definition [..] Shape#area(). | ||
| end | ||
|
|
||
| class Square < Shape | ||
| # ^^^^^^ definition [..] Square# | ||
| # ^^^^^ reference [..] Shape# | ||
| extend T::Sig | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| include Drawable | ||
| # ^^^^^^^ reference [..] Module#include(). | ||
| # ^^^^^^^^ reference [..] Drawable# | ||
| # ^^^^^^^^ reference [..] Drawable# | ||
|
|
||
| sig { override.returns(Integer) } | ||
| # ^^^^^^^ reference [..] Integer# | ||
| def area | ||
| # ^^^^ definition [..] Square#area(). | ||
| 16 | ||
| end | ||
|
|
||
| sig { override.returns(String) } | ||
| # ^^^^^^ reference [..] String# | ||
| def draw | ||
| # ^^^^ definition [..] Square#draw(). | ||
| "square" | ||
| end | ||
| end | ||
|
|
||
| class FinalLeaf | ||
| # ^^^^^^^^^ definition [..] FinalLeaf# | ||
| extend T::Sig | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| extend T::Helpers | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| final! | ||
|
|
||
| sig(:final) { returns(Integer) } | ||
| # ^^^^^^^ reference [..] Integer# | ||
| def value | ||
| # ^^^^^ definition [..] FinalLeaf#value(). | ||
| 42 | ||
| end | ||
| end | ||
|
|
||
| module SealedHierarchy | ||
| # ^^^^^^^^^^^^^^^ definition [..] SealedHierarchy# | ||
| extend T::Helpers | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| sealed! | ||
| end | ||
|
|
||
| module ClassMethodsMixin | ||
| # ^^^^^^^^^^^^^^^^^ definition [..] ClassMethodsMixin# | ||
| extend T::Sig | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
|
|
||
| sig { returns(String) } | ||
| # ^^^^^^ reference [..] String# | ||
| def class_helper | ||
| # ^^^^^^^^^^^^ definition [..] ClassMethodsMixin#class_helper(). | ||
| "class!" | ||
| end | ||
| end | ||
|
|
||
| module InstanceMethodsMixin | ||
| # ^^^^^^^^^^^^^^^^^^^^ definition [..] InstanceMethodsMixin# | ||
| extend T::Helpers | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| mixes_in_class_methods(ClassMethodsMixin) | ||
| # ^^^^^^^^^^^^^^^^^ reference [..] ClassMethodsMixin# | ||
| end | ||
|
|
||
| class WithMixedIn | ||
| # ^^^^^^^^^^^ definition [..] WithMixedIn# | ||
| include InstanceMethodsMixin | ||
| # ^^^^^^^ reference [..] Module#include(). | ||
| # ^^^^^^^^^^^^^^^^^^^^ reference [..] InstanceMethodsMixin# | ||
| # ^^^^^^^^^^^^^^^^^^^^ reference [..] InstanceMethodsMixin# | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # typed: true | ||
|
|
||
| # Exercises the TypeArgument / TypeMember descriptor branches in | ||
| # scip_indexer/SCIPSymbolRef.cc symbolForExpr (Descriptor::TypeParameter, | ||
| # Descriptor::Type). | ||
|
|
||
| class GenericBox | ||
| extend T::Sig | ||
| extend T::Generic | ||
|
|
||
| Elem = type_member | ||
|
|
||
| sig { params(x: Elem).void } | ||
| def initialize(x) | ||
| @x = x | ||
| end | ||
|
|
||
| sig { returns(Elem) } | ||
| def get | ||
| @x | ||
| end | ||
| end | ||
|
|
||
| module MyGenericMixin | ||
| extend T::Generic | ||
|
|
||
| Item = type_member | ||
| end | ||
|
|
||
| class WithTypeTemplate | ||
| extend T::Generic | ||
|
|
||
| Tag = type_template | ||
| end | ||
|
|
||
| class WithTypeParameters | ||
| extend T::Sig | ||
|
|
||
| sig { type_parameters(:U).params(x: T.type_parameter(:U)).returns(T.type_parameter(:U)) } | ||
| def identity(x) | ||
| x | ||
| end | ||
| end | ||
|
|
||
| def use_generics | ||
| box = GenericBox.new(1) | ||
| _ = box.get | ||
| _ = WithTypeParameters.new.identity(42) | ||
| return | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # typed: true | ||
|
|
||
| # Exercises the TypeArgument / TypeMember descriptor branches in | ||
| # scip_indexer/SCIPSymbolRef.cc symbolForExpr (Descriptor::TypeParameter, | ||
| # Descriptor::Type). | ||
|
|
||
| class GenericBox | ||
| # ^^^^^^^^^^ definition [..] GenericBox# | ||
| extend T::Sig | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
| extend T::Generic | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
|
|
||
| Elem = type_member | ||
| # ^^^^ definition local 3$119448696 | ||
|
|
||
| sig { params(x: Elem).void } | ||
| # ^^^^ definition local 2$3465713227 | ||
| def initialize(x) | ||
| # ^^^^^^^^^^ definition [..] GenericBox#initialize(). | ||
| # ^ definition local 1$3465713227 | ||
| @x = x | ||
| # ^^ definition [..] GenericBox#`@x`. | ||
| # ^^^^^^ reference [..] GenericBox#`@x`. | ||
| # ^ reference local 1$3465713227 | ||
| end | ||
|
|
||
| sig { returns(Elem) } | ||
| def get | ||
| # ^^^ definition [..] GenericBox#get(). | ||
| @x | ||
| # ^^ reference [..] GenericBox#`@x`. | ||
| end | ||
| end | ||
|
|
||
| module MyGenericMixin | ||
| # ^^^^^^^^^^^^^^ definition [..] MyGenericMixin# | ||
| extend T::Generic | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
|
|
||
| Item = type_member | ||
| # ^^^^ definition local 2$119448696 | ||
| end | ||
|
|
||
| class WithTypeTemplate | ||
| # ^^^^^^^^^^^^^^^^ definition [..] WithTypeTemplate# | ||
| extend T::Generic | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
|
|
||
| Tag = type_template | ||
| # ^^^ definition local 2$119448696 | ||
| end | ||
|
|
||
| class WithTypeParameters | ||
| # ^^^^^^^^^^^^^^^^^^ definition [..] WithTypeParameters# | ||
| extend T::Sig | ||
| # ^^^^^^ reference [..] Kernel#extend(). | ||
|
|
||
| sig { type_parameters(:U).params(x: T.type_parameter(:U)).returns(T.type_parameter(:U)) } | ||
| def identity(x) | ||
| # ^^^^^^^^ definition [..] WithTypeParameters#identity(). | ||
| # ^ definition local 1$2839884955 | ||
| x | ||
| # ^ reference local 1$2839884955 | ||
| end | ||
| end | ||
|
|
||
| def use_generics | ||
| # ^^^^^^^^^^^^ definition [..] Object#use_generics(). | ||
| box = GenericBox.new(1) | ||
| # ^^^ definition local 1$1376823943 | ||
| # ^^^^^^^^^^ reference [..] GenericBox# | ||
| # ^^^ reference [..] Class#new(). | ||
| _ = box.get | ||
| # ^ definition local 3$1376823943 | ||
| # ^^^ reference local 1$1376823943 | ||
| # ^^^ reference [..] GenericBox#get(). | ||
| _ = WithTypeParameters.new.identity(42) | ||
| # ^ reference (write) local 3$1376823943 | ||
| # ^^^^^^^^^^^^^^^^^^ reference [..] WithTypeParameters# | ||
| # ^^^ reference [..] Class#new(). | ||
| # ^^^^^^^^ reference [..] WithTypeParameters#identity(). | ||
| return | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # typed: false | ||
|
|
||
| # Common metaprogramming constructs. Currently not specially handled by the | ||
| # indexer (define_method body is a normal block; method_missing / respond_to_missing? | ||
| # are normal method defs). | ||
|
|
||
| class Dynamo | ||
| define_method(:dynamic) do |x| | ||
| x + 1 | ||
| end | ||
|
|
||
| def method_missing(name, *args, &blk) | ||
| "missed " + name.to_s | ||
| end | ||
|
|
||
| def respond_to_missing?(name, include_private = false) | ||
| true | ||
| end | ||
| end | ||
|
|
||
| def use_meta | ||
| Dynamo.new.dynamic(1) | ||
| Dynamo.new.unknown_method | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # typed: false | ||
|
|
||
| # Common metaprogramming constructs. Currently not specially handled by the | ||
| # indexer (define_method body is a normal block; method_missing / respond_to_missing? | ||
| # are normal method defs). | ||
|
|
||
| class Dynamo | ||
| # ^^^^^^ definition [..] Dynamo# | ||
| define_method(:dynamic) do |x| | ||
| # ^^^^^^^^^^^^^ reference [..] Module#define_method(). | ||
| # ^ definition local 1$119448696 | ||
| x + 1 | ||
| # ^ reference local 1$119448696 | ||
| end | ||
|
|
||
| def method_missing(name, *args, &blk) | ||
| # ^^^^^^^^^^^^^^ definition [..] Dynamo#method_missing(). | ||
| # ^^^^ definition local 1$2090704463 | ||
| "missed " + name.to_s | ||
| # ^^^^ reference local 1$2090704463 | ||
| # ^^^^ reference [..] Kernel#to_s(). | ||
| end | ||
|
|
||
| def respond_to_missing?(name, include_private = false) | ||
| # ^^^^^^^^^^^^^^^^^^^ definition [..] Dynamo#`respond_to_missing?`(). | ||
| true | ||
| end | ||
| end | ||
|
|
||
| def use_meta | ||
| # ^^^^^^^^ definition [..] Object#use_meta(). | ||
| Dynamo.new.dynamic(1) | ||
| # ^^^^^^ reference [..] Dynamo# | ||
| # ^^^ reference [..] Class#new(). | ||
| Dynamo.new.unknown_method | ||
| # ^^^^^^ reference [..] Dynamo# | ||
| # ^^^ reference [..] Class#new(). | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should
T::Sighave some sort of snapshot signal?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should but because it's an artificial type that is part of
sorbetit's fine to skip, for the time being. I assume it hasn't been supported before your changes.FYI, in
scip-rubywe currently treat super class as reference instead of inheritance relationship. This is also acceptable for now and could be fixed but only in a separate PR.