ku-progsys / rbsyn

Program synthesis for Ruby
BSD 3-Clause "New" or "Revised" License
94 stars 4 forks source link

Eliminate programs that are not type correct #10

Open ngsankha opened 4 years ago

ngsankha commented 4 years ago

Given a function argument of type { email: ?String, active: ?%bool, username: ?String, name: ?String }, and if asked to give a program that returns a String the synthesizer will return programs like:

arg0.[](:name)
arg0.[](:username)
arg0.[](:active)
arg0.[](:email)

The program with :active is not correct. Even though it can be eliminated after testing, doing so with type checking could be cheaper. Such programs are generated because the argument can be String or bool. But only after the argument is filled that the precise type can be calculated. Such kind of analysis can be directly implemented as well.

ngsankha commented 4 years ago

Intermediate AST node's types are refined now from commit e80be99. This makes the types more precise, so we can start eliminating more type incorrect programs.