@@ -646,17 +646,14 @@ impl dynamicTypeAnnotation {
646646
647647 unsafe fn annotatePrim(mut self, mut &k: &Type): (ok: bool) {
648648 // Try to annotate by primitive type the any.
649- // If self.k type in generics, handle it.
650- // If result is not successful and self.k is not generic,
651- // check for the primitive type compatibility.
652- // If types are same, report true. There is no need to infer type.
649+ // If self.k type in generics, annotateAny will handle it.
653650 ok, generic := self.annotateAny(k)
654651 if !ok && !generic {
655- kprim := k.Prim()
656- skprim := (*self.k).Prim()
657- if kprim != nil && skprim != nil && k.Equal(*self.k) {
658- ok = true
659- }
652+ // The self.k type is not generic. So there is no need to infer type.
653+ // Types may be different, it is ok for now, no relevance with inference.
654+ // Report true to avoid log error about type inference.
655+ // Type compatibility analysis will log error about incompatibility, if any.
656+ ok = true
660657 }
661658 ret
662659 }
@@ -811,8 +808,10 @@ impl dynamicTypeAnnotation {
811808 self.pushGeneric(k, i)
812809 | !t.Type.Equal(k):
813810 // Generic already pushed but generic type and current kind
814- // is different, so incompatible.
815- ret false, true
811+ // is different, so incompatible. There is no need to infer type.
812+ // Report true to avoid log error about type inference.
813+ // Type compatibility analysis will log error about incompatibility.
814+ ret true, true
816815 }
817816 (*self.k).Kind = k.Kind
818817 ret true, true
0 commit comments