From fc6d1dde1849aacf79dbba35a321d999dda708dd Mon Sep 17 00:00:00 2001 From: Dmitry Kashitsyn Date: Tue, 26 Jul 2016 00:00:12 +0700 Subject: [PATCH] Fixes primitives inference Issue: #17 Issue: #92 --- src/TypeAnalyzer.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/TypeAnalyzer.cpp b/src/TypeAnalyzer.cpp index efc5922..f084023 100644 --- a/src/TypeAnalyzer.cpp +++ b/src/TypeAnalyzer.cpp @@ -977,15 +977,22 @@ void TypeAnalyzer::doPrimitive(const InstructionNode& instruction) { } case primitive::arrayAt: - case primitive::arrayAtPut: - case primitive::stringAt: - case primitive::stringAtPut: case primitive::bulkReplace: primitiveResult = Type(Type::tkPolytype); break; + // FIXME actually this is primitive for ByteArray>>basicAt: + case primitive::stringAt: + primitiveResult = Type(globals.smallIntClass, Type::tkMonotype); + break; + + case primitive::arrayAtPut: + case primitive::stringAtPut: + primitiveResult = m_context[*instruction.getArgument(1)]; + break; + case primitive::cloneByteObject: - primitiveResult = m_context[*instruction.getArgument(0)]; + primitiveResult = m_context[*instruction.getArgument(1)]; break; case primitive::blockInvoke: {