Skip to content

Instantly share code, notes, and snippets.

@realjenius
Created November 24, 2011 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realjenius/1391909 to your computer and use it in GitHub Desktop.
Save realjenius/1391909 to your computer and use it in GitHub Desktop.
Method Inference
class MethodDefinition
def infer(typer)
forced_type = @return_type
inferred_type = @body.infer(typer)
actual_type = if forced_type.nil?
inferred_type
else
forced_type
end
if !actual_type.is_parent(inferred_type)
raise "inference error"
end
return actual_type
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment