mame / typeprof-playground

5 stars 0 forks source link

"no argument for required keywords" #1

Closed ko1 closed 3 years ago

ko1 commented 4 years ago

Issue

Why that?

test.rb:10: [error] no argument for required keywords
test.rb:14: [error] no argument for required keywords
...
  attr_reader age : untyped

ruby

class User
  def initialize name: 'ko1', age: 10
    @name = name
    @age = age
  end
  attr_reader :name, :age
end

def hello_message
  "Helo, " + User.new.name
end

def wrong_type_demo
  "Age is " + User.new.age
end

rbs

output

# Errors
test.rb:10: [error] no argument for required keywords
test.rb:14: [error] no argument for required keywords

# Classes
class Object
  def hello_message : -> String
  def wrong_type_demo : -> String
end

class User
  attr_reader name : String
  attr_reader age : untyped
  def initialize : (?name: untyped, ?age: Integer) -> untyped
end

## Version info:
##   * Ruby: 2.7.1
##   * RBS: 0.14.0
##   * TypeProf: 0.2.1
mame commented 3 years ago

Thank you, now it works!