Skip to content
Discussion options

You must be logged in to vote

Hello @theogiraudet,

the short answer is, that Typir does not yet support duck typing (I call it "structurally typed classes"), but it is on our roadmap (#45).

Some more detailed answers:

  • inferenceRuleForConstructor is used to type an instantiation, such as Class()

yes

  • inferenceRuleForReference is used when the class is used as a type, for instance in nested: NestedClass

yes

  • inferenceRuleForFieldAccess is used when a property is accessed and it is not a method call, for instance x.a

yes, we could call it "member access" as well

  • According to the name, I suppose that inferenceRuleForDeclaration is used to type the class declaration itself

Yes, that is intended for cases, whe…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@theogiraudet
Comment options

@JohannesMeierSE
Comment options

Answer selected by theogiraudet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants