Ponyc: Compiler crash with intersection types of equivalent interfaces

Created on 11 Sep 2019  路  4Comments  路  Source: ponylang/ponyc

The compiler crashes after a series of changes to my application, that can be found on https://github.com/niclash/pink2web

'master' branch is the last version that compiles

'3305' branch is containing a single commit and that branch doesn't compile, and the compiler crashes.

bug help wanted needs investigation

Most helpful comment

Minimal example:

interface Foo
  fun apply(): String ref^ // Doesn't crash if this has an implementation, but errors

interface Bar // Still crashes if this is a `trait` like in the original example
  fun apply() : String ref^ =>
    var x = String(10)
    x
    // Doesn't crash if the two lines above are replaced with the line below
    // String(10)

class Baz is (Foo & Bar)

actor Main
  new create(env: Env) =>
    None

All 4 comments

What's the SHA for the commit on 3305 vs SHA that worked? Can you add in case things change in the future?

Compiles; d503886898f6b18dc6c436d9b3d5788b3aea9656
Crashes; a52befe77e7d9b1d39166047dbf176b63db8c01f

Furthermore, I moved the default function from the trait to the class, worked on all the issues and got my code to a working condition. Then I moved the default function back to the trait, and the compiler doesn't crash.
So, it is most likely that the crash is happening for a non-anticipated code error, and that is kind of the whole point with the assert in the cpp code.

Minimal example:

interface Foo
  fun apply(): String ref^ // Doesn't crash if this has an implementation, but errors

interface Bar // Still crashes if this is a `trait` like in the original example
  fun apply() : String ref^ =>
    var x = String(10)
    x
    // Doesn't crash if the two lines above are replaced with the line below
    // String(10)

class Baz is (Foo & Bar)

actor Main
  new create(env: Env) =>
    None
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Theodus picture Theodus  路  6Comments

jemc picture jemc  路  5Comments

willemneal picture willemneal  路  5Comments

SeanTAllen picture SeanTAllen  路  5Comments

WoodyAtHome picture WoodyAtHome  路  12Comments