M6.1 Released

Two months ago we released M6 and we’re now ready with another update containing a bunch of goodies.

Language Improvements

There are several new language features and enhancements.

Improved Inference

Type inference now accounts for smart casts. As such the following will work correctly:

Better Casting Diagnostics

The compiler is now smarter, catching impossible casts

will give a compiler error.

Same way, casts for bare types can now be deduced

Also, else is no longer required in when clause when its return value is not relevant (i.e. it is used as a statement):

Suppress Warnings

You can decorate any declaration or expression with a suppress annotation (or hit Alt+Enter to let IntelliJ IDEA do it for you) so that the compiler no longer issues warnings inside it. This can be used for unchecked casts, renamed parameters and any other warnings.

Local returns in lambdas

To avoid confusion, a bare return always means “return from a named function”. This means that in a lambda expression you are not allowed to say “return x” meaning that your lambda returns x. To mitigate this, you can now have labeled returns in lambdas. Say we have a higher order function named foo

we can call this passing a lambda that checks a condition and returns early

The explicit labeling on the definition is not required, so the previous would be equivalent to:

Lambdas are automatically labeled after function they are passed to.

Note:The explicit return type in the lambda definition is a temporary requirement and will not be necessary in the future


Warning: Metadata format changed

We have made major changes to the binary format on the JVM, including decreasing the size footprint, increasing speed  and preparations for Reflection. Binaries compiled with older Kotlin versions will be incompatible.

JavaScript Support

Despite having a successful commercial product using Kotlin, and being compiled down to JavaScript, we have mostly been focusing our efforts on the JVM. That is until recently. We’re now pushing full  throttle with JavaScript support and with this release we add to the list of features provided, including:

  • Support for enums
  • Class Objects
  • Delegated properties
  • Multi-Declarations
  • SourceMaps

We’ve also deprecated support for ECMAScript 3 with this release.

Targeting JavaScript applications deserves more details and it is something we’ll be covering soon.

IDE Enhancements

We have a bunch more functionality in this release when it comes to IntelliJ IDEA support.

  • Convert member function to extension function
  • Navigation to getters and setters of a delegated property (Ctlr+click on by)
  • Navigation to iterator/next/hasNext in a for loop (Ctlr+click on in)
  • Navigation to invoke() from a call site (Ctlr+click on parentheses)
  • Improvements on Find Usages including support for constructors  and overrides

We’ve also improved project configuration including for Maven and Gradle based projects, including UI improvements, as well as some tweaking Completion.

Last but not least, this release also provides support for the newest EAP of IntelliJ IDEA 13 as well as the latest Android Studio.

You can find the Compiler and Plugins on our release page on GitHub. If you’re using IntelliJ IDEA, you can download the latest plugin from our repository or update it directly via Plugins in IntelliJ IDEA.

This entry was posted in General and tagged . Bookmark the permalink.

7 Responses to M6.1 Released

  1. user says:

    Are there any options which allow to compile Kotlin into Javascript with asm.js annotations (where they are possible)?

    • Zalim Bashorov says:

      Thanks for the question.

      We don’t have any options for this.
      Seems asm.js right now is not better target for managed languages(see faq) but we need investigate it.

  2. B7W says:

    People start to develop some libs for kotlin. But community still very small, and it is hard to find smth. It is a good idea to make some page with links to github projects and simple activities of these projects.

  3. Greg says:

    My big wish is async / await feature, like it is implemented in C#. Keep hoping for it to appear in Kotlin as well. Thanks!

  4. Sergey says:

    I am wondering why this kind of syntax is allowed in a standalone function but doesn’t work in a class method?


    fun foo(bar : Int) : Int {
    val i = bar * 9
    i * i // no need for the return statement
    }

    The same function demands the return statement if it’s a class method. Why?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">