Skip to content
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Welcome to the Quint repository! We are excited that you want to contribute to
Welcome to the Quint repository! We are excited that you want to contribute to
Quint, whether it is by reporting issues, suggesting features, or writing code.

## Table of Contents
Expand Down Expand Up @@ -78,7 +78,7 @@ This repository hosts all Quint pieces:
- [ADR002: Error
codes](./docs/content/docs/development-docs/architecture-decision-records/adr002-errors.md)
- [ADR003: Interface to visit Internal Representation
components](./docs/content/docs/development-docs/architecture-decision-records/adr003-visiting-ir-components.md)
components](./docs/content/docs/development-docs/architecture-decision-records/adr003-visiting-ir-components.md)
- [ADR004: An Effect System for
Quint](./docs/content/docs/development-docs/architecture-decision-records/adr004-effect-system.md)
- [ADR005: A Type System for
Expand Down Expand Up @@ -280,14 +280,14 @@ ln -s $PWD/vscode/quint-vscode/ $HOME/.vscode/extensions/informal.quint-vscode-X

We use `yalc` to manage unpublished packages. To install it, run

``` sh
```sh
npm i yalc -g
```

Then use the `local` make target to replace the published version of `quint`
with the local one and build the extension:

``` sh
```sh
make local
```

Expand All @@ -308,13 +308,13 @@ Write unit tests in [quint/test](./quint/test), add test data to
[quint/testFixture](./quint/testFixture). To run the tests and check code
coverage, run the following commands (in the [quint](./quint) folder):

1. Run unit tests:
1. Run unit tests:

```sh
npm run test
```

1. Check code coverage with tests:
1. Check code coverage with tests:

```sh
npm run coverage
Expand All @@ -326,7 +326,7 @@ When adding a new test fixture or updating an existing one, you might need to
generate the `.json` and `.map.json` files used in test expectations. For that,
run:

``` sh
```sh
npm run update-fixtures
```

Expand Down Expand Up @@ -365,10 +365,10 @@ The files containing tests for `txm` are:

Run integration tests:

```sh
npm run compile && npm link && npm run integration
```
```sh
npm run compile && npm link && npm run integration
```

PS: this will not run the Apalache-related tests, as they usually won't break as
consequences of changes in the Quint codebase. They are run in the CI, and you
can run them locally by running `npm run apalache-integration` and `npm run
Expand All @@ -388,7 +388,7 @@ To [add a new dependency for integration tests or other development
purposes](https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file)
run:

``` sh
```sh
npm install <dep> --save-dev
```

Expand All @@ -402,7 +402,7 @@ To [add a new dependency for integration tests or other development
purposes](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html)
run:

``` sh
```sh
cargo add <dep> --dev
```

Expand Down Expand Up @@ -436,7 +436,7 @@ lose the advantage of exhaustiveness checking. Here's an example:
Assume we have a type `T`

```typescript
type T = 'a' | 'b' | 'c'
type T = 'a' | 'b' | 'c';
```

We should structure our program such that
Expand All @@ -445,7 +445,7 @@ We should structure our program such that
- whenever a new alternative is added to this type, the type system will warn us
about all the places we need to account for the new kind of data.

If we use `T` with a `switch` or `if`/`then` statement that *returns values*,
If we use `T` with a `switch` or `if`/`then` statement that _returns values_,
this indispensable help is ensured. E.g., if we try to write the following:

```typescript
Expand Down Expand Up @@ -535,15 +535,15 @@ false
false
```

For this reason, we are using `isEqual` provided by the [lodash.isequal][]
For this reason, we are using `isEqual` provided by the [node:util][]
package:

```js
> import { none, just } from '@sweet-monads/maybe'
> import isEqual from 'lodash.isequal'
> isEqual(just(true), just(true))
> import { isDeepStrictEqual } from 'node:util'
> isDeepStrictEqual(just(true), just(true))
true
> isEqual(none(), none())
> isDeepStrictEqual(none(), none())
true
```

Expand Down Expand Up @@ -606,7 +606,7 @@ the Rust evaluator and the VSCode extension + the language server.

This will trigger the release and publication of the package to npm and
GitHub.

### Evaluator

The evaluator is the latest addition to the Quint repository, and it's release
Expand Down
6 changes: 0 additions & 6 deletions quint/package-lock.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not delete this file, it is necessary for building Quint with nix

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yazaldefilimone can you add this file back please? We can't delete it.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion quint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"line-column": "^1.0.2",
"lodash": "^4.17.21",
"lodash.clonedeep": "4.5.0",
"lodash.isequal": "^4.5.0",
"seedrandom": "^3.0.5",
"tar": "^6.1.14",
"yargs": "^17.7.2"
Expand Down
12 changes: 6 additions & 6 deletions quint/src/effects/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Either, left, mergeInMany, right } from '@sweet-monads/either'
import { Substitutions, applySubstitution, applySubstitutionToEntity, compose } from './substitutions'
import { Error, ErrorTree, buildErrorLeaf, buildErrorTree } from '../errorTree'
import { flattenUnions, simplify } from './simplification'
import isEqual from 'lodash.isequal'
import { isDeepStrictEqual } from 'node:util'
import { differenceWith, intersectionWith } from 'lodash'

/* Kinds for concrete effect components */
Expand Down Expand Up @@ -332,7 +332,7 @@ export function unifyEntities(va: Entity, vb: Entity): Either<ErrorTree, Substit
const location = `Trying to unify entities [${entityToString(v1)}] and [${entityToString(v2)}]`

if (v1.kind === 'concrete' && v2.kind === 'concrete') {
if (isEqual(new Set(v1.stateVariables.map(v => v.name)), new Set(v2.stateVariables.map(v => v.name)))) {
if (isDeepStrictEqual(new Set(v1.stateVariables.map(v => v.name)), new Set(v2.stateVariables.map(v => v.name)))) {
return right([])
} else {
return left({
Expand All @@ -349,7 +349,7 @@ export function unifyEntities(va: Entity, vb: Entity): Either<ErrorTree, Substit
return right(bindEntity(v1.name, v2))
} else if (v2.kind === 'variable') {
return right(bindEntity(v2.name, v1))
} else if (isEqual(v1, v2)) {
} else if (isDeepStrictEqual(v1, v2)) {
return right([])
} else if (v1.kind === 'union' && v2.kind === 'concrete') {
return mergeInMany(v1.entities.map(v => unifyEntities(v, v2)))
Expand All @@ -358,10 +358,10 @@ export function unifyEntities(va: Entity, vb: Entity): Either<ErrorTree, Substit
} else if (v1.kind === 'concrete' && v2.kind === 'union') {
return unifyEntities(v2, v1)
} else if (v1.kind === 'union' && v2.kind === 'union') {
const intersection = intersectionWith(v1.entities, v2.entities, isEqual)
const intersection = intersectionWith(v1.entities, v2.entities, isDeepStrictEqual)
if (intersection.length > 0) {
const s1 = { ...v1, entities: differenceWith(v1.entities, intersection, isEqual) }
const s2 = { ...v2, entities: differenceWith(v2.entities, intersection, isEqual) }
const s1 = { ...v1, entities: differenceWith(v1.entities, intersection, isDeepStrictEqual) }
const s2 = { ...v2, entities: differenceWith(v2.entities, intersection, isDeepStrictEqual) }

// There was an intersection, try to unify the remaining entities
return unifyEntities(s1, s2)
Expand Down
6 changes: 3 additions & 3 deletions quint/src/effects/modeChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @module
*/

import isEqual from 'lodash.isequal'
import { isDeepStrictEqual } from 'node:util'
import { qualifierToString } from '../ir/IRprinting'
import { IRVisitor, walkDeclaration } from '../ir/IRVisitor'
import { QuintError } from '../quintError'
Expand Down Expand Up @@ -248,15 +248,15 @@ function addedEntities(paramEntities: Entity[], resultEntity: Entity): Entity[]
case 'union':
return resultEntity.entities.flatMap(entity => addedEntities(paramEntities, entity))
case 'concrete': {
const vars = resultEntity.stateVariables.filter(v => !paramEntities.some(p => isEqual(p, v)))
const vars = resultEntity.stateVariables.filter(v => !paramEntities.some(p => isDeepStrictEqual(p, v)))
if (vars.length === 0) {
return []
}

return [{ kind: 'concrete', stateVariables: vars }]
}
case 'variable':
return !paramEntities.some(p => isEqual(p, resultEntity)) ? [resultEntity] : []
return !paramEntities.some(p => isDeepStrictEqual(p, resultEntity)) ? [resultEntity] : []
}
}

Expand Down
5 changes: 2 additions & 3 deletions quint/src/effects/simplification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
* @module
*/

import isEqual from 'lodash.isequal'
import { unreachable } from '../util'
import { isEqual, unreachable } from '../util'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is making us fail to compile

Suggested change
import { isEqual, unreachable } from '../util'
import { unreachable } from '../util'

Copy link
Collaborator

Choose a reason for hiding this comment

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

And we also need to add an import for isDeepStrictEqual

Copy link
Author

@yazaldefilimone yazaldefilimone Dec 16, 2025

Choose a reason for hiding this comment

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

@bugarela sorry... fix now.

import { ConcreteEffect, Effect, Entity, StateVariable } from './base'

/**
Expand Down Expand Up @@ -100,7 +99,7 @@ function deduplicateEntity(entity: Entity): Entity {
const nestedEntities = entity.entities.map(v => deduplicateEntity(v))
const unique: Entity[] = []
nestedEntities.forEach(entity => {
if (!unique.some(v => isEqual(v, entity))) {
if (!unique.some(v => isDeepStrictEqual(v, entity))) {
unique.push(entity)
}
})
Expand Down
2 changes: 1 addition & 1 deletion quint/src/effects/substitutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function applySubstitution(subs: Substitutions, e: Effect): Either<ErrorT
}

return result.map(simplify).chain(r => {
if (!isEqual(r, e)) {
if (!isDeepStrictEqual(r, e)) {
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The function call uses isDeepStrictEqual but this function is not imported in this file. The import statement needs to be added: import { isDeepStrictEqual } from 'node:util'. Additionally, the existing import { isEqual } from 'lodash' import should be removed if it's no longer used elsewhere in the file.

Copilot uses AI. Check for mistakes.
// Keep re-applying the substitutions until the effect is unchanged.
// Useful when substitutions have a transitive pattern [ a |-> b, b |-> c ]
return applySubstitution(subs, r)
Expand Down
2 changes: 1 addition & 1 deletion quint/src/runtime/impl/nondet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function evalNondet(
}

// Retry if condition is satisfied and we haven't exhausted all possible positions.
} while (shouldRetry && !isEqual(newPositions, originalPositions))
} while (shouldRetry && !isDeepStrictEqual(newPositions, originalPositions))
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The function call uses isDeepStrictEqual but this function is not imported in this file. The import statement needs to be added: import { isDeepStrictEqual } from 'node:util'. Additionally, the existing import { isEqual } from 'lodash' import should be removed if it's no longer used elsewhere in the file.

Copilot uses AI. Check for mistakes.

// Reset the cache
cache.value = undefined
Expand Down
2 changes: 1 addition & 1 deletion quint/src/types/substitutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function applySubstitution(table: LookupTable, subs: Substitutions, t: Qu
}

const result = singleApplication()
if (isEqual(result, t)) {
if (isDeepStrictEqual(result, t)) {
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The function call uses isDeepStrictEqual but this function is not imported in this file. The import statement needs to be added: import { isDeepStrictEqual } from 'node:util'. Additionally, the existing import { isEqual } from 'lodash' import should be removed if it's no longer used elsewhere in the file.

Copilot uses AI. Check for mistakes.
return t
} else {
return applySubstitution(table, subs, result)
Expand Down
2 changes: 1 addition & 1 deletion quint/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function zip<A, B>(a: A[], b: B[]): [A, B][] {
*
* ```
* const result = findMap([1,2,3], (x) => x % 2 === 0 ? just(x) : none<int>())
* lodash.isEqual(result, just(2))
* lodash.isDeepStrictEqual(result, just(2))
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The documentation comment incorrectly refers to lodash.isDeepStrictEqual. Since lodash doesn't have an isDeepStrictEqual method, this should just be isDeepStrictEqual (from node:util). Additionally, util.ts needs to import and re-export isDeepStrictEqual from node:util so that simplification.ts can import it from this module.

Copilot uses AI. Check for mistakes.
* ```
* */
export function findMap<X, Y>(xs: Iterable<X>, f: (x: X) => Maybe<Y>): Maybe<Y> {
Expand Down
Loading