Coder Social home page Coder Social logo

arrow_crash's Introduction

Kotlin inlining bug related to Arrow

Link to JetBrains issue:

This was originally opened as an Arrow issue at:

This is a demo of how this code causes Arrow-kt.io to crash:

val some10 = Some(10)
val some11 = some10.map { it + 1 }

// if present, this next line with cause:
//    Error: Unable to initialize main class dashfwd.CrashDemoKt
//    Caused by: java.lang.VerifyError: Bad type on operand stack
// with jdk-11.0.2
some11.getOrElse { Some(0) }

To run:

$ ./gradlew assemble
$ ./gradlew runJar

The output:

Error: Unable to initialize main class dashfwd.CrashDemoKt
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    dashfwd/CrashDemoKt.main([Ljava/lang/String;)V @103: invokestatic
  Reason:
    Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'arrow/core/Option'
  Current Frame:
    bci: @103
    flags: { }
    locals: { '[Ljava/lang/String;', 'arrow/core/Some', 'java/lang/Object', 'arrow/core/Some', 'arrow/core/Some', 'arrow/core/Some' }
    stack: { 'java/lang/Object', 'kotlin/jvm/functions/Function0' }
  Bytecode:
    0000000: 2a12 09b8 000f bb00 1159 100a b800 17b7
    0000010: 001b 4c2b 4e2d 3a04 1904 3a05 1905 c100
    0000020: 1d99 0008 1904 a700 3719 04b6 0021 3a06
    0000030: 1906 c000 23b6 0027 3607 0336 0815 0704
    0000040: 60b8 0017 3a10 1910 3a11 bb00 1159 1911
    0000050: b700 1bc0 0029 3a09 1909 c000 2b00 004d
    0000060: 2cb2 0031 c000 33b8 0039 57b1          
  Stackmap Table:
    full_frame(@41,{Object[#76],Object[#17],Top,Object[#17],Object[#17],Object[#17]},{})
    same_locals_1_stack_item_frame(@93,Object[#4])

arrow_crash's People

Contributors

dashfwd avatar

Forkers

mattmoore

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.