Git Product home page Git Product logo

sweekt's Introduction

Toolkit [ 🚧 Work in progress ⛏👷🔧️ 🚧 ]

Snapshot version:
repositories {
  maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
}

dependencies {
  implementation("com.meowool.toolkit:sweekt:0.1.0-SNAPSHOT")
}

The document has not been written.

For more details please refer to kdoc, and the usage please refer to the directory related to test:

  1. CommonTest
  2. JvmTest

sweekt's People

Contributors

chachako avatar gradle-update-robot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sweekt's Issues

Support union types: https://youtrack.jetbrains.com/issue/KT-13108

Temporary solving https://youtrack.jetbrains.com/issue/KT-13108#focus=Comments-27-5474923.0-0

fun save(data: Union4<String, Int, Long, List<String>>): UnionType<Boolean, String> {
  var result = Result(false)

  when {
    data is String -> { ... }
    data is Int -> { ... }
    data is Long -> { ... }
    data is List<String> -> { ... }
    data is Boolean -> { ... } // ERROR: Never this type
  }

- return result // ERROR: Can only return 'Boolean' or 'String'
+ return result.value // OK: 'Boolean'
+ return result.value.toString() // OK: 'String'
}

fun main() {
  save("Username") // OK: 'String'
  save(50) // OK: 'Int'
  save(1000000L) // OK: 'Long'
  save(listOf("A", "B")) // OK: 'List<String>'
  save(listOf("A", "B", 50)) // ERROR: Only 'List<String>' type are allowed

  val any: Any = getAnyData()
  save(any) // ERROR: 'Any' type not allowed
}

Diagnosis:

TypeChecker
CallChecker
`is` & `as` Checker

Check the lazy property declared in the constructor

This is meaningless, because the class will directly initialize the property when calling the constructor:

Meaningless b:

class Foo(a: Boolean, @LazyInit val b: String = "String")

Foo(true) // in bytecode decompilation -> Foo(true, "String")

Way to extend a father class

您好!我是一名kotlin compiler的初学者,请问您可以告诉我怎么使用kotlin compiler去继承一个父类吗?比如:
open class A(){}
@随意的注解名
class B(){}
被注解的类可以变成:
class B:A(){}
十分感谢!

sweekt-compiler cannot be used with compose-compiler

When these two compiler plugins are applied at the same time and the priority of sweekt is lower than compose, an error will occur. The simplest solution is that sweekt is applied earlier than compose

plugins {
    id("com.meowool.sweekt") // must be before the compose or android app
 // id("com.android.application")
    id("org.jetbrains.compose")
}

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.