Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilization: part XXIV #284

Merged
merged 23 commits into from
Oct 1, 2023
Merged

Conversation

MchKosticyn
Copy link
Member

No description provided.

@@ -13,6 +13,15 @@ public static int GetHashCode(string str)
[Implements("System.Boolean System.String.Equals(this, System.String)")]
public static bool Equals(string str1, string str2)
{
if (string.IsNullOrEmpty(str1) && string.IsNullOrEmpty(str2))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пустая и нулловая строки будут равны

assert(List.length args = 0)
MakeBool false

let internal consoleClear (_ : state) (args : term list) =
let consoleClear (_ : state) (args : term list) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Название этого метода лучше с большой буквы

let dstSize = lazy(TypeUtils.internalSizeOf dstType.Value)
let srcSize = lazy(TypeUtils.internalSizeOf srcType.Value)
let allSafe() =
let isSafe =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Такой же код как в isSafeContextWrite

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это сделано для эффективности, так как размеры используются в нескольких местах

(fun x y k -> simplifyComparisonExt op x y resultIfSame k)
(fun x y -> simplifyComparison op x y resultIfSame)

and simplifyEqual x y k = simplifyComparison OperationType.Equal x y true k
and simplifyNotEqual x y k = simplifyEqual x y ((!!) >> k)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может, неравенство тоже переписать?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем? Равенство определено хорошо.

let endByte = makeNumber viewSize |> add startByte
(indices, element, startByte, endByte), add currentOffset elementSize
List.mapFold getElement (mul firstElement elementSize) [0 .. countToRead - 1] |> fst
let inBlock = checkBlockBounds reporter arraySize offset (makeNumber viewSize |> add offset)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут уже не нужна проверка на isValueType?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет, так как индексы могут быть только у массивов, а они в куче располагаются

member private x.MkBVAdd operands : BitVecExpr =
x.ExtendIfNeed operands true |> ctx.MkBVAdd
x.ExtendIfNeed operands true |> ctx.MkBVAdd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишний пробел

for xs' in cartesian xss do
yield x::xs'
let xssCartesian = cartesian xss
if Seq.isEmpty xssCartesian |> not then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что это за кейс? Когда какой-то из элементов, по которым строим декартово произведение -- пустой список?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Полагаю, что так

@@ -92,6 +94,17 @@ module public List =
let list = List.foldBack folder list List.empty
removed, list

let rec sequenceOption f list =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эта функция -- не то же самое, что проверить, что для всех элементов списка f дает Some, и тогда обернуть список в Some? Если так, то можно переписать хвосторекурсивно

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Она unused, удалил ее

let isReal = realTypes.Contains
let isUnsigned = unsignedTypes.Contains
let isPrimitive = primitiveTypes.Contains
let isLongTypes x = longTypes.Contains x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше *isLong

Copy link
Member Author

@MchKosticyn MchKosticyn Sep 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У нас уже есть функция isLong, которая проверяет на равенство с typeof(Int64). Эта же функция допускает еще и typeof(UInt64)

for KeyValue(parameter, paramDependencies) in dependencies do
for dep in paramDependencies do
depsCounts[parameter] <- depsCounts[parameter] + 1
reversedDeps[dep] <- parameter :: reversedDeps[dep]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему reversedDeps[dep] всегда будет существовать и мы не упадем с key not found?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Видимо, по построению

@MchKosticyn MchKosticyn merged commit 2c4b782 into VSharp-team:master Oct 1, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants