Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Prototype implementation of KEEP-87 #6

Open
wants to merge 65 commits into
base: master
from
Open
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4d0d862
Add Typeclasses feature to the language
truizlop Sep 25, 2018
8f1b0fb
Add 'with' and 'extension' keywords to language syntax
truizlop Sep 25, 2018
218c408
Define valid elements for 'implicit' and 'extension' modifiers
truizlop Sep 25, 2018
2598374
Add flags to represent if values are implicit or extension
truizlop Sep 25, 2018
83e8c8d
Test parsing of 'with' and 'extension' keywords
truizlop Sep 25, 2018
28eb173
Disable reporting unused implicit parameters
truizlop Sep 25, 2018
0074a4e
Modify resolution algorithm to include implicit values in the scope
truizlop Sep 25, 2018
48f345a
Test functions are resolved according to the new algorithm
truizlop Sep 25, 2018
d719b31
Generate bytecode to use implicit parameters in function body
truizlop Sep 25, 2018
870eb22
Resolve and instantiate implicit parameters in function calls
truizlop Sep 25, 2018
601d541
Generalize resolution algorithm
truizlop Sep 28, 2018
b9abfb1
Extend resolution algorithm to look for typeclass instances in type a…
truizlop Oct 1, 2018
512adb3
Add tests for different resolution scenarios
truizlop Oct 1, 2018
2876b83
Only allow orphan instances if they are internal
truizlop Oct 8, 2018
7dec90d
Add support for extension object
truizlop Oct 9, 2018
d1d6ce4
Look for instances in type parameter hierarchy. Addresses #9
truizlop Oct 9, 2018
980971a
Add support for implicit parameters with concrete types
truizlop Oct 9, 2018
9580181
Capture implicit values in closures
truizlop Nov 26, 2018
e68d3f7
change plugin properties to unlock deploys
JorgeCastilloPrz Jan 12, 2019
512af99
add task to generate and zip binaries
JorgeCastilloPrz Jan 17, 2019
3810184
move aws tasks to kotlin
JorgeCastilloPrz Jan 23, 2019
f6c24db
added task to upload metadata too
JorgeCastilloPrz Jan 23, 2019
1a3c88d
read new version from plugin.xml file
JorgeCastilloPrz Jan 23, 2019
c91a1d8
uncomment dependency on zipKeep task
JorgeCastilloPrz Jan 23, 2019
be6f1c8
create file if it doesnt exist yet
JorgeCastilloPrz Jan 23, 2019
c2f22b6
fix plugin deploy
JorgeCastilloPrz Jan 25, 2019
90b332f
Improve logging and split generation and validation logics (#23)
JorgeCastilloPrz Apr 5, 2019
4c2b4cf
rename ImplicitValueArgument
JorgeCastilloPrz Apr 5, 2019
a6b4d80
rename generateImplicit() function
JorgeCastilloPrz Apr 5, 2019
0822de5
rename findImplicitParameters function from AsmUtil
JorgeCastilloPrz Apr 5, 2019
af3c47f
rename isImplicit flag
JorgeCastilloPrz Apr 5, 2019
0cb99dc
rename ImplicitCandidate
JorgeCastilloPrz Apr 5, 2019
64e9bc4
rename ClosureCodegen implicit mentions
JorgeCastilloPrz Apr 5, 2019
1e7eb92
rename JvmCodegenUtil occurrences
JorgeCastilloPrz Apr 5, 2019
5c7e898
rename CompatibilityResult
JorgeCastilloPrz Apr 5, 2019
5ec514e
rename extension candidate resolution
JorgeCastilloPrz Apr 5, 2019
0c84097
rename ImplicitResolution
JorgeCastilloPrz Apr 5, 2019
b9addd4
replace implicit in error messages by extension
JorgeCastilloPrz Apr 5, 2019
d2aa0cc
rename any implicit or typeclass occurrences in ExtensionResolution
JorgeCastilloPrz Apr 5, 2019
c348fe7
rename extension resolution strategy
JorgeCastilloPrz Apr 5, 2019
8fef4c5
rename other occurrences in ExtensionResolutionStrategy
JorgeCastilloPrz Apr 5, 2019
ee56216
rename occurrences in BodyResolver
JorgeCastilloPrz Apr 5, 2019
15a6aef
rename language feature
JorgeCastilloPrz Apr 5, 2019
d8e5a76
rename implicit argument
JorgeCastilloPrz Apr 5, 2019
25d69c6
rename typeclass tests
JorgeCastilloPrz Apr 5, 2019
8015e69
regenerate test sources
JorgeCastilloPrz Apr 5, 2019
f547685
Update test for complex resolution
truizlop Apr 8, 2019
130bdbe
Update test for resolution from function parameter
truizlop Apr 8, 2019
2bb2ef9
Update test for explicit resolution
truizlop Apr 8, 2019
14b0133
Update test for concrete type resolution
truizlop Apr 9, 2019
7e2b217
Update test for resolution in companion object of extension contract
truizlop Apr 9, 2019
67a2eb4
Fix bug returning duplicate candidates
truizlop Apr 9, 2019
df62183
Update test for resolution in subpackage of the extension contract
truizlop Apr 9, 2019
d87e260
Update test for resolution in the same package
truizlop Apr 9, 2019
cb1118e
Update test for resolution of nested instances
truizlop Apr 9, 2019
fbab4ea
Update test for resolution in type companion
truizlop Apr 9, 2019
629fac0
Update test for resolution in type subpackages
truizlop Apr 9, 2019
ed30405
Update error reporting tests
truizlop Apr 9, 2019
0183755
Update parsing tests
truizlop Apr 9, 2019
ea370f9
Update resolution tests
truizlop Apr 9, 2019
b36fdda
Merge pull request #25 from arrow-kt/jc-remove-implicit-naming-and-an…
JorgeCastilloPrz Apr 9, 2019
29a632b
bump keep to 0.2 and deploy to our amazon s3 plugin repository
JorgeCastilloPrz Apr 10, 2019
2190f0d
Fix wording over first resolution scope in messages.
JorgeCastilloPrz Apr 12, 2019
bc6bacf
Extensions in subpackages are only valid if declared as internal
truizlop Apr 15, 2019
672eaf5
Deploy version 0.3
truizlop Apr 15, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Update test for resolution in companion object of extension contract

  • Loading branch information...
truizlop committed Apr 9, 2019
commit 7e2b217896227ebb89e7a1448da8276ed9a9e5ce
@@ -1,26 +1,29 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: Semigroup.kt
// FILE: Validator.kt

package com.extensionresolution

interface Semigroup<A> {
fun A.combine(b: A): A
interface Validator<A> {
fun A.isValid(): Boolean

companion object {
extension object IntSemigroup : Semigroup<Int> {
override fun Int.combine(b: Int): Int = this + b
extension object UserValidator: Validator<User> {
override fun User.isValid(): Boolean {
return id > 0 && name.length > 0
}
}
}
}

fun <A> duplicate(a: A, with semigroup: Semigroup<A>) : A = a.combine(a)
data class User(val id: Int, val name: String)

fun <A> validate(a: A, with validator: Validator<A>): Boolean = a.isValid()

fun box(): String {
val x = duplicate(2)
return if (x == 4) {
return if (validate(User(1, "Alice"))) {
"OK"
} else {
"fail 1"
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.