use of org.jetbrains.kotlin.resolve.BindingTraceContext in project kotlin by JetBrains.
the class KotlinTypeCheckerTest method assertType.
private void assertType(LexicalScope scope, String expression, String expectedTypeStr) {
Project project = getProject();
KtExpression ktExpression = KtPsiFactoryKt.KtPsiFactory(project).createExpression(expression);
KotlinType type = expressionTypingServices.getType(scope, ktExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfoFactory.EMPTY, new BindingTraceContext());
KotlinType expectedType = expectedTypeStr == null ? null : makeType(expectedTypeStr);
assertEquals(expectedType, type);
}
use of org.jetbrains.kotlin.resolve.BindingTraceContext in project kotlin by JetBrains.
the class TrackingSliceMapTest method testFurtherSlices.
public void testFurtherSlices() {
WritableSlice<String, Integer> NAME_COLOR = Slices.<String, Integer>sliceBuilder().setDebugName("NAME_COLOR").build();
@SuppressWarnings("unchecked") WritableSlice<String, Object> NAME_OBJECT = Slices.<String, Object>sliceBuilder().setFurtherLookupSlices(new ReadOnlySlice[] { NAME_COLOR }).setDebugName("NAME_OBJECT").build();
BindingTraceContext traceContext = BindingTraceContext.createTraceableBindingTrace();
traceContext.record(NAME_COLOR, "RED", 0xff0000);
Object object = traceContext.get(NAME_OBJECT, "RED");
assertNotNull(object);
Integer color = (Integer) object;
assertEquals(0xff0000, (int) color);
}
use of org.jetbrains.kotlin.resolve.BindingTraceContext in project kotlin by JetBrains.
the class TrackingSliceMapTest method testSimpleSlice.
public void testSimpleSlice() {
WritableSlice<String, Integer> SUPER_COMPUTER = Slices.<String, Integer>sliceBuilder().setDebugName("SUPER_COMPUTER").build();
BindingTraceContext traceContext = BindingTraceContext.createTraceableBindingTrace();
traceContext.record(SUPER_COMPUTER, "Answer", 42);
Integer answer = traceContext.get(SUPER_COMPUTER, "Answer");
assertNotNull(answer);
assertEquals(42, (int) answer);
}
Aggregations