Giter Club home page Giter Club logo

Comments (4)

SeanTAllen avatar SeanTAllen commented on May 28, 2024

Code in question:

actor Main
  new create(env: Env) =>
    Foo[String box](env, "message")
    Foo[String box].double()(env, "message")

    
trait Printer[T: Stringable box]
  fun apply(env: Env, msg: T)
  
  fun double(): Printer[T] =>
    object ref is Printer[T]
      fun apply(env: Env, msg: T) =>
        env.out.print("First " + msg.string())
        env.out.print("Second " + msg.string())
    end


class Foo[T: Stringable box] is Printer[T]
  fun apply(env: Env, msg: T) =>
    env.out.print("Just one " + msg.string())

from ponyc.

SeanTAllen avatar SeanTAllen commented on May 28, 2024

Here's the backtrace from a debug version of the compiler:

/home/sean/code/ponylang/ponyc/src/libponyc/pass/expr.c:661: pass_expr: Assertion `errors_get_count(options->check.errors) > 0` failed.

Backtrace:
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ponyint_assert_fail+0x96) [0x555555d2afb6]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(pass_expr+0x534) [0x555555c868e4]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x2a4) [0x555555c87224]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(+0x733ce6) [0x555555c87ce6]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(+0x7336aa) [0x555555c876aa]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_passes_type+0x114) [0x555555c879f4]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(+0x7bc485) [0x555555d10485]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(expr_object+0x1a15) [0x555555d0f905]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(pass_expr+0x422) [0x555555c867d2]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x2a4) [0x555555c87224]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_visit+0x1e4) [0x555555c87164]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(+0x733ce6) [0x555555c87ce6]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(+0x7336aa) [0x555555c876aa]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(ast_passes_program+0x22) [0x555555c872f2]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(program_load+0xb8) [0x555555ca9e58]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(+0x6d232c) [0x555555c2632c]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(main+0x261) [0x555555c261d1]
  /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7ffff7ca6d90]
  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7ffff7ca6e40]
  /home/sean/code/ponylang/ponyc/build/debug/ponyc(_start+0x25) [0x555555c25ea5]
Process 1091 stopped
* thread #1, name = 'ponyc', stop reason = signal SIGABRT

For the uninitated, when you go to look at pass_expr, what this is indicating is that when we attempted to compile this, something returned false from an expression pass handling step (setting r to false) but didn't get an error. That is "ungood".

from ponyc.

SeanTAllen avatar SeanTAllen commented on May 28, 2024

The AST item in question when we go boom appears to be a TK_DOT.

tk_dot ends up in entity_access which definitely returns false from some locations without setting an error.

Next step is additional debugging to figure out what is the unexpected bit and probably one of:

  • how we getting this far without having already displayed an error earlier
  • what was supposed to have been done earlier that wasn't
  • what's the unhandled case

in all likelihood, its the first in that list.

from ponyc.

SeanTAllen avatar SeanTAllen commented on May 28, 2024

Changing to:

actor Main
  new create(env: Env) =>
    Foo[String box](env, "message")
    Foo[String box].double()(env, "message")

    
trait Printer[T: Stringable box]
  fun apply(env: Env, msg: T)
  
  fun double(): Printer[T] =>
    Foo[T]


class Foo[T: Stringable box] is Printer[T]
  fun apply(env: Env, msg: T) =>
    env.out.print("Just one " + msg.string())

fixes the issue, so, focus on the object literal when debugging.

from ponyc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.