<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix">On 18/12/2019 07:36, pierre misse wrote:<br>
</div>
<blockquote type="cite" cite="mid:DB6P18901MB0215560145635C6B89E5AA75E5530@DB6P18901MB0215.EURP189.PROD.OUTLOOK.COM">
<pre class="moz-quote-pre" wrap=""> </pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<p><br>
</p>
<div class="moz-cite-prefix">On 18/12/2019 03:52, Eliot Miranda wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAC20JE1aVZfraAoi6YFwFK72Srt0edWPN91dMtWS4Rp4P+fWqA@mail.gmail.com">
<pre class="moz-quote-pre" wrap=""> </pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Hi Pierre,</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Dec 17, 2019 at 9:50 AM pierre misse <<a href="mailto:pierre_misse25@msn.com" moz-do-not-send="true">pierre_misse25@msn.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
 
<div bgcolor="#FFFFFF">
<p>Hi, <br>
</p>
<p>I saw my previous mistake, and corrected this. <br>
This is a sample test, for a very simple inference.<br>
</p>
<p>testReturnFloatConstantNode<br>
    | ccg tMethod |<br>
    ccg := CCodeGenerator new.<br>
    ccg addClass: SlangTypeInferenceTestsClass.<br>
    ccg inferTypesForImplicitlyTypedVariablesAndMethods.<br>
    tMethod := ccg methodNamed: #returnAFloatConstantNode.<br>
    <br>
    self assert: tMethod isNotNil.<br>
    self assert: (ccg typeFor: tMethod statements first in: tMethod) equals: #double.<br>
    self assert: tMethod returnType equals: #double</p>
</div>
</blockquote>
<div><br>
</div>
<div> And perhaps have SlangTypeInferenceTestsClass inherit from StackInterpreter or InterpreterPrimitives.  That will give you much more context.</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p>I was currently inheriting from interpreterPlugin, but I can indeed switch.</p>
<p>My tests currently were as simple as it gets:</p>
<p>constantNode<br>
Returm constant<br>
return Explicit argument<br>
return Explicit Temporary<br>
return temp assigned by constant.</p>
</blockquote>
and return message send (which returns a constant)*<br>
<blockquote type="cite" cite="mid:DB6P18901MB0215560145635C6B89E5AA75E5530@DB6P18901MB0215.EURP189.PROD.OUTLOOK.COM">
<p>So it wasn't necessary. <br>
</p>
<p>Only surprising result is the return temp assigned by constant, which looses the type. This seems to be easily improvable in the future if you'd like.</p>
<p>returnTempFloatConstantNode<br>
    | t |<br>
    t := 1.0.<br>
    ^ t</p>
<p>testReturnTempFloatConstantNode<br>
    | ccg tMethod |<br>
    ccg := CCodeGenerator new.<br>
    ccg addClass: SlangTypeInferenceTestsClass.<br>
    ccg inferTypesForImplicitlyTypedVariablesAndMethods.<br>
    tMethod := ccg methodNamed: #returnTempFloatConstantNode.<br>
    <br>
    self assert: tMethod isNotNil.<br>
    self assert: (ccg typeFor: tMethod statements first in: tMethod) equals: #double.<br>
    self assert: (ccg typeFor: tMethod statements first variable in: tMethod) equals: #sqInt.<br>
    self assert: tMethod returnType equals: #sqInt.<br>
    <br>
    self error "wait what"<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:CAC20JE1aVZfraAoi6YFwFK72Srt0edWPN91dMtWS4Rp4P+fWqA@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p> I need to work on ones with ambiguity.<br>
<br>
<br>
</p>
</div>
</blockquote>
<div> The instability I saw was in getErrorObjectFromPrimFailCode; its two locals clone & errObj are sometimes typed as squint and sometimes as usqInt.  Some times numPointerSlotsOf ends up with a return type of usqInt, some times as sqInt.  I've recently had
 success in another project substituting OrderedDictionary et al for Dictionary.  So I'm sure that solutions can be found easily.</div>
<div> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p>Thanks for the pointer !<br>
</p>
<p><br>
</p>
<p>Pierre<br>
</p>
</blockquote>
</body>
</html>