Comments (3)
Yes, very fair point - we have now changed the name!
Awesome. That's a smart move against some future WTFs in your codebase.
You may choose not to do anything about this. Maybe this issue can just be a documentation / pointer to anyone who follows.
I would still like to fix this since Tapioca tries really hard to be resilient against all kinds of user manipulation of types. I mention some of the wild things libraries do that we had to protect against in my RubyKaigi talk.
PS: Nice touch with the XKCD link :)
from tapioca.
Oh, I see what is happening here, thanks for the detailed report. I'll see how we can fix this but, in the meanwhile, I would like to note that your method name choice is quite problematic.
Your FooTest
class is overriding Object#hash
in an incompatible way. Normally Object#hash
is used to calculate a numeric hash key value which is used to figure out where to place the object in a Hash
table. That is what makes Hash
lookups efficient.
Your override is returning an Hash
value from that method instead, so Ruby has difficulty using the class as a Hash
key, and, in turn, as a Set
value, since Set
s are built using Hash
es.
These would all fail:
> Set.new([Foo])
TypeError: no implicit conversion of Hash into Integer
> { Foo => "bar" }
TypeError: no implicit conversion of Hash into Integer
> h = {}; h[Foo] = "bar"
TypeError: no implicit conversion of Hash into Integer
You should keep that in mind if you ever want to use the class as a Hash
key at some point.
from tapioca.
Yes, very fair point - we have now changed the name!
You may choose not to do anything about this. Maybe this issue can just be a documentation / pointer to anyone who follows.
from tapioca.
Related Issues (20)
- tapioca issue with latest version of google-protobuf blocking Ruby 3.2 upgrade HOT 2
- in_batches/find_in_batches/find_each cannot return nil HOT 1
- v0.11.0 doesn't find some Rails models in Rails 6 HOT 8
- Tapioca loads ActiveRecord every time HOT 3
- Inconsistent inclusion of gem comments in generated RBI HOT 2
- Verify PR labels before merging HOT 1
- uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQL::OID (NameError) HOT 3
- Support ActiveRecord::Attributes DSL HOT 2
- Create DSL compiler for adding signatures to controller actions HOT 1
- Rubygems 3.4.12 `silence_warnings': uninitialized constant Gem::DefaultUserInteraction (NameError) HOT 3
- Default to raising exceptions if Rails app could not be loaded
- Tapioca init command is throwing an error HOT 3
- Omit declaring `.new` constructors for abstract classes in generated RBI files HOT 1
- `tapioca gem …` does not add `has_attached_class!` to generated RBIs where necessary, potentially causing problems
- Association lambdas have wrong relation type HOT 2
- Merge gem annotations with gem RBIs to simplify user experience
- tapioca init failes: because of gem load error HOT 5
- The `AutoRequireHook` patch should only apply to `tapioca gem` command
- `Google::Protobuf` DSL generation broken again HOT 6
- Annotations don't work when using with `--copt=-march=native` sorbet HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tapioca.