Skip to content

Fix #4277: Ensure we are passing refEnd and not length to findSourceFile#4290

Merged
mhegazy merged 3 commits into
masterfrom
fix4277
Aug 17, 2015
Merged

Fix #4277: Ensure we are passing refEnd and not length to findSourceFile#4290
mhegazy merged 3 commits into
masterfrom
fix4277

Conversation

@mhegazy

@mhegazy mhegazy commented Aug 12, 2015

Copy link
Copy Markdown
Contributor

Fixes #4277

There was a confusion on the fifth argument to findSoruceFile, some places will send the refEnd, others will send the refLength. this will trigger an assert when writing the diagnostics if the refLength > file text length.

The fix is to ensure we are always calling it with the right argument, also added a more conservative check for empty refPos and refEnd to ensure diagnostic emit does not fail

…ile.

Also add a more conservative check for empty refPos and refEnd to ensure diagnostic emit does not fail
Comment thread src/compiler/program.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make a helper function for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i thought about that, but this seems easier to read and a reminder why we are doing it this way.

@DanielRosenwasser

Copy link
Copy Markdown
Member

I think this may have been the cause of some issues I was having with "fancy" diagnostic reporting. I'd like to see how it copes after this change.

@mhegazy

mhegazy commented Aug 17, 2015

Copy link
Copy Markdown
Contributor Author

@DanielRosenwasser any more comments?

@DanielRosenwasser

Copy link
Copy Markdown
Member

👍

mhegazy added a commit that referenced this pull request Aug 17, 2015
Fix #4277: Ensure we are passing refEnd and not length to findSourceFile
@mhegazy
mhegazy merged commit 25dfcec into master Aug 17, 2015
@mhegazy
mhegazy deleted the fix4277 branch August 17, 2015 22:21
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug Failure. False expression: end must be the bounds of the file

3 participants