Blog post: `reveal_type` in Crystal

Following solution can be a supplement to above solution.

1. Add a BlackHole type for a universal type for any unknown type.

class BlackHole
  macro method_missing(call)
    raise "BUG: must implement {{call.name}}"
  end
end

2. for any places compiler complain “can not infer current type”, just use BlackHole as type.

3. compile again, compiler will tell you, “should be a String, not BlackHole”, then, you known, the correct type should be String.

I use this hack all the days when i porting Ruby gems into Crystal, this solution come from asterite by this reply