Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explorer crashes attempting Value -> TupleValue cast #1394

Closed
pk19604014 opened this issue Jul 15, 2022 · 1 comment · Fixed by #2266 or #2288
Closed

explorer crashes attempting Value -> TupleValue cast #1394

pk19604014 opened this issue Jul 15, 2022 · 1 comment · Fixed by #2266 or #2288
Labels
explorer Action items related to Carbon explorer code

Comments

@pk19604014
Copy link
Contributor

// Generated by proto_to_carbon.

package EmptyIdentifier impl;

fn apply[T:! Type, U:! Type](f: T, EmptyIdentifier: U)
{
match (true[true]) {}
}

fn EmptyIdentifier() -> apply(true, true);

fn Main() -> i32 {
  return 0;
}

explorer: external/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From &) [To = Carbon::TupleValue, From = Carbon::Value]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
```
@jonmeow jonmeow added the explorer Action items related to Carbon explorer code label Aug 24, 2022
pmqtt pushed a commit to pmqtt/carbon-lang that referenced this issue Oct 7, 2022
pmqtt pushed a commit to pmqtt/carbon-lang that referenced this issue Oct 7, 2022
@pmqtt pmqtt mentioned this issue Oct 7, 2022
pmqtt added a commit that referenced this issue Oct 13, 2022
* start correct

* Fix #1394

* remove llvm::outs()

* Fix #1394

* ---

* fix issue-1394

* fix issue-1394

* Update explorer/interpreter/interpreter.cpp

Co-authored-by: Geoff Romer <gromer@google.com>

* fix issue-1394

* remove and rename test files

* add changes from j.m

Co-authored-by: m new <michael.burzan@outlook.de>
Co-authored-by: Geoff Romer <gromer@google.com>
zygoloid added a commit to zygoloid/carbon-lang that referenced this issue Oct 13, 2022
This change left a test broken, and after further discussion it's not
clear that this is the direction we want to go in.

This reverts commit 6cf2272.
zygoloid added a commit that referenced this issue Oct 13, 2022
This change left a test broken and removed a fair amount of test coverage for unrelated features, and after further discussion it's not clear that this is the direction we want to go in.

This reverts commit 6cf2272.
@jonmeow jonmeow reopened this Oct 13, 2022
@jonmeow
Copy link
Contributor

jonmeow commented Oct 13, 2022

To note, since a different approach of rearranging type-checking in explorer is being suggested, a test-case to verify:

class Foo {
  fn PickType() -> Type { return i32; }
  // Invalid because the body of PickType should be moved below Foo:
  fn GetZero() -> PickType() { return 0; }
}

I believe this is invalid due to proposal #875, because the body of PickType should only be type-checked after Foo is complete; consequently, it can't be used to determine the return type of GetZero, because that must be type-checked in order to complete Foo.

I don't think explorer had previously been set up to do this, so it's just an edge case to watch for.

zygoloid added a commit to zygoloid/carbon-lang that referenced this issue Oct 13, 2022
There are lots of ways a declaration can be used before we have the
information necessary to handle that use. Issue diagnostics for these.

Interleave declaration and type-checking of global declarations so that
declaring a later declaration can depend on the results of type-checking
an earlier one.

Fixes carbon-language#1394, fixes carbon-language#1395, fixes carbon-language#1396.
zygoloid added a commit that referenced this issue Oct 13, 2022
There are lots of ways a declaration can be used before we have the information necessary to handle that use. Issue diagnostics for these.

Interleave declaration and type-checking of global declarations so that declaring a later declaration can depend on the results of type-checking an earlier one.

Incorporates tests added in #2266.

Fixes #1394, fixes #1395, fixes #1396.

Co-authored-by: pmqtt <51272730+pmqtt@users.noreply.github.com>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explorer Action items related to Carbon explorer code
Projects
None yet
2 participants