You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In simple case, the compiler can catch the error correctly:
localinterfaceIendlocalrecordAisIendlocalfunctiontest(a: I): Ireturnaendlocali: Ilocala: Aa=test(i) -- Error: I is not a A
But if the situation is more complex, the compile results become weird:
localinterfaceI<T>endlocalrecordA1endlocalrecordA2isI<A1>endlocalfunctiontest<T, KisI<T>>(a: T): Klocalk: Kreturnkendlocala1: A1locala2: A2localia1: I<A1>-- test 1a2=ia1-- Error: I<A1> is not a A2a2=test(a1) -- No error, but it should?-- test 2ia1=test(a1)
a2=ia1-- No error, but it should?-- test 3localz=test(a1)
a2=z-- Error: I<A1> is not a A2
Desired behavior: teal compiler can catch the error.
The text was updated successfully, but these errors were encountered:
And which makes me even more confused is if I do something like this:
localinterfaceI<T>endlocalrecordA1endlocalrecordA2isI<A1>endlocalrecordB1endlocalrecordB2isI<B1>endlocalfunctiontest<T, KisI<T>>(a: T): Klocalk: Kreturnkendlocala1: A1localb1: B1locala2: A2localb2: B2a2=test(a1)
localz=test(b1) -- From the type info json, z's type is I<A1>. Why?b2=z-- Error: I<A1> is not a B2. Why?
This makes no sense to me. Basically once I called test() , then all the following test() call will return the same type as the first call resolved, no matter what parameter I pass to the following test() calls.
In simple case, the compiler can catch the error correctly:
But if the situation is more complex, the compile results become weird:
Desired behavior: teal compiler can catch the error.
The text was updated successfully, but these errors were encountered: