Skip to content

Extend declared/actual type check to composite types - #1163

Open
jozanek wants to merge 1 commit into
ergoplatform:masterfrom
jozanek:explicit-vs-declared-type
Open

Extend declared/actual type check to composite types#1163
jozanek wants to merge 1 commit into
ergoplatform:masterfrom
jozanek:explicit-vs-declared-type

Conversation

@jozanek

@jozanek jozanek commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Drops the isAssignableTo / getResultType allowlist helpers from SType in favour of structural equality on the user's ascription. The SigmaBinder no longer overwrites Val.givenType with the body's partial type, so the typer can tell user-written ascriptions from binder scaffolding (Val.tpe still falls back to body.tpe for any downstream consumer). def f(args): R = body is handled via an isFunDef discriminator that compares against the lambda's range.

PR #1061 caught val x: Boolean = 10 and val price: Long = bigInt, but only for 7 primitive types. Coll[T] / Option[T] inner mismatches, tuple element mismatches, SFunc return mismatches, SigmaProp/Box mismatches, and undeclared type names (issue #404 ex 1: val f: XYZ = …) were silently accepted.

Closes #404 and #915

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.

Check that explicitly given type is equivalent to the actual type of expression

1 participant