Fix in type inference - propagate types to a variable in assignments.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 18 Sep 2013 02:36:36 +0100
changeset 95 78bcbdfd9361
parent 94 9f2c651d0437
child 96 12fe1a59dfd1
Fix in type inference - propagate types to a variable in assignments.
SmallSense__ClassType.st
SmallSense__SmalltalkInferencer.st
SmallSense__TypeHolder.st
smallsense.rc
--- a/SmallSense__ClassType.st	Wed Sep 18 02:04:24 2013 +0100
+++ b/SmallSense__ClassType.st	Wed Sep 18 02:36:36 2013 +0100
@@ -72,17 +72,23 @@
 classSide
     "superclass SmallSenseType says that I am responsible to implement this method"
 
-    ^ self class new klass: klass class
+    ^ self class new 
+        klass: klass class;
+        trustfullness: self trustfullness - 10;
+        yourself
 
-    "Modified: / 16-12-2011 / 13:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-09-2013 / 02:34:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 instanceSide
     "superclass SmallSenseType says that I am responsible to implement this method"
 
-    ^ self class new klass: klass theNonMetaclass
+    ^ self class new 
+        klass: klass theNonMetaclass;
+        trustfullness: self trustfullness - 10;
+        yourself
 
-    "Modified: / 16-12-2011 / 13:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-09-2013 / 02:33:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ClassType methodsFor:'printing & storing'!
--- a/SmallSense__SmalltalkInferencer.st	Wed Sep 18 02:04:24 2013 +0100
+++ b/SmallSense__SmalltalkInferencer.st	Wed Sep 18 02:36:36 2013 +0100
@@ -287,11 +287,17 @@
 !SmalltalkInferencer::Phase1 methodsFor:'visiting'!
 
 visitAssignmentNode:anObject
-
+    | type |
+    
     self visit: anObject variable.
     self visit: anObject expression.
+    type := anObject expression inferedType type.
+    type isUnknownType ifFalse:[
+         anObject variable inferedType union: type
+    ].
 
     "Created: / 26-11-2011 / 13:53:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-09-2013 / 02:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 visitBlockNode:anObject
--- a/SmallSense__TypeHolder.st	Wed Sep 18 02:04:24 2013 +0100
+++ b/SmallSense__TypeHolder.st	Wed Sep 18 02:36:36 2013 +0100
@@ -108,6 +108,7 @@
     self type: (type union: anotherType)
 
     "Created: / 16-12-2011 / 02:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-09-2013 / 02:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TypeHolder methodsFor:'printing & storing'!
--- a/smallsense.rc	Wed Sep 18 02:04:24 2013 +0100
+++ b/smallsense.rc	Wed Sep 18 02:36:36 2013 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.3.0\0"
-      VALUE "ProductDate", "Wed, 18 Sep 2013 00:28:35 GMT\0"
+      VALUE "ProductDate", "Wed, 18 Sep 2013 01:35:27 GMT\0"
     END
 
   END