Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: Parser
    • Labels:
      None

      Description

      Kotlin 1.3 was released recently, we should update the embedded compiler library to be able to handle new syntax changes.

      https://search.maven.org/artifact/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.3.10/jar

      After a first investigation, it seems that the core structure of the AST produced by the Kotlin parser changed, using a KtScript node as root. This need to be handled to get back on our feet (removing that new layer?).

      New syntax have also been added, possibly impacting our current mapping on the SLang AST. Notably:

      • Contracts: allow a function to explicitly describe its behavior in a way which is understood by the compiler.
        fun require(condition: Boolean) {
            // This is a syntax form, which tells compiler:
            // "if this function returns successfully, then passed 'condition' is true"
            contract { returns() implies condition }
            if (!condition) throw IllegalArgumentException(...)
        }
        
        fun foo(s: String?) {
            require(s is String)
            // s is smartcasted to 'String' here, because otherwise
            // 'require' would have throw an exception
        }
        
      • val in when:
        fun Request.getBody() =
                when (val response = executeRequest()) {
                    is Success -> response.body
                    is HttpError -> throw HttpException(response.status)
                }
        
      • inline classes:
        inline class Name(val s: String)
        

        Attachments

          Activity

            People

            • Assignee:
              christophe.zurn Christophe Zurn
              Reporter:
              tibor.blenessy Tibor Blenessy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: