Skip to content

Commit fda332f

Browse files
authored
Merge pull request #22 from neilccbrown/master
Fix a bug with default parameter handling for class methods
2 parents e343412 + 0caf854 commit fda332f

File tree

12 files changed

+60
-8
lines changed

12 files changed

+60
-8
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
22

33
val useScalaVersion = "2.13.14"
4-
val releaseVersion = "1.1.1"
4+
val releaseVersion = "1.1.2"
55

66
val sharedSettings = Seq(
77
scalaVersion := useScalaVersion,

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{
33
"name": "tigerpython-parser",
4-
"version": "1.1.1",
4+
"version": "1.1.2",
55
"description": "Enhanced error recognition in Python ",
66
"main": "release/tigerpython-parser.mjs",
77
"types": "tpParser/js/types/index.d.ts",

release/tigerpython-parser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/tigerpython-parser.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52453,7 +52453,7 @@ $p.nv = (function() {
5245352453
throw new $c_s_MatchError(xs$2);
5245452454
}
5245552455
}
52456-
return $f_sc_IterableOnceOps__mkString__T__T__T__T($x_10.aB($m_sc_ArrayOps$().sN(ys, 0, this.H6)), "", ", ", "");
52456+
return $f_sc_IterableOnceOps__mkString__T__T__T__T($x_10.aB($m_sc_ArrayOps$().sN(ys, 0, (((-1) + this.H6) | 0))), "", ", ", "");
5245752457
} else {
5245852458
var $x_20 = $m_s_Predef$();
5245952459
var xs$3 = this.sd;

tpParser/shared/src/main/scala/tigerpython/parser/types/PythonFunction.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PythonFunction(val name: String,
3232

3333
override def getParamsString: String =
3434
if (isMethod && params.nonEmpty)
35-
params.drop(1).map(_.name).take(paramCount).mkString(", ")
35+
params.drop(1).map(_.name).take(paramCount - 1).mkString(", ")
3636
else
3737
params.map(_.name).take(paramCount).mkString(", ")
3838

tpParser/shared/src/main/scala/tigerpython/utilities/types/PythonFunction.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PythonFunction(val name: String,
2525

2626
override def getParamsString: String =
2727
if (isMethod && params.nonEmpty)
28-
params.drop(1).map(_.name).take(paramCount).mkString(", ")
28+
params.drop(1).map(_.name).take(paramCount - 1).mkString(", ")
2929
else
3030
params.map(_.name).take(paramCount).mkString(", ")
3131

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# parent3.child3.shape3
2+
# class Shape:
3+
# pos_x
4+
# pos_y
5+
# __init__(self, x, y)
6+
# draw(self)
7+
# extent(self)
8+
# rotate_by(self, degrees = 90)
9+
# [Shape]make_shape()
10+
# 49
11+
# degrees=90
12+
from parent3.child3.shape3 import *
13+
make_shape().rotate_by()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# pyi:parent4.child4.shapeparams4
2+
# class Shape:
3+
# def __init__(self, x, y) -> None: ...
4+
# def draw(self) -> None: ...
5+
# def extent(self) -> int: ...
6+
# def rotate_by(self, units:str, degrees: float = 90) -> Shape: ...
7+
# def make_shape() -> Shape: ...
8+
# 55
9+
# units
10+
from parent4.child4.shapeparams4 import *
11+
make_shape().rotate_by()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# pyi:parent5.child5.shapeparams5
2+
# class Shape:
3+
# def __init__(self, x, y:float=...) -> None: ...
4+
# def draw(self) -> None: ...
5+
# def extent(self) -> int: ...
6+
# def rotate_by(self, degrees: float = 90) -> Shape: ...
7+
# def make_shape() -> Shape: ...
8+
# def make_shape_at(x, y: int = ..., z:int = ...) -> None: ...
9+
# 42
10+
# x
11+
from parent5.child5.shapeparams5 import *
12+
make_shape_at()

0 commit comments

Comments
 (0)