chakra-core / chakra-core/ChakraCore

review type checks that should be tautologically true

Open
#5,737 0 comments 0 reactions 0 assignees View on GitHub
Task
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

As @Penguinwizzard mentioned [here](https://github.com/Microsoft/ChakraCore/pull/5456#discussion_r220382324),

> This feels like there's a few situations in which a smart compiler would be able to make it always return true - e.g. with a static build and ltcg, I think it may be legal to optimize the "GetTypeId() == mytypeid" ::Is() checks for various object types in our type system to always return true when working on the same type as that passed in - since there's no avenue other than UB to change the typeid of valid objects of that pointer type to something else. Since we're already doing effectively that, it's not a regression with this change, but in a future change we'll most likely want to change this to being closer to VarIs in terms of signature, with the exception of making the last line `AssertOrFailFast(VarIsImpl(obj))`.

This issue is a reminder to come back to check on calls to VarIsCorrectType.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.