Commit Graph
13 Commits
Author SHA1 Message Date
Lucile Rose Nihlen af0710ea16 Add addr self binding support in destructors (#3117)
Refactors `CallDestructor` and `CallFunction` to both call a new method
`BindSelfIfPresent`, which includes support for binding `addr self` if
specified. Fixes the associated unit test.

Closes #2802.
2023-08-29 20:46:39 +00:00
Prabhat SachdevaandJon Ross-Perkins 289d05813e Explorer: Remove PrintDepth and implement PrintIndent. (#3113)
This PR removes `PrintDepth` from statement and declaration.
Implements `PrintIndent` for better indented formatting along with
various changes to make printing of statements and declarations better.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2023-08-25 17:17:39 +00:00
Prabhat Sachdeva 90d2d075f2 Explorer: add blank lines between trace of different sections (#3096) 2023-08-15 21:10:12 +00:00
Prabhat Sachdeva da35a9806a Explorer: make pattern match trace consistent (#3093)
Makes the trace output for pattern match more consistent with the rest
of the trace by using `Match()` and `Indent()` prefix methods and
wrapping the code in the trace with backticks.
2023-08-12 00:02:41 +00:00
Prabhat Sachdeva c5667c0e10 Explorer: add trace for InstantiateType (#3041)
Adds trace output for `Interpreter::InstantiateType` method.
2023-08-11 18:05:30 +00:00
Prabhat Sachdeva 2a74c807d8 Explorer: Add heading and sub-heading methods to trace (#3088)
Instead of manually putting symbols before and after heading, this
introduces two methods `Heading` and `SubHeading` inside `TraceStream`.

Both methods take `llvm::StringRef` as parameter, formats the given text
as follows and adds it into the output stream.

**Heading**
```
* * * * * * * * * *  heading  * * * * * * * * * *
-------------------------------------------------
```
**Sub heading**
```
- - - - -  sub heading  - - - - -
---------------------------------
```

Note: both methods assert that tracing should be enabled.
2023-08-10 22:40:21 +00:00
Prabhat Sachdeva 3cca175a57 Explorer: Add source snippets to trace output (#3082)
Adds **Source Snippets** for interpreter and type checker's trace
output.
Note: Source snippets are trace for only declarations and statements.
2023-08-10 18:29:52 +00:00
Prabhat Sachdeva 0bcba9d05e Explorer: Add methods to trace for line prefixes (#3076)
Defines methods into `TraceStream` for adding line prefixes. Instead of
directly using string literals.

Example usage,
```
trace_stream_->Start() << "declaring ... " << ... ;
```
will result in,
```
->> declaring ... 
```
2023-08-09 19:05:19 +00:00
Prabhat Sachdeva 2f70c7d8bb Explorer: Reduce prelude path when printing source location (#3080)
The Prelude path can be very long, which can make the `SourceLocation`'s
`Print(...)` method output unnecessarily verbose. This PR modifies the
`SourceLocation`'s `Print()` method to just print the **filename** and
**line number** for prelude.
2023-08-09 17:57:07 +00:00
Richard Smith 212188a922 Prefer to put STDOUT CHECK at the end of the file. (#3073)
Allow interleaving of STDOUT and STDERR check lines. Put STDOUT lines
after the line they're attached to, and STDERR lines before. If no
STDOUT check line is attached to any line, then put them all at the end
of the file instead.

This is intended to better handle the case where stdout contains
unreplaced mentions of line numbers, and also reflects that stdout is
typically a consequence of the test rather than commentary on it, so
placing it after the test seems likely to read better.
2023-08-08 19:51:52 +00:00
Prabhat SachdevaandRichard Smith a359da37c4 Explorer: improve type checking trace output (#3039)
Updates the trace output for type checking to be more consistent like
the rest of trace output.
This PR also includes few changes in the lit tests related to trace
output.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-08-08 17:58:12 +00:00
Prabhat Sachdeva 2c4fff25a8 Explorer: add more information to stack trace (#3040)
Adds **action kind** and **source location** for stack trace.
Example:
```
(+) stack-push: <action> (<source location>)
(+) stack-pop:  <action> (<source location>)
```
This PR also updates the `Action::Print(...)` method, following is the
generalized view of `Action::Print(...)`.
```
ActionKind pos: <pos_count> `<related_code>` results: [<collected_results>]  scope: [<scope>]
```
2023-08-03 16:05:37 +00:00
Jon Ross-Perkins 96517a1ee3 Migrate explorer tests to file_test and remove lit support. (#3050)
This migrates explorer tests to file_test, using the new --autoupdate
functionality. Per discussion, the trace tests that were using "not"
output are mostly migrated to checking full output. The main exception
is tests that were including trace output from the prelude: the prelude
output is pretty long (multiple MB already) and I think it wasn't the
intent to include, only trace output from the small program.

This is the remaining use of lit support, so the supporting libraries
are also removed here.
2023-08-02 21:44:16 +00:00