Skip to content

fixes #22122; raise effects for complex expressions#25845

Merged
Araq merged 1 commit into
develfrom
pr_mj
Jun 8, 2026
Merged

fixes #22122; raise effects for complex expressions#25845
Araq merged 1 commit into
develfrom
pr_mj

Conversation

@ringabout

@ringabout ringabout commented May 29, 2026

Copy link
Copy Markdown
Member

fixes #22122

The root cause is in the effect tracker: raise was recording the whole conditional expression as one exception source, so semantic checking only saw the widened common base type instead of the concrete exception classes from each branch.

Copilot AI review requested due to automatic review settings May 29, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Araq Araq closed this May 29, 2026
@Araq Araq reopened this May 29, 2026
@Araq Araq merged commit e942da9 into devel Jun 8, 2026
33 of 34 checks passed
@Araq Araq deleted the pr_mj branch June 8, 2026 20:59
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from e942da9

Hint: mm: orc; opt: speed; options: -d:release
192959 lines; 10.188s; 797.129MiB peakmem

narimiran pushed a commit that referenced this pull request Jun 9, 2026
fixes #22122

The root cause is in the effect tracker: raise was recording the whole
conditional expression as one exception source, so semantic checking
only saw the widened common base type instead of the concrete exception
classes from each branch.

(cherry picked from commit e942da9)
narimiran added a commit that referenced this pull request Jun 9, 2026
Araq pushed a commit that referenced this pull request Jun 9, 2026
Reverts #25845

```nim
case ecode
of ECONNABORTED, EPERM, ETIMEDOUT, ENOTCONN:
  getConnectionAbortedError(ecode)
of EMFILE, ENFILE, ENOBUFS, ENOMEM:
  getTransportTooManyError(ecode)
else:
  (ref TransportOsError)(code: ecode,
                         msg: "(" & $int(ecode) & ") " & osErrorMsg(ecode))
```

The compiler inserts a hidden conv for the case expression. Perhaps we
can skip hidden convs to inspect the types that are actually raised
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.

Unclear error message for raise of a complex expression

3 participants